MFC @ r259205 in preparation for some SVM updates. (for real this time)

This commit is contained in:
Peter Grehan 2014-02-04 06:59:08 +00:00
commit 485ac45a53
4096 changed files with 198464 additions and 170915 deletions

View File

@ -99,7 +99,6 @@ nfs alfred Will be happy to review code, but not mandatory.
rpc.lockd alfred Will be happy to review code, but not mandatory.
truss alfred Will be happy to review code, but not mandatory.
rpc alfred Pre-commit review requested.
pkg_install portmgr Pre-commit review or approval from portmgr@ requested.
linux emul emulation Please discuss changes here.
bs{diff,patch} cperciva Pre-commit review requested.
portsnap cperciva Pre-commit review requested.

View File

@ -58,6 +58,7 @@
# use that new version. And the new (dynamically-linked) /bin/sh
# will expect to find appropriate libraries in /lib and /libexec.
#
SRCDIR?= ${.CURDIR}
.if defined(SUBDIR_OVERRIDE)
SUBDIR= ${SUBDIR_OVERRIDE}
.else
@ -84,6 +85,9 @@ SUBDIR+=secure
SUBDIR+=share
.endif
SUBDIR+=sys usr.bin usr.sbin
.if ${MK_TESTS} != "no"
SUBDIR+= tests
.endif
.if ${MK_OFED} != "no"
SUBDIR+=contrib/ofed
.endif
@ -128,8 +132,11 @@ OSRELDATE= 0
.endif
.if !defined(VERSION)
VERSION!= uname -srp
VERSION+= ${OSRELDATE}
REVISION!= make -C ${SRCDIR}/release -V REVISION
BRANCH!= make -C ${SRCDIR}/release -V BRANCH
SRCRELDATE!= awk '/^\#define[[:space:]]*__FreeBSD_version/ { print $$3 }' \
${SRCDIR}/sys/sys/param.h
VERSION= FreeBSD ${REVISION}-${BRANCH:C/-p[0-9]+$//} ${TARGET_ARCH} ${SRCRELDATE}
.endif
KNOWN_ARCHES?= amd64 arm armeb/arm armv6/arm i386 i386/pc98 ia64 mips mipsel/mips mips64el/mips mips64/mips mipsn32el/mips mipsn32/mips powerpc powerpc64/powerpc sparc64
@ -256,6 +263,21 @@ XMAKE= TOOLS_PREFIX=${WORLDTMP} ${BMAKE} \
TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \
-DWITHOUT_GDB
# kernel-tools stage
KTMAKEENV= INSTALL="sh ${.CURDIR}/tools/install.sh" \
PATH=${BPATH}:${PATH} \
WORLDTMP=${WORLDTMP} \
VERSION="${VERSION}" \
COMPILER_TYPE=${COMPILER_TYPE}
KTMAKE= TOOLS_PREFIX=${WORLDTMP} MAKEOBJDIRPREFIX=${WORLDTMP} \
${KTMAKEENV} ${MAKE} ${WORLD_FLAGS} -f Makefile.inc1 \
DESTDIR= \
BOOTSTRAPPING=${OSRELDATE} \
SSP_CFLAGS= \
-DWITHOUT_HTML -DWITHOUT_INFO -DNO_LINT -DWITHOUT_MAN \
-DNO_PIC -DNO_PROFILE -DNO_SHARED \
-DNO_CPU_CFLAGS -DNO_WARNS -DNO_CTF -DEARLY_BUILD
# world stage
WMAKEENV= ${CROSSENV} \
_SHLIBDIRPREFIX=${WORLDTMP} \
@ -329,7 +351,7 @@ TARGET_ABI= gnueabi
.else
TARGET_ABI= unknown
.endif
TARGET_TRIPLE?= ${TARGET_ARCH:C/amd64/x86_64/}-${TARGET_ABI}-freebsd10.0
TARGET_TRIPLE?= ${TARGET_ARCH:C/amd64/x86_64/}-${TARGET_ABI}-freebsd11.0
XFLAGS+= -target ${TARGET_TRIPLE}
.endif
.endif
@ -485,6 +507,10 @@ _worldtmp:
mtree -deU -f ${.CURDIR}/etc/mtree/BSD.debug.dist \
-p ${WORLDTMP}/usr/lib >/dev/null
.endif
.if ${MK_TESTS} != "no"
mtree -deU -f ${.CURDIR}/etc/mtree/BSD.tests.dist \
-p ${WORLDTMP}/usr >/dev/null
.endif
.for _mtree in ${LOCAL_MTREE}
mtree -deU -f ${.CURDIR}/${_mtree} -p ${WORLDTMP} > /dev/null
.endfor
@ -529,6 +555,7 @@ _cross-tools:
@echo ">>> stage 3: cross tools"
@echo "--------------------------------------------------------------"
${_+_}cd ${.CURDIR}; ${XMAKE} cross-tools
${_+_}cd ${.CURDIR}; ${XMAKE} kernel-tools
_includes:
@echo
@echo "--------------------------------------------------------------"
@ -1008,20 +1035,7 @@ buildkernel:
@echo "--------------------------------------------------------------"
@echo ">>> stage 2.3: build tools"
@echo "--------------------------------------------------------------"
cd ${KRNLOBJDIR}/${_kernel}; \
PATH=${BPATH}:${PATH} \
MAKESRCPATH=${KERNSRCDIR}/dev/aic7xxx/aicasm \
${MAKE} SSP_CFLAGS= -DNO_CPU_CFLAGS -DNO_CTF -DEARLY_BUILD \
-f ${KERNSRCDIR}/dev/aic7xxx/aicasm/Makefile
# XXX - Gratuitously builds aicasm in the ``makeoptions NO_MODULES'' case.
.if !defined(MODULES_WITH_WORLD) && !defined(NO_MODULES) && exists(${KERNSRCDIR}/modules)
.for target in obj depend all
cd ${KERNSRCDIR}/modules/aic7xxx/aicasm; \
PATH=${BPATH}:${PATH} \
MAKEOBJDIRPREFIX=${KRNLOBJDIR}/${_kernel}/modules \
${MAKE} SSP_CFLAGS= -DNO_CPU_CFLAGS -DNO_CTF -DEARLY_BUILD ${target}
.endfor
.endif
${_+_}cd ${.CURDIR}; ${KTMAKE} kernel-tools
.if !defined(NO_KERNELDEPEND)
@echo
@echo "--------------------------------------------------------------"
@ -1308,10 +1322,6 @@ bootstrap-tools: .MAKE
#
# build-tools: Build special purpose build tools
#
.if defined(MODULES_WITH_WORLD) && exists(${KERNSRCDIR}/modules)
_aicasm= sys/modules/aic7xxx/aicasm
.endif
.if !defined(NO_SHARE)
_share= share/syscons/scrnmaps
.endif
@ -1333,7 +1343,6 @@ build-tools: .MAKE
lib/ncurses/ncurses \
lib/ncurses/ncursesw \
${_share} \
${_aicasm} \
usr.bin/awk \
lib/libmagic \
usr.bin/mkesdb_static \
@ -1353,6 +1362,23 @@ build-tools: .MAKE
${MAKE} DIRPRFX=${_tool}/ all
.endfor
#
# kernel-tools: Build kernel-building tools
#
kernel-tools: .MAKE
mkdir -p ${MAKEOBJDIRPREFIX}/usr
mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
-p ${MAKEOBJDIRPREFIX}/usr >/dev/null
.for _tool in \
sys/dev/aic7xxx/aicasm
${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \
cd ${.CURDIR}/${_tool} && \
${MAKE} DIRPRFX=${_tool}/ obj && \
${MAKE} DIRPRFX=${_tool}/ depend && \
${MAKE} DIRPRFX=${_tool}/ all && \
${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX} install
.endfor
#
# cross-tools: Build cross-building tools
#
@ -1377,12 +1403,15 @@ _binutils= gnu/usr.bin/binutils
# If an full path to an external cross compiler is given, don't build
# a cross compiler.
.if ${XCC:M/*} == "" && ${MK_CROSS_COMPILER} != "no"
.if ${MK_CLANG} != "no" && (${MK_CLANG_IS_CC} != "no" || ${CC:T:Mclang} == "clang")
.if ${MK_CLANG_IS_CC} != "no" || ${CC:T:Mclang} == "clang"
_clang= usr.bin/clang
_clang_libs= lib/clang
.else
_cc= gnu/usr.bin/cc
.endif
.if ${MK_GCC} != "no" && (${MK_CLANG_IS_CC} == "no" || ${TARGET} == "pc98")
# The boot2 for pc98 requires gcc.
.if ${TARGET} == "pc98"
_cc= gnu/usr.bin/cc
.endif
.endif
@ -1446,11 +1475,13 @@ _startup_libs+= lib/csu/${MACHINE_CPUARCH}
_startup_libs+= gnu/lib/libgcc
_startup_libs+= lib/libcompiler_rt
_startup_libs+= lib/libc
_startup_libs+= lib/libc_nonshared
.if ${MK_LIBCPLUSPLUS} != "no"
_startup_libs+= lib/libcxxrt
.endif
gnu/lib/libgcc__L: lib/libc__L
gnu/lib/libgcc__L: lib/libc_nonshared__L
.if ${MK_LIBCPLUSPLUS} != "no"
lib/libcxxrt__L: gnu/lib/libgcc__L
.endif
@ -1464,22 +1495,23 @@ _prebuild_libs= ${_kerberos5_lib_libasn1} \
${_kerberos5_lib_libhx509} ${_kerberos5_lib_libkrb5} \
${_kerberos5_lib_libroken} \
${_kerberos5_lib_libwind} \
${_lib_atf_libatf_c} \
${_lib_atf} \
lib/libbz2 ${_libcom_err} lib/libcrypt \
lib/libelf lib/libexpat \
${_lib_libgssapi} ${_lib_libipx} \
lib/libkiconv lib/libkvm lib/liblzma lib/libmd \
lib/libkiconv lib/libkvm lib/liblzma lib/libmd lib/libnv \
${_lib_libcapsicum} \
lib/ncurses/ncurses lib/ncurses/ncursesw \
lib/libopie lib/libpam ${_lib_libthr} \
lib/libradius lib/libsbuf lib/libtacplus \
${_cddl_lib_libumem} ${_cddl_lib_libnvpair} \
${_cddl_lib_libzfs_core} \
lib/libutil ${_lib_libypclnt} lib/libz lib/msun \
lib/libutil lib/libpjdlog ${_lib_libypclnt} lib/libz lib/msun \
${_secure_lib_libcrypto} ${_lib_libldns} \
${_secure_lib_libssh} ${_secure_lib_libssl}
.if ${MK_ATF} != "no"
_lib_atf_libatf_c= lib/atf/libatf-c
.if ${MK_TESTS} != "no"
_lib_atf= lib/atf
.endif
.if ${MK_LIBTHR} != "no"
@ -1490,6 +1522,13 @@ _lib_libthr= lib/libthr
_ofed_lib= contrib/ofed/usr.lib/
.endif
.if ${MK_CASPER} != "no"
_lib_libcapsicum=lib/libcapsicum
.endif
lib/libcapsicum__L: lib/libnv__L
lib/libpjdlog__L: lib/libutil__L
_generic_libs= ${_cddl_lib} gnu/lib ${_kerberos5_lib} lib ${_secure_lib} usr.bin/lex/lib ${_ofed_lib}
.for _DIR in ${LOCAL_LIB_DIRS}
.if exists(${.CURDIR}/${_DIR}/Makefile)
@ -1588,10 +1627,12 @@ ${_lib}__PL: .PHONY .MAKE
.if exists(${.CURDIR}/${_lib})
${_+_}@${ECHODIR} "===> ${_lib} (obj,depend,all,install)"; \
cd ${.CURDIR}/${_lib} && \
${MAKE} DIRPRFX=${_lib}/ obj && \
${MAKE} DIRPRFX=${_lib}/ depend && \
${MAKE} -DNO_PROFILE -DNO_PIC DIRPRFX=${_lib}/ all && \
${MAKE} -DNO_PROFILE -DNO_PIC DIRPRFX=${_lib}/ install
${MAKE} -DNO_TESTS DIRPRFX=${_lib}/ obj && \
${MAKE} -DNO_TESTS DIRPRFX=${_lib}/ depend && \
${MAKE} -DNO_TESTS -DNO_PROFILE -DNO_PIC \
DIRPRFX=${_lib}/ all && \
${MAKE} -DNO_TESTS -DNO_PROFILE -DNO_PIC \
DIRPRFX=${_lib}/ install
.endif
.endfor
@ -1600,10 +1641,10 @@ ${_lib}__L: .PHONY .MAKE
.if exists(${.CURDIR}/${_lib})
${_+_}@${ECHODIR} "===> ${_lib} (obj,depend,all,install)"; \
cd ${.CURDIR}/${_lib} && \
${MAKE} DIRPRFX=${_lib}/ obj && \
${MAKE} DIRPRFX=${_lib}/ depend && \
${MAKE} DIRPRFX=${_lib}/ all && \
${MAKE} DIRPRFX=${_lib}/ install
${MAKE} -DNO_TESTS DIRPRFX=${_lib}/ obj && \
${MAKE} -DNO_TESTS DIRPRFX=${_lib}/ depend && \
${MAKE} -DNO_TESTS DIRPRFX=${_lib}/ all && \
${MAKE} -DNO_TESTS DIRPRFX=${_lib}/ install
.endif
.endfor
@ -1613,10 +1654,12 @@ ${_lib}__L: .PHONY .MAKE
lib/libpam__L: .PHONY .MAKE
${_+_}@${ECHODIR} "===> lib/libpam (obj,depend,all,install)"; \
cd ${.CURDIR}/lib/libpam && \
${MAKE} DIRPRFX=lib/libpam/ obj && \
${MAKE} DIRPRFX=lib/libpam/ depend && \
${MAKE} DIRPRFX=lib/libpam/ -D_NO_LIBPAM_SO_YET all && \
${MAKE} DIRPRFX=lib/libpam/ -D_NO_LIBPAM_SO_YET install
${MAKE} -DNO_TESTS DIRPRFX=lib/libpam/ obj && \
${MAKE} -DNO_TESTS DIRPRFX=lib/libpam/ depend && \
${MAKE} -DNO_TESTS DIRPRFX=lib/libpam/ \
-D_NO_LIBPAM_SO_YET all && \
${MAKE} -DNO_TESTS DIRPRFX=lib/libpam/ \
-D_NO_LIBPAM_SO_YET install
_prereq_libs: ${_prereq_libs:S/$/__PL/}
_startup_libs: ${_startup_libs:S/$/__L/}
@ -1672,6 +1715,7 @@ delete-old-files:
# argument list will get too long. Using .for/.endfor make "loops" will make
# the Makefile parser segfault.
@exec 3<&0; \
cd ${.CURDIR}; \
${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
-V OLD_FILES -V "OLD_FILES:Musr/share/*.gz:R" | xargs -n1 | \
while read file; do \
@ -1694,7 +1738,8 @@ delete-old-files:
check-old-files:
@echo ">>> Checking for old files"
@${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
@cd ${.CURDIR}; \
${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
-V OLD_FILES -V "OLD_FILES:Musr/share/*.gz:R" | xargs -n1 | \
while read file; do \
if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \
@ -1715,6 +1760,7 @@ delete-old-libs:
@echo ">>> Removing old libraries"
@echo "${OLD_LIBS_MESSAGE}" | fmt
@exec 3<&0; \
cd ${.CURDIR}; \
${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
-V OLD_LIBS | xargs -n1 | \
while read file; do \
@ -1722,22 +1768,36 @@ delete-old-libs:
chflags noschg "${DESTDIR}/$${file}" 2>/dev/null || true; \
rm ${RM_I} "${DESTDIR}/$${file}" <&3; \
fi; \
for ext in debug symbols; do \
if ! [ -e "${DESTDIR}/$${file}" ] && [ -f \
"${DESTDIR}${DEBUGDIR}/$${file}.$${ext}" ]; then \
rm ${RM_I} "${DESTDIR}${DEBUGDIR}/$${file}.$${ext}" \
<&3; \
fi; \
done; \
done
@echo ">>> Old libraries removed"
check-old-libs:
@echo ">>> Checking for old libraries"
@${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
@cd ${.CURDIR}; \
${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
-V OLD_LIBS | xargs -n1 | \
while read file; do \
if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \
echo "${DESTDIR}/$${file}"; \
fi; \
for ext in debug symbols; do \
if [ -f "${DESTDIR}${DEBUGDIR}/$${file}.$${ext}" ]; then \
echo "${DESTDIR}${DEBUGDIR}/$${file}.$${ext}"; \
fi; \
done; \
done
delete-old-dirs:
@echo ">>> Removing old directories"
@${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
@cd ${.CURDIR}; \
${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
-V OLD_DIRS | xargs -n1 | sort -r | \
while read dir; do \
if [ -d "${DESTDIR}/$${dir}" ]; then \
@ -1750,7 +1810,8 @@ delete-old-dirs:
check-old-dirs:
@echo ">>> Checking for old directories"
@${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
@cd ${.CURDIR}; \
${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
-V OLD_DIRS | xargs -n1 | \
while read dir; do \
if [ -d "${DESTDIR}/$${dir}" ]; then \
@ -1830,7 +1891,7 @@ NOFUN=-DNO_FSCHG -DWITHOUT_HTML -DWITHOUT_INFO -DNO_LINT \
CPUTYPE=${XDEV_CPUTYPE}
XDDIR=${XDEV_ARCH}-freebsd
XDTP=/usr/${XDDIR}
XDTP=usr/${XDDIR}
CDBENV=MAKEOBJDIRPREFIX=${MAKEOBJDIRPREFIX}/${XDDIR} \
INSTALL="sh ${.CURDIR}/tools/install.sh"
CDENV= ${CDBENV} \
@ -1843,8 +1904,8 @@ CD2ENV=${CDENV} CC="${CC} ${CD2CFLAGS}" \
CDTMP= ${MAKEOBJDIRPREFIX}/${XDDIR}/${.CURDIR}/tmp
CDMAKE=${CDENV} PATH=${CDTMP}/usr/bin:${PATH} ${MAKE} ${NOFUN}
CD2MAKE=${CD2ENV} PATH=${CDTMP}/usr/bin:${XDTP}/usr/bin:${PATH} ${MAKE} ${NOFUN}
XDDESTDIR=${DESTDIR}${XDTP}
CD2MAKE=${CD2ENV} PATH=${CDTMP}/usr/bin:${XDDESTDIR}/usr/bin:${PATH} ${MAKE} ${NOFUN}
XDDESTDIR=${DESTDIR}/${XDTP}
.if !defined(OSREL)
OSREL!= uname -r | sed -e 's/[-(].*//'
.endif
@ -1924,6 +1985,7 @@ _xi-libraries:
_xi-links:
${_+_}cd ${XDDESTDIR}/usr/bin; \
mkdir -p ../../../../usr/bin; \
for i in *; do \
ln -sf ../../${XDTP}/usr/bin/$$i \
../../../../usr/bin/${XDDIR}-$$i; \

View File

@ -38,12 +38,104 @@
# xargs -n1 | sort | uniq -d;
# done
# 20131202: libcapsicum and libcasper moved to /lib/
OLD_LIBS+=usr/lib/libcapsicum.so.0
OLD_LIBS+=usr/lib/libcasper.so.0
# 20131109: extattr(2) mlinks fixed
OLD_FILES+=usr/share/man/man2/extattr_delete_list.2.gz
OLD_FILES+=usr/share/man/man2/extattr_get_list.2.gz
# 20131107: example files removed
OLD_FILES+=usr/share/examples/libusb20/aux.c
OLD_FILES+=usr/share/examples/libusb20/aux.h
# 20131105: tzdata 2013h import
OLD_FILES+=usr/share/zoneinfo/America/Shiprock
OLD_FILES+=usr/share/zoneinfo/Antarctica/South_Pole
# 20131103: WITH_LIBICONV_COMPAT removal
OLD_FILES+=usr/include/_libiconv_compat.h
OLD_FILES+=usr/lib/libiconv.a
OLD_FILES+=usr/lib/libiconv.so
OLD_FILES+=usr/lib/libiconv.so.3
OLD_FILES+=usr/lib/libiconv_p.a
OLD_FILES+=usr/lib32/libiconv.a
OLD_FILES+=usr/lib32/libiconv.so
OLD_FILES+=usr/lib32/libiconv.so.3
OLD_FILES+=usr/lib32/libiconv_p.a
# 20131103: removal of utxrm(8), use 'utx rm' instead.
OLD_FILES+=usr/sbin/utxrm
OLD_FILES+=usr/share/man/man8/utxrm.8.gz
# 20131031: pkg_install has been removed
OLD_FILES+=etc/periodic/daily/220.backup-pkgdb
OLD_FILES+=etc/periodic/daily/490.status-pkg-changes
OLD_FILES+=etc/periodic/security/460.chkportsum
OLD_FILES+=etc/periodic/weekly/400.status-pkg
OLD_FILES+=usr/sbin/pkg_add
OLD_FILES+=usr/sbin/pkg_create
OLD_FILES+=usr/sbin/pkg_delete
OLD_FILES+=usr/sbin/pkg_info
OLD_FILES+=usr/sbin/pkg_updating
OLD_FILES+=usr/sbin/pkg_version
OLD_FILES+=usr/share/man/man1/pkg_add.1.gz
OLD_FILES+=usr/share/man/man1/pkg_create.1.gz
OLD_FILES+=usr/share/man/man1/pkg_delete.1.gz
OLD_FILES+=usr/share/man/man1/pkg_info.1.gz
OLD_FILES+=usr/share/man/man1/pkg_updating.1.gz
OLD_FILES+=usr/share/man/man1/pkg_version.1.gz
# 20131030: /etc/keys moved to /usr/share/keys
OLD_DIRS+=etc/keys
OLD_DIRS+=etc/keys/pkg
OLD_DIRS+=etc/keys/pkg/revoked
OLD_DIRS+=etc/keys/pkg/trusted
OLD_FILES+=etc/keys/pkg/trusted/pkg.freebsd.org.2013102301
# 20131028: ng_fec(4) removed
OLD_FILES+=usr/include/netgraph/ng_fec.h
OLD_FILES+=usr/share/man/man4/ng_fec.4.gz
# 20131027: header moved
OLD_FILES+=usr/include/net/pf_mtag.h
# 20131023: remove never used iscsi directory
OLD_DIRS+=usr/share/examples/iscsi
# 20131021: isf(4) removed
OLD_FILES+=usr/sbin/isfctl
OLD_FILES+=usr/share/man/man4/isf.4.gz
OLD_FILES+=usr/share/man/man8/isfctl.8.gz
# 20131014: libbsdyml becomes private
OLD_FILES+=usr/lib/libbsdyml.a
OLD_FILES+=usr/lib/libbsdyml.so
OLD_LIBS+=usr/lib/libbsdyml.so.0
OLD_FILES+=usr/lib/libbsdyml_p.a
OLD_FILES+=usr/lib32/libbsdyml.a
OLD_FILES+=usr/lib32/libbsdyml.so
OLD_LIBS+=usr/lib32/libbsdyml.so.0
OLD_FILES+=usr/lib32/libbsdyml_p.a
OLD_FILES+=usr/share/man/man3/libbsdyml.3.gz
OLD_FILES+=usr/include/bsdyml.h
# 20131013: Removal of the ATF tools
OLD_FILES+=etc/atf/FreeBSD.conf
OLD_FILES+=etc/atf/atf-run.hooks
OLD_FILES+=etc/atf/common.conf
OLD_FILES+=usr/bin/atf-config
OLD_FILES+=usr/bin/atf-report
OLD_FILES+=usr/bin/atf-run
OLD_FILES+=usr/bin/atf-version
OLD_FILES+=usr/share/atf/atf-run.hooks
OLD_FILES+=usr/share/examples/atf/atf-run.hooks
OLD_FILES+=usr/share/examples/atf/tests-results.css
OLD_FILES+=usr/share/man/man1/atf-config.1.gz
OLD_FILES+=usr/share/man/man1/atf-report.1.gz
OLD_FILES+=usr/share/man/man1/atf-run.1.gz
OLD_FILES+=usr/share/man/man1/atf-version.1.gz
OLD_FILES+=usr/share/man/man5/atf-formats.5.gz
OLD_FILES+=usr/share/man/man7/atf.7.gz
OLD_FILES+=usr/share/xml/atf/tests-results.dtd
OLD_FILES+=usr/share/xsl/atf/tests-results.xsl
# 20131009: freebsd-version moved from /libexec to /bin
OLD_FILES+=libexec/freebsd-version
# 20131001: ar and ranlib from binutils not used
OLD_FILES+=usr/bin/gnu-ar
OLD_FILES+=usr/bin/gnu-ranlib
OLD_FILES+=usr/share/man/man1/gnu-ar.1.gz
OLD_FILES+=usr/share/man/man1/gnu-ranlib.1.gz
# 20130930: BIND removed from base
OLD_FILES+=etc/mtree/BIND.chroot.dist
OLD_FILES+=etc/namedb
OLD_FILES+=etc/periodic/daily/470.status-named
OLD_FILES+=usr/bin/dig
@ -65,7 +157,7 @@ OLD_FILES+=usr/include/lwres/result.h
OLD_FILES+=usr/include/lwres/version.h
OLD_FILES+=usr/lib/liblwres.a
OLD_FILES+=usr/lib/liblwres.so
OLD_LIBS+=usr/lib/liblwres.so.50
OLD_LIBS+=usr/lib/liblwres.so.90
OLD_FILES+=usr/lib/liblwres_p.a
OLD_FILES+=usr/sbin/arpaname
OLD_FILES+=usr/sbin/ddns-confgen
@ -75,6 +167,7 @@ OLD_FILES+=usr/sbin/dnssec-keygen
OLD_FILES+=usr/sbin/dnssec-revoke
OLD_FILES+=usr/sbin/dnssec-settime
OLD_FILES+=usr/sbin/dnssec-signzone
OLD_FILES+=usr/sbin/dnssec-verify
OLD_FILES+=usr/sbin/genrandom
OLD_FILES+=usr/sbin/isc-hmac-fixup
OLD_FILES+=usr/sbin/lwresd
@ -238,6 +331,7 @@ OLD_FILES+=usr/share/man/man8/dnssec-keygen.8.gz
OLD_FILES+=usr/share/man/man8/dnssec-revoke.8.gz
OLD_FILES+=usr/share/man/man8/dnssec-settime.8.gz
OLD_FILES+=usr/share/man/man8/dnssec-signzone.8.gz
OLD_FILES+=usr/share/man/man8/dnssec-verify.8.gz
OLD_FILES+=usr/share/man/man8/genrandom.8.gz
OLD_FILES+=usr/share/man/man8/isc-hmac-fixup.8.gz
OLD_FILES+=usr/share/man/man8/lwresd.8.gz
@ -272,6 +366,8 @@ OLD_DIRS+=var/named/var/run
OLD_DIRS+=var/named/var/run/named
OLD_DIRS+=var/named/var/stats
OLD_DIRS+=var/run/named
# 20130923: example moved
OLD_FILES+=usr/share/examples/bsdconfig/browse_packages.sh
# 20130908: libssh becomes private
OLD_FILES+=usr/lib/libssh.a
OLD_FILES+=usr/lib/libssh.so
@ -2455,6 +2551,7 @@ OLD_FILES+=usr/sbin/zfs
OLD_FILES+=usr/sbin/zpool
# 20070423: rc.bluetooth (examples) removed
OLD_FILES+=usr/share/examples/netgraph/bluetooth/rc.bluetooth
OLD_DIRS+=usr/share/examples/netgraph/bluetooth
# 20070421: worm.4 removed
OLD_FILES+=usr/share/man/man4/worm.4.gz
# 20070417: trunk(4) renamed to lagg(4)
@ -6091,6 +6188,13 @@ OLD_LIBS+=usr/lib/libkse.so.1
OLD_LIBS+=usr/lib/liblwres.so.3
OLD_LIBS+=usr/lib/pam_ftp.so.2
# 20131013: Removal of the ATF tools
OLD_DIRS+=etc/atf
OLD_DIRS+=usr/share/examples/atf
OLD_DIRS+=usr/share/xml/atf
OLD_DIRS+=usr/share/xml
OLD_DIRS+=usr/share/xsl/atf
OLD_DIRS+=usr/share/xsl
# 20040925: bind9 import
OLD_DIRS+=usr/share/doc/bind/html
OLD_DIRS+=usr/share/doc/bind/misc

View File

@ -16,8 +16,8 @@ from older versions of FreeBSD, try WITHOUT_CLANG to bootstrap to the tip of
head, and then rebuild without this option. The bootstrap process from
older version of current is a bit fragile.
NOTE TO PEOPLE WHO THINK THAT FreeBSD 10.x IS SLOW:
FreeBSD 10.x has many debugging features turned on, in both the kernel
NOTE TO PEOPLE WHO THINK THAT FreeBSD 11.x IS SLOW:
FreeBSD 11.x has many debugging features turned on, in both the kernel
and userland. These features attempt to detect incorrect use of
system primitives, and encourage loud failure through extra sanity
checking and fail stop semantics. They also substantially impact
@ -31,11 +31,57 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 10.x IS SLOW:
disable the most expensive debugging functionality run
"ln -s 'abort:false,junk:false' /etc/malloc.conf".)
20131108:
The WITHOUT_ATF build knob has been removed and its functionality
has been subsumed into the more generic WITHOUT_TESTS. If you were
using the former to disable the build of the ATF libraries, you
should change your settings to use the latter.
20131025:
The default version of mtree is nmtree which is obtained from
NetBSD. The output is generally the same, but may vary
slightly. If you found you need identical output adding
"-F freebsd9" to the command line should do the trick. For the
time being, the old mtree is available as fmtree.
20131014:
libbsdyml has been renamed to libyaml and moved to /usr/lib/private.
This will break ports-mgmt/pkg. Rebuild the port, or upgrade to pkg
1.1.4_8 and verify bsdyml not linked in, before running "make
delete-old-libs":
# make -C /usr/ports/ports-mgmt/pkg build deinstall install clean
or
# pkg install pkg; ldd /usr/local/sbin/pkg | grep bsdyml
20131010:
The rc.d/jail script has been updated to support jail(8)
configuration file. The "jail_<jname>_*" rc.conf(5) variables
for per-jail configuration are automatically converted to
/var/run/jail.<jname>.conf before the jail(8) utility is invoked.
This is transparently backward compatible. See below about some
incompatibilities and rc.conf(5) manual page for more details.
These variables are now deprecated in favor of jail(8) configuration
file. One can use "rc.d/jail config <jname>" command to generate
a jail(8) configuration file in /var/run/jail.<jname>.conf without
running the jail(8) utility. The default pathname of the
configuration file is /etc/jail.conf and can be specified by
using $jail_conf or $jail_<jname>_conf variables.
Please note that jail_devfs_ruleset accepts an integer at
this moment. Please consider to rewrite the ruleset name
with an integer.
20130930:
BIND has been removed from the base system. If all you need
is a local resolver, simply enable and start the local_unbound
service instead. Otherwise, several versions of BIND are
available in the ports tree.
available in the ports tree. The dns/bind99 port is one example.
With this change, nslookup(1) and dig(1) are no longer in the base
system. Users should instead use host(1) and drill(1) which are
in the base system. Alternatively, nslookup and dig can
be obtained by installing the dns/bind-tools port.
20130916:
With the addition of unbound(8), a new unbound user is now
@ -73,19 +119,6 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 10.x IS SLOW:
has been updated to use this support. A new gcc is required to build
the aesni module on both i386 and amd64.
20130827:
Thomas Dickey (vendor author thereof) reports that dialog(1) since
2011/10/18 has a bug in handling --hline. Testers and I noticed the
--hline is not ignored but displayed as a NULL string, regardless of
value. This will cause confusion in some bsdconfig dialogs where the
--hline is used to inform users which keybindings to use. This will
likewise affect any other persons relying on --hline. It also looks
rather strange seeing "[]" at the bottom of dialog(1) widgets when
passing --hline "anything". Thomas said he will have a look in a few
weeks. NOTE: The "[]" brackets appear with the left-edge where it
would normally appear given the width of text to display, but the
displayed text is not there (part of the bug).
20130821:
The PADLOCK_RNG and RDRAND_RNG kernel options are now devices.
Thus "device padlock_rng" and "device rdrand_rng" should be

View File

@ -15,6 +15,7 @@ SUBDIR= cat \
echo \
ed \
expr \
freebsd-version \
getfacl \
hostname \
kenv \

View File

@ -198,7 +198,7 @@ If the value is outside, it will be set to the appropriate limit.
.Xr mount 8 ,
.Xr pstat 8 ,
.Xr quot 8 ,
.Xr swapinfo 8 .
.Xr swapinfo 8
.Sh STANDARDS
With the exception of most options,
the

View File

@ -0,0 +1,20 @@
# $FreeBSD$
SCRIPTS = freebsd-version
MAN = freebsd-version.1
CLEANFILES = freebsd-version.sh
NEWVERS = ${.CURDIR}/../../sys/conf/newvers.sh
freebsd-version.sh.in: ${NEWVERS}
freebsd-version.sh: ${.CURDIR}/freebsd-version.sh.in
eval $$(egrep '^(TYPE|REVISION|BRANCH)=' ${NEWVERS}) ; \
if ! sed -e "\
s/@@TYPE@@/$${TYPE}/g; \
s/@@REVISION@@/$${REVISION}/g; \
s/@@BRANCH@@/$${BRANCH}/g; \
" ${.ALLSRC} >${.TARGET} ; then \
rm -f ${.TARGET} ; \
exit 1 ; \
fi
.include <bsd.prog.mk>

View File

@ -0,0 +1,124 @@
.\"-
.\" Copyright (c) 2013 Dag-Erling Smørgrav
.\" 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 October 5, 2013
.Dt FREEBSD-VERSION 1
.Os
.Sh NAME
.Nm freebsd-version
.Nd print the version and patch level of the installed system
.Sh SYNOPSIS
.Nm
.Op Fl ku
.Sh DESCRIPTION
The
.Nm
utility makes a best effort to determine the version and patch level
of the installed kernel and / or userland.
.Pp
The following options are available:
.Bl -tag -width Fl
.It Fl k
Print the version and patch level of the installed kernel.
Unlike
.Xr uname 1 ,
if a new kernel has been installed but the system has not yet
rebooted,
.Nm
will print the version and patch level of the new kernel.
.It Fl u
Print the version and patch level of the installed userland.
These are hardcoded into
.Nm
during the build.
.El
.Pp
If both
.Fl k
and
.Fl u
are specified,
.Nm
will print the kernel version first, then the userland version, on
separate lines.
If neither is specified, it will print the userland version only.
.Sh IMPLEMENTATION NOTES
The
.Nm
utility should provide the correct answer in the vast majority of
cases, including on systems kept up-to-date using
.Xr freebsd-update 8 ,
which does not update the kernel version unless the kernel itself was
affected by the latest patch.
.Pp
To determine the name (and hence the location) of a custom kernel, the
.Nm
utility will attempt to parse
.Pa /boot/defaults/loader.conf
and
.Pa /boot/loader.conf ,
looking for definitions of the
.Va kernel
and
.Va bootfile
variables, both with a default value of
.Dq kernel .
It may however fail to locate the correct kernel if either or both of
these variables are defined in a non-standard location, such as in
.Pa /boot/loader.rc .
.Sh ENVIRONMENT
.Bl -tag -width ROOT
.It Ev ROOT
Path to the root of the filesystem in which to look for
.Pa loader.conf
and the kernel.
.El
.Sh EXAMPLES
To determine the version of the currently running userland:
.Bd -literal -offset indent
/bin/freebsd-version -u
.Ed
.Pp
To inspect a system being repaired using a live CD:
.Bd -literal -offset indent
mount -rt ufs /dev/ada0p2 /mnt
env ROOT=/mnt /mnt/bin/freebsd-version -ku
.Ed
.Sh SEE ALSO
.Xr uname 1 ,
.Xr loader.conf 5 ,
.Xr freebsd-version 8
.Sh HISTORY
The
.Nm
command appeared in
.Fx 10.0 .
.Sh AUTHORS
The
.Nm
utility and this manual page were written by
.An Dag-Erling Sm\(/orgrav Aq des@FreeBSD.org .

View File

@ -0,0 +1,126 @@
#!/bin/sh
#-
# Copyright (c) 2013 Dag-Erling Smørgrav
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
# $FreeBSD$
#
set -e
USERLAND_VERSION="@@REVISION@@-@@BRANCH@@"
: ${ROOT:=}
: ${LOADER_DIR:=$ROOT/boot}
: ${LOADER_CONF_FILES:=$LOADER_DIR/defaults/loader.conf $LOADER_DIR/loader.conf $LOADER_DIR/loader.conf.local}
LOADER_RE1='^\([A-Z_a-z][0-9A-Z_a-z]*=[-./0-9A-Z_a-z]\{1,\}\).*$'
LOADER_RE2='^\([A-Z_a-z][0-9A-Z_a-z]*="[-./0-9A-Z_a-z]\{1,\}"\).*$'
KERNEL_RE='^@(#)@@TYPE@@ \([-.0-9A-Za-z]\{1,\}\) .*$'
progname=$(basename $0)
#
# Print an error message and exit.
#
error() {
echo "$progname: $*" >&2
exit 1
}
#
# Try to get the name of the installed kernel from loader.conf and
# return the full path. If loader.conf does not exist or we could not
# read it, return the path to the default kernel.
#
kernel_file() {
eval $(sed -n "s/$LOADER_RE1/\\1;/p; s/$LOADER_RE2/\\1;/p" \
$LOADER_CONF_FILES 2>/dev/null)
echo "$LOADER_DIR/${kernel:-kernel}/${bootfile:-kernel}"
}
#
# Extract the kernel version from the installed kernel.
#
kernel_version() {
kernfile=$(kernel_file)
if [ ! -f "$kernfile" -o ! -r "$kernfile" ] ; then
error "unable to locate kernel"
fi
strings "$kernfile" | sed -n "s/$KERNEL_RE/\\1/p"
}
#
# Print the hardcoded userland version.
#
userland_version() {
echo $USERLAND_VERSION
}
#
# Print a usage string and exit.
#
usage() {
echo "usage: $progname [-ku]" >&2
exit 1
}
#
# Main program.
#
main() {
# parse command-line arguments
while getopts "ku" option ; do
case $option in
k)
opt_k=1
;;
u)
opt_u=1
;;
*)
usage
;;
esac
done
if [ $OPTIND -le $# ] ; then
usage
fi
# default is -u
if [ $((opt_k + opt_u)) -eq 0 ] ; then
opt_u=1
fi
# print kernel version
if [ $opt_k ] ; then
kernel_version
fi
# print userland version
if [ $opt_u ] ; then
userland_version
fi
}
main "$@"

View File

@ -318,7 +318,10 @@ main(int argc, char **argv)
* Use KERN_PROC_PROC instead of KERN_PROC_ALL, since we
* just want processes and not individual kernel threads.
*/
plist = kvm_getprocs(kd, KERN_PROC_PROC, 0, &nproc);
if (pidfromfile >= 0)
plist = kvm_getprocs(kd, KERN_PROC_PID, pidfromfile, &nproc);
else
plist = kvm_getprocs(kd, KERN_PROC_PROC, 0, &nproc);
if (plist == NULL) {
errx(STATUS_ERROR, "Cannot get process list (%s)",
kvm_geterr(kd));

View File

@ -797,8 +797,6 @@ char *
emulname(KINFO *k, VARENT *ve __unused)
{
if (k->ki_p->ki_emul == NULL)
return (NULL);
return (strdup(k->ki_p->ki_emul));
}
@ -827,7 +825,6 @@ out:
char *
loginclass(KINFO *k, VARENT *ve __unused)
{
char *s;
/*
* Don't display login class for system processes;
@ -837,8 +834,5 @@ loginclass(KINFO *k, VARENT *ve __unused)
if (k->ki_p->ki_flag & P_SYSTEM) {
return (strdup("-"));
}
s = k->ki_p->ki_loginclass;
if (s == NULL)
return (NULL);
return (strdup(s));
return (strdup(k->ki_p->ki_loginclass));
}

View File

@ -182,6 +182,7 @@ cdlogical(char *dest)
struct stat statb;
int first;
int badstat;
size_t len;
/*
* Check each component of the path. If we find a symlink or
@ -189,8 +190,9 @@ cdlogical(char *dest)
* next time we get the value of the current directory.
*/
badstat = 0;
cdcomppath = stalloc(strlen(dest) + 1);
scopy(dest, cdcomppath);
len = strlen(dest);
cdcomppath = stalloc(len + 1);
memcpy(cdcomppath, dest, len + 1);
STARTSTACKSTR(p);
if (*dest == '/') {
STPUTC('/', p);
@ -275,6 +277,7 @@ findcwd(char *dir)
{
char *new;
char *p;
size_t len;
/*
* If our argument is NULL, we don't know the current directory
@ -283,8 +286,9 @@ findcwd(char *dir)
*/
if (dir == NULL || curdir == NULL)
return getpwd2();
cdcomppath = stalloc(strlen(dir) + 1);
scopy(dir, cdcomppath);
len = strlen(dir);
cdcomppath = stalloc(len + 1);
memcpy(cdcomppath, dir, len + 1);
STARTSTACKSTR(new);
if (*dir != '/') {
STPUTS(curdir, new);

View File

@ -750,6 +750,45 @@ isdeclarationcmd(struct narg *arg)
(have_command || !isfunc("local"))));
}
static void
xtracecommand(struct arglist *varlist, struct arglist *arglist)
{
struct strlist *sp;
char sep = 0;
const char *p, *ps4;
ps4 = expandstr(ps4val());
out2str(ps4 != NULL ? ps4 : ps4val());
for (sp = varlist->list ; sp ; sp = sp->next) {
if (sep != 0)
out2c(' ');
p = strchr(sp->text, '=');
if (p != NULL) {
p++;
outbin(sp->text, p - sp->text, out2);
out2qstr(p);
} else
out2qstr(sp->text);
sep = ' ';
}
for (sp = arglist->list ; sp ; sp = sp->next) {
if (sep != 0)
out2c(' ');
/* Disambiguate command looking like assignment. */
if (sp == arglist->list &&
strchr(sp->text, '=') != NULL &&
strchr(sp->text, '\'') == NULL) {
out2c('\'');
out2str(sp->text);
out2c('\'');
} else
out2qstr(sp->text);
sep = ' ';
}
out2c('\n');
flushout(&errout);
}
/*
* Check if a builtin can safely be executed in the same process,
* even though it should be in a subshell (command substitution).
@ -847,40 +886,8 @@ evalcommand(union node *cmd, int flags, struct backcmd *backcmd)
argv -= argc;
/* Print the command if xflag is set. */
if (xflag) {
char sep = 0;
const char *p, *ps4;
ps4 = expandstr(ps4val());
out2str(ps4 != NULL ? ps4 : ps4val());
for (sp = varlist.list ; sp ; sp = sp->next) {
if (sep != 0)
out2c(' ');
p = strchr(sp->text, '=');
if (p != NULL) {
p++;
outbin(sp->text, p - sp->text, out2);
out2qstr(p);
} else
out2qstr(sp->text);
sep = ' ';
}
for (sp = arglist.list ; sp ; sp = sp->next) {
if (sep != 0)
out2c(' ');
/* Disambiguate command looking like assignment. */
if (sp == arglist.list &&
strchr(sp->text, '=') != NULL &&
strchr(sp->text, '\'') == NULL) {
out2c('\'');
out2str(sp->text);
out2c('\'');
} else
out2qstr(sp->text);
sep = ' ';
}
out2c('\n');
flushout(&errout);
}
if (xflag)
xtracecommand(&varlist, &arglist);
/* Now locate the command. */
if (argc == 0) {

View File

@ -187,14 +187,15 @@ padvance(const char **path, const char *name)
{
const char *p, *start;
char *q;
size_t len;
size_t len, namelen;
if (*path == NULL)
return NULL;
start = *path;
for (p = start; *p && *p != ':' && *p != '%'; p++)
; /* nothing */
len = p - start + strlen(name) + 2; /* "2" is for '/' and '\0' */
namelen = strlen(name);
len = p - start + namelen + 2; /* "2" is for '/' and '\0' */
STARTSTACKSTR(q);
CHECKSTRSPACE(len, q);
if (p != start) {
@ -202,7 +203,7 @@ padvance(const char **path, const char *name)
q += p - start;
*q++ = '/';
}
strcpy(q, name);
memcpy(q, name, namelen + 1);
pathopt = NULL;
if (*p == '%') {
pathopt = ++p;
@ -527,6 +528,7 @@ cmdlookup(const char *name, int add)
const char *p;
struct tblentry *cmdp;
struct tblentry **pp;
size_t len;
p = name;
hashval = *p << 4;
@ -541,11 +543,11 @@ cmdlookup(const char *name, int add)
}
if (add && cmdp == NULL) {
INTOFF;
cmdp = *pp = ckmalloc(sizeof (struct tblentry)
+ strlen(name) + 1);
len = strlen(name);
cmdp = *pp = ckmalloc(sizeof (struct tblentry) + len + 1);
cmdp->next = NULL;
cmdp->cmdtype = CMDUNKNOWN;
strcpy(cmdp->cmdname, name);
memcpy(cmdp->cmdname, name, len + 1);
INTON;
}
lastcmdentry = pp;
@ -672,9 +674,11 @@ typecmd_impl(int argc, char **argv, int cmd, const char *path)
/* Then look at the aliases */
if ((ap = lookupalias(argv[i], 1)) != NULL) {
if (cmd == TYPECMD_SMALLV)
out1fmt("alias %s='%s'\n", argv[i], ap->val);
else
if (cmd == TYPECMD_SMALLV) {
out1fmt("alias %s=", argv[i]);
out1qstr(ap->val);
outcslow('\n', out1);
} else
out1fmt("%s is an alias for %s\n", argv[i],
ap->val);
continue;

View File

@ -1307,9 +1307,11 @@ addfname(char *name)
{
char *p;
struct strlist *sp;
size_t len;
p = stalloc(strlen(name) + 1);
scopy(name, p);
len = strlen(name);
p = stalloc(len + 1);
memcpy(p, name, len + 1);
sp = (struct strlist *)stalloc(sizeof *sp);
sp->text = p;
*exparg.lastp = sp;

View File

@ -978,7 +978,6 @@ int
waitforjob(struct job *jp, int *origstatus)
{
#if JOBS
pid_t mypgrp = getpgrp();
int propagate_int = jp->jobctl && jp->foreground;
#endif
int status;
@ -992,7 +991,7 @@ waitforjob(struct job *jp, int *origstatus)
dotrap();
#if JOBS
if (jp->jobctl) {
if (tcsetpgrp(ttyfd, mypgrp) < 0)
if (tcsetpgrp(ttyfd, rootpid) < 0)
error("tcsetpgrp failed, errno=%d\n", errno);
}
if (jp->state == JOBSTOPPED)

View File

@ -98,9 +98,11 @@ char *
savestr(const char *s)
{
char *p;
size_t len;
p = ckmalloc(strlen(s) + 1);
scopy(s, p);
len = strlen(s);
p = ckmalloc(len + 1);
memcpy(p, s, len + 1);
return p;
}

View File

@ -404,6 +404,9 @@ static const struct limits limits[] = {
#endif
#ifdef RLIMIT_NPTS
{ "pseudo-terminals", (char *)0, RLIMIT_NPTS, 1, 'p' },
#endif
#ifdef RLIMIT_KQUEUES
{ "kqueues", (char *)0, RLIMIT_KQUEUES, 1, 'k' },
#endif
{ (char *) 0, (char *)0, 0, 0, '\0' }
};
@ -421,7 +424,7 @@ ulimitcmd(int argc __unused, char **argv __unused)
struct rlimit limit;
what = 'f';
while ((optc = nextopt("HSatfdsmcnuvlbpw")) != '\0')
while ((optc = nextopt("HSatfdsmcnuvlbpwk")) != '\0')
switch (optc) {
case 'H':
how = HARD;

View File

@ -42,7 +42,6 @@ __FBSDID("$FreeBSD$");
* String functions.
*
* equal(s1, s2) Return true if strings are equal.
* scopy(from, to) Copy a string.
* number(s) Convert a string of digits to an integer.
* is_number(s) Return true if s is a string of digits.
*/
@ -60,10 +59,6 @@ char nullstr[1]; /* zero length string */
* equal - #defined in mystring.h
*/
/*
* scopy - #defined in mystring.h
*/
/*
* prefix -- see if pfx is a prefix of string.

View File

@ -40,4 +40,3 @@ int number(const char *);
int is_number(const char *);
#define equal(s1, s2) (strcmp(s1, s2) == 0)
#define scopy(s1, s2) ((void)strcpy(s2, s1))

View File

@ -118,16 +118,16 @@ NFROMTO nfile # fd<> fname
NAPPEND nfile # fd>> fname
NCLOBBER nfile # fd>| fname
type int
next nodeptr # next redirection in list
fd int # file descriptor being redirected
next nodeptr # next redirection in list
fname nodeptr # file name, in a NARG node
expfname temp char *expfname # actual file name
NTOFD ndup # fd<&dupfd
NFROMFD ndup # fd>&dupfd
type int
next nodeptr # next redirection in list
fd int # file descriptor being redirected
next nodeptr # next redirection in list
dupfd int # file descriptor to duplicate
vname nodeptr # file name if fd>&$var
@ -135,8 +135,8 @@ NFROMFD ndup # fd>&dupfd
NHERE nhere # fd<<\!
NXHERE nhere # fd<<!
type int
next nodeptr # next redirection in list
fd int # file descriptor being redirected
next nodeptr # next redirection in list
doc nodeptr # input to command (NARG node)
expdoc temp char *expdoc # actual document (for NXHERE)

View File

@ -69,6 +69,7 @@ __FBSDID("$FreeBSD$");
struct redirtab {
struct redirtab *next;
int renamed[10];
int fd0_redirected;
};
@ -109,11 +110,14 @@ redirect(union node *redir, int flags)
sv = ckmalloc(sizeof (struct redirtab));
for (i = 0 ; i < 10 ; i++)
sv->renamed[i] = EMPTY;
sv->fd0_redirected = fd0_redirected;
sv->next = redirlist;
redirlist = sv;
}
for (n = redir ; n ; n = n->nfile.next) {
fd = n->nfile.fd;
if (fd == 0)
fd0_redirected = 1;
if ((n->nfile.type == NTOFD || n->nfile.type == NFROMFD) &&
n->ndup.dupfd == fd)
continue; /* redirect from/to same file descriptor */
@ -134,8 +138,6 @@ redirect(union node *redir, int flags)
sv->renamed[fd] = i;
INTON;
}
if (fd == 0)
fd0_redirected++;
openredirect(n, memory);
}
if (memory[1])
@ -303,8 +305,6 @@ popredir(void)
for (i = 0 ; i < 10 ; i++) {
if (rp->renamed[i] != EMPTY) {
if (i == 0)
fd0_redirected--;
if (rp->renamed[i] >= 0) {
dup2(rp->renamed[i], i);
close(rp->renamed[i]);
@ -314,6 +314,7 @@ popredir(void)
}
}
INTOFF;
fd0_redirected = rp->fd0_redirected;
redirlist = rp->next;
ckfree(rp);
INTON;

View File

@ -32,7 +32,7 @@
.\" from: @(#)sh.1 8.6 (Berkeley) 5/4/95
.\" $FreeBSD$
.\"
.Dd June 14, 2013
.Dd November 1, 2013
.Dt SH 1
.Os
.Sh NAME
@ -2551,7 +2551,7 @@ and not found.
For aliases the alias expansion is printed;
for commands and tracked aliases
the complete pathname of the command is printed.
.It Ic ulimit Oo Fl HSabcdflmnpstuvw Oc Op Ar limit
.It Ic ulimit Oo Fl HSabcdfklmnpstuvw Oc Op Ar limit
Set or display resource limits (see
.Xr getrlimit 2 ) .
If
@ -2598,6 +2598,11 @@ The maximal size of core dump files, in 512-byte blocks.
The maximal size of the data segment of a process, in kilobytes.
.It Fl f Ar filesize
The maximal size of a file, in 512-byte blocks.
.It Fl k Ar kqueues
The maximal number of kqueues
(see
.Xr kqueue 2 )
for this user ID.
.It Fl l Ar lockedmem
The maximal size of memory that can be locked by a process, in
kilobytes.

View File

@ -390,11 +390,11 @@ opentrace(void)
else
p = "/tmp";
}
scopy(p, s);
strcpy(s, p);
strcat(s, "/trace");
}
#else
scopy("./trace", s);
strcpy(s, "./trace");
#endif /* not_this_way */
if ((tracefile = fopen(s, "a")) == NULL) {
fprintf(stderr, "Can't open %s: %s\n", s, strerror(errno));

View File

@ -362,10 +362,12 @@ void
ignoresig(int signo)
{
if (sigmode[signo] == 0)
setsignal(signo);
if (sigmode[signo] != S_IGN && sigmode[signo] != S_HARD_IGN) {
signal(signo, SIG_IGN);
sigmode[signo] = S_IGN;
}
sigmode[signo] = S_HARD_IGN;
}

View File

@ -224,8 +224,9 @@ void
setvar(const char *name, const char *val, int flags)
{
const char *p;
int len;
int namelen;
size_t len;
size_t namelen;
size_t vallen;
char *nameeq;
int isbad;
@ -244,18 +245,20 @@ setvar(const char *name, const char *val, int flags)
}
namelen = p - name;
if (isbad)
error("%.*s: bad variable name", namelen, name);
error("%.*s: bad variable name", (int)namelen, name);
len = namelen + 2; /* 2 is space for '=' and '\0' */
if (val == NULL) {
flags |= VUNSET;
vallen = 0;
} else {
len += strlen(val);
vallen = strlen(val);
len += vallen;
}
nameeq = ckmalloc(len);
memcpy(nameeq, name, namelen);
nameeq[namelen] = '=';
if (val)
scopy(val, nameeq + namelen + 1);
memcpy(nameeq + namelen + 1, val, vallen + 1);
else
nameeq[namelen + 1] = '\0';
setvareq(nameeq, flags);

View File

@ -67,9 +67,18 @@ error(const char *msg, ...)
operand ::= <any legal UNIX file name>
*/
enum token_types {
UNOP = 0x100,
BINOP = 0x200,
BUNOP = 0x300,
BBINOP = 0x400,
PAREN = 0x500
};
enum token {
EOI,
FILRD,
OPERAND,
FILRD = UNOP + 1,
FILWR,
FILEX,
FILEXIST,
@ -85,13 +94,13 @@ enum token {
FILSUID,
FILSGID,
FILSTCK,
FILNT,
FILOT,
FILEQ,
FILUID,
FILGID,
STREZ,
STRNZ,
FILUID,
FILGID,
FILNT = BINOP + 1,
FILOT,
FILEQ,
STREQ,
STRNE,
STRLT,
@ -102,76 +111,68 @@ enum token {
INTGT,
INTLE,
INTLT,
UNOT,
BAND,
UNOT = BUNOP + 1,
BAND = BBINOP + 1,
BOR,
LPAREN,
RPAREN,
OPERAND
LPAREN = PAREN + 1,
RPAREN
};
enum token_types {
UNOP,
BINOP,
BUNOP,
BBINOP,
PAREN
};
#define TOKEN_TYPE(token) ((token) & 0xff00)
static struct t_op {
char op_text[4];
short op_num, op_type;
short op_num;
} const ops [] = {
{"-r", FILRD, UNOP},
{"-w", FILWR, UNOP},
{"-x", FILEX, UNOP},
{"-e", FILEXIST,UNOP},
{"-f", FILREG, UNOP},
{"-d", FILDIR, UNOP},
{"-c", FILCDEV,UNOP},
{"-b", FILBDEV,UNOP},
{"-p", FILFIFO,UNOP},
{"-u", FILSUID,UNOP},
{"-g", FILSGID,UNOP},
{"-k", FILSTCK,UNOP},
{"-s", FILGZ, UNOP},
{"-t", FILTT, UNOP},
{"-z", STREZ, UNOP},
{"-n", STRNZ, UNOP},
{"-h", FILSYM, UNOP}, /* for backwards compat */
{"-O", FILUID, UNOP},
{"-G", FILGID, UNOP},
{"-L", FILSYM, UNOP},
{"-S", FILSOCK,UNOP},
{"=", STREQ, BINOP},
{"==", STREQ, BINOP},
{"!=", STRNE, BINOP},
{"<", STRLT, BINOP},
{">", STRGT, BINOP},
{"-eq", INTEQ, BINOP},
{"-ne", INTNE, BINOP},
{"-ge", INTGE, BINOP},
{"-gt", INTGT, BINOP},
{"-le", INTLE, BINOP},
{"-lt", INTLT, BINOP},
{"-nt", FILNT, BINOP},
{"-ot", FILOT, BINOP},
{"-ef", FILEQ, BINOP},
{"!", UNOT, BUNOP},
{"-a", BAND, BBINOP},
{"-o", BOR, BBINOP},
{"(", LPAREN, PAREN},
{")", RPAREN, PAREN},
{"", 0, 0}
{"-r", FILRD},
{"-w", FILWR},
{"-x", FILEX},
{"-e", FILEXIST},
{"-f", FILREG},
{"-d", FILDIR},
{"-c", FILCDEV},
{"-b", FILBDEV},
{"-p", FILFIFO},
{"-u", FILSUID},
{"-g", FILSGID},
{"-k", FILSTCK},
{"-s", FILGZ},
{"-t", FILTT},
{"-z", STREZ},
{"-n", STRNZ},
{"-h", FILSYM}, /* for backwards compat */
{"-O", FILUID},
{"-G", FILGID},
{"-L", FILSYM},
{"-S", FILSOCK},
{"=", STREQ},
{"==", STREQ},
{"!=", STRNE},
{"<", STRLT},
{">", STRGT},
{"-eq", INTEQ},
{"-ne", INTNE},
{"-ge", INTGE},
{"-gt", INTGT},
{"-le", INTLE},
{"-lt", INTLT},
{"-nt", FILNT},
{"-ot", FILOT},
{"-ef", FILEQ},
{"!", UNOT},
{"-a", BAND},
{"-o", BOR},
{"(", LPAREN},
{")", RPAREN},
{"", 0}
};
static struct t_op const *t_wp_op;
static int nargc;
static char **t_wp;
static int parenlevel;
static int aexpr(enum token);
static int binop(void);
static int binop(enum token);
static int equalf(const char *, const char *);
static int filstat(char *, enum token);
static int getn(const char *);
@ -295,10 +296,10 @@ primary(enum token n)
parenlevel--;
return res;
}
if (t_wp_op && t_wp_op->op_type == UNOP) {
if (TOKEN_TYPE(n) == UNOP) {
/* unary expression */
if (--nargc == 0)
syntax(t_wp_op->op_text, "argument expected");
syntax(NULL, "argument expected"); /* impossible */
switch (n) {
case STREZ:
return strlen(*++t_wp) == 0;
@ -311,28 +312,25 @@ primary(enum token n)
}
}
if (t_lex(nargc > 0 ? t_wp[1] : NULL), t_wp_op && t_wp_op->op_type ==
BINOP) {
return binop();
}
nn = t_lex(nargc > 0 ? t_wp[1] : NULL);
if (TOKEN_TYPE(nn) == BINOP)
return binop(nn);
return strlen(*t_wp) > 0;
}
static int
binop(void)
binop(enum token n)
{
const char *opnd1, *opnd2;
struct t_op const *op;
const char *opnd1, *op, *opnd2;
opnd1 = *t_wp;
(void) t_lex(nargc > 0 ? (--nargc, *++t_wp) : NULL);
op = t_wp_op;
op = nargc > 0 ? (--nargc, *++t_wp) : NULL;
if ((opnd2 = nargc > 0 ? (--nargc, *++t_wp) : NULL) == NULL)
syntax(op->op_text, "argument expected");
syntax(op, "argument expected");
switch (op->op_num) {
switch (n) {
case STREQ:
return strcmp(opnd1, opnd2) == 0;
case STRNE:
@ -424,22 +422,20 @@ t_lex(char *s)
struct t_op const *op = ops;
if (s == 0) {
t_wp_op = NULL;
return EOI;
}
while (*op->op_text) {
if (strcmp(s, op->op_text) == 0) {
if (((op->op_type == UNOP || op->op_type == BUNOP)
if (((TOKEN_TYPE(op->op_num) == UNOP ||
TOKEN_TYPE(op->op_num) == BUNOP)
&& isunopoperand()) ||
(op->op_num == LPAREN && islparenoperand()) ||
(op->op_num == RPAREN && isrparenoperand()))
break;
t_wp_op = op;
return op->op_num;
}
op++;
}
t_wp_op = NULL;
return OPERAND;
}
@ -458,7 +454,7 @@ isunopoperand(void)
t = *(t_wp + 2);
while (*op->op_text) {
if (strcmp(s, op->op_text) == 0)
return op->op_type == BINOP &&
return TOKEN_TYPE(op->op_num) == BINOP &&
(parenlevel == 0 || t[0] != ')' || t[1] != '\0');
op++;
}
@ -480,7 +476,7 @@ islparenoperand(void)
return 0;
while (*op->op_text) {
if (strcmp(s, op->op_text) == 0)
return op->op_type == BINOP;
return TOKEN_TYPE(op->op_num) == BINOP;
op++;
}
return 0;

File diff suppressed because it is too large Load Diff

View File

@ -64,7 +64,7 @@ child=$!
# ksh doing work. (This actually goes one step further and assumes that we
# catch some non-static function in ksh.)
#
script | tee /dev/fd/2 | grep 'ksh`[a-zA-Z_]' > /dev/null
script | tee /dev/fd/2 | egrep 'ksh(93)?`[a-zA-Z_]' > /dev/null
status=$?
kill $child

View File

@ -62,7 +62,7 @@ child=$!
#
# The only thing we can be sure of here is that ksh is doing some work.
#
script | tee /dev/fd/2 | grep -w ksh > /dev/null
script | tee /dev/fd/2 | egrep -w 'ksh(93)?' > /dev/null
status=$?
kill $child

View File

@ -63,7 +63,7 @@ child=$!
# This test is essentially the same as that in the ufunc test; see that
# test for the rationale.
#
script | tee /dev/fd/2 | grep 'ksh`[a-zA-Z_]' > /dev/null
script | tee /dev/fd/2 | egrep 'ksh(93)?`[a-zA-Z_]' > /dev/null
status=$?
kill $child

File diff suppressed because it is too large Load Diff

View File

@ -179,8 +179,19 @@ symtab_init(void)
size_t sz;
#endif
#if defined(__FreeBSD__)
if ((fd = open("/dev/ksyms", O_RDONLY)) == -1) {
if (errno == ENOENT && modfind("ksyms") == -1) {
kldload("ksyms");
fd = open("/dev/ksyms", O_RDONLY);
}
if (fd == -1)
return (-1);
}
#else
if ((fd = open("/dev/ksyms", O_RDONLY)) == -1)
return (-1);
#endif
#if defined(sun)
(void) elf_version(EV_CURRENT);

View File

@ -778,7 +778,8 @@ main(int argc, char **argv)
#endif
int err;
int opt_C = 0, opt_H = 0, opt_p = 0, opt_v = 0;
char c, *p, *end;
int c;
char *p, *end;
struct sigaction act;
int done = 0;

View File

@ -242,7 +242,7 @@ const char histo_stars[] = "****************************************";
const int histo_width = sizeof (histo_stars) - 1;
static void
dump_histogram(const uint64_t *histo, int size)
dump_histogram(const uint64_t *histo, int size, int offset)
{
int i;
int minidx = size - 1;
@ -263,7 +263,7 @@ dump_histogram(const uint64_t *histo, int size)
for (i = minidx; i <= maxidx; i++) {
(void) printf("\t\t\t%3u: %6llu %s\n",
i, (u_longlong_t)histo[i],
i + offset, (u_longlong_t)histo[i],
&histo_stars[(max - histo[i]) * histo_width / max]);
}
}
@ -316,19 +316,19 @@ dump_zap_stats(objset_t *os, uint64_t object)
(u_longlong_t)zs.zs_salt);
(void) printf("\t\tLeafs with 2^n pointers:\n");
dump_histogram(zs.zs_leafs_with_2n_pointers, ZAP_HISTOGRAM_SIZE);
dump_histogram(zs.zs_leafs_with_2n_pointers, ZAP_HISTOGRAM_SIZE, 0);
(void) printf("\t\tBlocks with n*5 entries:\n");
dump_histogram(zs.zs_blocks_with_n5_entries, ZAP_HISTOGRAM_SIZE);
dump_histogram(zs.zs_blocks_with_n5_entries, ZAP_HISTOGRAM_SIZE, 0);
(void) printf("\t\tBlocks n/10 full:\n");
dump_histogram(zs.zs_blocks_n_tenths_full, ZAP_HISTOGRAM_SIZE);
dump_histogram(zs.zs_blocks_n_tenths_full, ZAP_HISTOGRAM_SIZE, 0);
(void) printf("\t\tEntries with n chunks:\n");
dump_histogram(zs.zs_entries_using_n_chunks, ZAP_HISTOGRAM_SIZE);
dump_histogram(zs.zs_entries_using_n_chunks, ZAP_HISTOGRAM_SIZE, 0);
(void) printf("\t\tBuckets with n entries:\n");
dump_histogram(zs.zs_buckets_with_n_entries, ZAP_HISTOGRAM_SIZE);
dump_histogram(zs.zs_buckets_with_n_entries, ZAP_HISTOGRAM_SIZE, 0);
}
/*ARGSUSED*/
@ -517,26 +517,85 @@ dump_zpldir(objset_t *os, uint64_t object, void *data, size_t size)
zap_cursor_fini(&zc);
}
int
get_dtl_refcount(vdev_t *vd)
{
int refcount = 0;
if (vd->vdev_ops->vdev_op_leaf) {
space_map_t *sm = vd->vdev_dtl_sm;
if (sm != NULL &&
sm->sm_dbuf->db_size == sizeof (space_map_phys_t))
return (1);
return (0);
}
for (int c = 0; c < vd->vdev_children; c++)
refcount += get_dtl_refcount(vd->vdev_child[c]);
return (refcount);
}
int
get_metaslab_refcount(vdev_t *vd)
{
int refcount = 0;
if (vd->vdev_top == vd) {
for (int m = 0; m < vd->vdev_ms_count; m++) {
space_map_t *sm = vd->vdev_ms[m]->ms_sm;
if (sm != NULL &&
sm->sm_dbuf->db_size == sizeof (space_map_phys_t))
refcount++;
}
}
for (int c = 0; c < vd->vdev_children; c++)
refcount += get_metaslab_refcount(vd->vdev_child[c]);
return (refcount);
}
static int
verify_spacemap_refcounts(spa_t *spa)
{
int expected_refcount, actual_refcount;
expected_refcount = spa_feature_get_refcount(spa,
&spa_feature_table[SPA_FEATURE_SPACEMAP_HISTOGRAM]);
actual_refcount = get_dtl_refcount(spa->spa_root_vdev);
actual_refcount += get_metaslab_refcount(spa->spa_root_vdev);
if (expected_refcount != actual_refcount) {
(void) printf("space map refcount mismatch: expected %d != "
"actual %d\n", expected_refcount, actual_refcount);
return (2);
}
return (0);
}
static void
dump_spacemap(objset_t *os, space_map_obj_t *smo, space_map_t *sm)
dump_spacemap(objset_t *os, space_map_t *sm)
{
uint64_t alloc, offset, entry;
uint8_t mapshift = sm->sm_shift;
uint64_t mapstart = sm->sm_start;
char *ddata[] = { "ALLOC", "FREE", "CONDENSE", "INVALID",
"INVALID", "INVALID", "INVALID", "INVALID" };
if (smo->smo_object == 0)
if (sm == NULL)
return;
/*
* Print out the freelist entries in both encoded and decoded form.
*/
alloc = 0;
for (offset = 0; offset < smo->smo_objsize; offset += sizeof (entry)) {
VERIFY3U(0, ==, dmu_read(os, smo->smo_object, offset,
for (offset = 0; offset < space_map_length(sm);
offset += sizeof (entry)) {
uint8_t mapshift = sm->sm_shift;
VERIFY0(dmu_read(os, space_map_object(sm), offset,
sizeof (entry), &entry, DMU_READ_PREFETCH));
if (SM_DEBUG_DECODE(entry)) {
(void) printf("\t [%6llu] %s: txg %llu, pass %llu\n",
(u_longlong_t)(offset / sizeof (entry)),
ddata[SM_DEBUG_ACTION_DECODE(entry)],
@ -548,10 +607,10 @@ dump_spacemap(objset_t *os, space_map_obj_t *smo, space_map_t *sm)
(u_longlong_t)(offset / sizeof (entry)),
SM_TYPE_DECODE(entry) == SM_ALLOC ? 'A' : 'F',
(u_longlong_t)((SM_OFFSET_DECODE(entry) <<
mapshift) + mapstart),
mapshift) + sm->sm_start),
(u_longlong_t)((SM_OFFSET_DECODE(entry) <<
mapshift) + mapstart + (SM_RUN_DECODE(entry) <<
mapshift)),
mapshift) + sm->sm_start +
(SM_RUN_DECODE(entry) << mapshift)),
(u_longlong_t)(SM_RUN_DECODE(entry) << mapshift));
if (SM_TYPE_DECODE(entry) == SM_ALLOC)
alloc += SM_RUN_DECODE(entry) << mapshift;
@ -559,10 +618,10 @@ dump_spacemap(objset_t *os, space_map_obj_t *smo, space_map_t *sm)
alloc -= SM_RUN_DECODE(entry) << mapshift;
}
}
if (alloc != smo->smo_alloc) {
if (alloc != space_map_allocated(sm)) {
(void) printf("space_map_object alloc (%llu) INCONSISTENT "
"with space map summary (%llu)\n",
(u_longlong_t)smo->smo_alloc, (u_longlong_t)alloc);
(u_longlong_t)space_map_allocated(sm), (u_longlong_t)alloc);
}
}
@ -570,15 +629,17 @@ static void
dump_metaslab_stats(metaslab_t *msp)
{
char maxbuf[32];
space_map_t *sm = msp->ms_map;
avl_tree_t *t = sm->sm_pp_root;
int free_pct = sm->sm_space * 100 / sm->sm_size;
range_tree_t *rt = msp->ms_tree;
avl_tree_t *t = &msp->ms_size_tree;
int free_pct = range_tree_space(rt) * 100 / msp->ms_size;
zdb_nicenum(space_map_maxsize(sm), maxbuf);
zdb_nicenum(metaslab_block_maxsize(msp), maxbuf);
(void) printf("\t %25s %10lu %7s %6s %4s %4d%%\n",
"segments", avl_numnodes(t), "maxsize", maxbuf,
"freepct", free_pct);
(void) printf("\tIn-memory histogram:\n");
dump_histogram(rt->rt_histogram, RANGE_TREE_HISTOGRAM_SIZE, 0);
}
static void
@ -586,33 +647,45 @@ dump_metaslab(metaslab_t *msp)
{
vdev_t *vd = msp->ms_group->mg_vd;
spa_t *spa = vd->vdev_spa;
space_map_t *sm = msp->ms_map;
space_map_obj_t *smo = &msp->ms_smo;
space_map_t *sm = msp->ms_sm;
char freebuf[32];
zdb_nicenum(sm->sm_size - smo->smo_alloc, freebuf);
zdb_nicenum(msp->ms_size - space_map_allocated(sm), freebuf);
(void) printf(
"\tmetaslab %6llu offset %12llx spacemap %6llu free %5s\n",
(u_longlong_t)(sm->sm_start / sm->sm_size),
(u_longlong_t)sm->sm_start, (u_longlong_t)smo->smo_object, freebuf);
(u_longlong_t)msp->ms_id, (u_longlong_t)msp->ms_start,
(u_longlong_t)space_map_object(sm), freebuf);
if (dump_opt['m'] > 1 && !dump_opt['L']) {
if (dump_opt['m'] > 2 && !dump_opt['L']) {
mutex_enter(&msp->ms_lock);
space_map_load_wait(sm);
if (!sm->sm_loaded)
VERIFY(space_map_load(sm, zfs_metaslab_ops,
SM_FREE, smo, spa->spa_meta_objset) == 0);
metaslab_load_wait(msp);
if (!msp->ms_loaded) {
VERIFY0(metaslab_load(msp));
range_tree_stat_verify(msp->ms_tree);
}
dump_metaslab_stats(msp);
space_map_unload(sm);
metaslab_unload(msp);
mutex_exit(&msp->ms_lock);
}
if (dump_opt['d'] > 5 || dump_opt['m'] > 2) {
ASSERT(sm->sm_size == (1ULL << vd->vdev_ms_shift));
if (dump_opt['m'] > 1 && sm != NULL &&
spa_feature_is_active(spa,
&spa_feature_table[SPA_FEATURE_SPACEMAP_HISTOGRAM])) {
/*
* 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");
dump_histogram(sm->sm_phys->smp_histogram,
SPACE_MAP_HISTOGRAM_SIZE(sm), sm->sm_shift);
}
if (dump_opt['d'] > 5 || dump_opt['m'] > 3) {
ASSERT(msp->ms_size == (1ULL << vd->vdev_ms_shift));
mutex_enter(&msp->ms_lock);
dump_spacemap(spa->spa_meta_objset, smo, sm);
dump_spacemap(spa->spa_meta_objset, msp->ms_sm);
mutex_exit(&msp->ms_lock);
}
}
@ -801,9 +874,9 @@ dump_all_ddts(spa_t *spa)
}
static void
dump_dtl_seg(space_map_t *sm, uint64_t start, uint64_t size)
dump_dtl_seg(void *arg, uint64_t start, uint64_t size)
{
char *prefix = (void *)sm;
char *prefix = arg;
(void) printf("%s [%llu,%llu) length %llu\n",
prefix,
@ -833,17 +906,16 @@ dump_dtl(vdev_t *vd, int indent)
required ? "DTL-required" : "DTL-expendable");
for (int t = 0; t < DTL_TYPES; t++) {
space_map_t *sm = &vd->vdev_dtl[t];
if (sm->sm_space == 0)
range_tree_t *rt = vd->vdev_dtl[t];
if (range_tree_space(rt) == 0)
continue;
(void) snprintf(prefix, sizeof (prefix), "\t%*s%s",
indent + 2, "", name[t]);
mutex_enter(sm->sm_lock);
space_map_walk(sm, dump_dtl_seg, (void *)prefix);
mutex_exit(sm->sm_lock);
mutex_enter(rt->rt_lock);
range_tree_walk(rt, dump_dtl_seg, prefix);
mutex_exit(rt->rt_lock);
if (dump_opt['d'] > 5 && vd->vdev_children == 0)
dump_spacemap(spa->spa_meta_objset,
&vd->vdev_dtl_smo, sm);
dump_spacemap(spa->spa_meta_objset, vd->vdev_dtl_sm);
}
for (int c = 0; c < vd->vdev_children; c++)
@ -2172,39 +2244,17 @@ zdb_blkptr_cb(spa_t *spa, zilog_t *zilog, const blkptr_t *bp,
}
static void
zdb_leak(space_map_t *sm, uint64_t start, uint64_t size)
zdb_leak(void *arg, uint64_t start, uint64_t size)
{
vdev_t *vd = sm->sm_ppd;
vdev_t *vd = arg;
(void) printf("leaked space: vdev %llu, offset 0x%llx, size %llu\n",
(u_longlong_t)vd->vdev_id, (u_longlong_t)start, (u_longlong_t)size);
}
/* ARGSUSED */
static void
zdb_space_map_load(space_map_t *sm)
{
}
static void
zdb_space_map_unload(space_map_t *sm)
{
space_map_vacate(sm, zdb_leak, sm);
}
/* ARGSUSED */
static void
zdb_space_map_claim(space_map_t *sm, uint64_t start, uint64_t size)
{
}
static space_map_ops_t zdb_space_map_ops = {
zdb_space_map_load,
zdb_space_map_unload,
static metaslab_ops_t zdb_metaslab_ops = {
NULL, /* alloc */
zdb_space_map_claim,
NULL, /* free */
NULL /* maxsize */
NULL /* fragmented */
};
static void
@ -2259,11 +2309,21 @@ zdb_leak_init(spa_t *spa, zdb_cb_t *zcb)
for (int m = 0; m < vd->vdev_ms_count; m++) {
metaslab_t *msp = vd->vdev_ms[m];
mutex_enter(&msp->ms_lock);
space_map_unload(msp->ms_map);
VERIFY(space_map_load(msp->ms_map,
&zdb_space_map_ops, SM_ALLOC, &msp->ms_smo,
spa->spa_meta_objset) == 0);
msp->ms_map->sm_ppd = vd;
metaslab_unload(msp);
/*
* For leak detection, we overload the metaslab
* ms_tree to contain allocated segments
* instead of free segments. As a result,
* we can't use the normal metaslab_load/unload
* interfaces.
*/
if (msp->ms_sm != NULL) {
msp->ms_ops = &zdb_metaslab_ops;
VERIFY0(space_map_load(msp->ms_sm,
msp->ms_tree, SM_ALLOC));
msp->ms_loaded = B_TRUE;
}
mutex_exit(&msp->ms_lock);
}
}
@ -2286,7 +2346,20 @@ zdb_leak_fini(spa_t *spa)
for (int m = 0; m < vd->vdev_ms_count; m++) {
metaslab_t *msp = vd->vdev_ms[m];
mutex_enter(&msp->ms_lock);
space_map_unload(msp->ms_map);
/*
* The ms_tree has been overloaded to
* contain allocated segments. Now that we
* finished traversing all blocks, any
* block that remains in the ms_tree
* represents an allocated block that we
* did not claim during the traversal.
* Claimed blocks would have been removed
* from the ms_tree.
*/
range_tree_vacate(msp->ms_tree, zdb_leak, vd);
msp->ms_loaded = B_FALSE;
mutex_exit(&msp->ms_lock);
}
}
@ -2489,7 +2562,7 @@ dump_block_stats(spa_t *spa)
"(in 512-byte sectors): "
"number of blocks\n");
dump_histogram(zb->zb_psize_histogram,
PSIZE_HISTO_SIZE);
PSIZE_HISTO_SIZE, 0);
}
}
}
@ -2659,6 +2732,9 @@ dump_zpool(spa_t *spa)
if (dump_opt['b'] || dump_opt['c'])
rc = dump_block_stats(spa);
if (rc == 0)
rc = verify_spacemap_refcounts(spa);
if (dump_opt['s'])
show_pool_stats(spa);

View File

@ -25,10 +25,11 @@
.\" Copyright (c) 2013 by Saso Kiselkov. All rights reserved.
.\" Copyright (c) 2013 Nexenta Systems, Inc. All Rights Reserved.
.\" Copyright (c) 2013, Joyent, Inc. All rights reserved.
.\" Copyright (c) 2013, Steven Hartland <smh@FreeBSD.org>
.\"
.\" $FreeBSD$
.\"
.Dd September 20, 2013
.Dd October 23, 2013
.Dt ZFS 8
.Os
.Sh NAME
@ -61,7 +62,7 @@
.Op , Ns ...
.Sm on
.Nm
.Cm snapshot
.Cm snapshot Ns | Ns Cm snap
.Op Fl r
.Oo Fl o Ar property Ns = Ns Ar value Oc Ns ...
.Ar filesystem@snapname Ns | Ns Ar volume@snapname
@ -157,7 +158,7 @@
.Op Fl o Ar property Ns Oo , Ns Ar property Oc Ns ...
.Fl a | Ar filesystem
.Nm
.Cm unmount
.Cm unmount Ns | Ns Cm umount
.Op Fl f
.Fl a | Ar filesystem Ns | Ns Ar mountpoint
.Nm
@ -172,11 +173,11 @@
.Op Fl i Ar snapshot | Fl I Ar snapshot
.Ar snapshot
.Nm
.Cm receive
.Cm receive Ns | Ns Cm recv
.Op Fl vnFu
.Ar filesystem Ns | Ns Ar volume Ns | Ns Ar snapshot
.Nm
.Cm receive
.Cm receive Ns | Ns Cm recv
.Op Fl vnFu
.Op Fl d | e
.Ar filesystem
@ -1653,7 +1654,7 @@ options, as they can destroy large portions of a pool and cause unexpected
behavior for mounted file systems in use.
.It Xo
.Nm
.Cm snapshot
.Cm snapshot Ns | Ns Cm snap
.Op Fl r
.Oo Fl o Ar property Ns = Ns Ar value Oc Ns ...
.Ar filesystem@snapname Ns | Ns volume@snapname
@ -1865,7 +1866,7 @@ syntax.
A comma-separated list of types to display, where
.Ar type
is one of
.Sy filesystem , snapshot , volume , No or Sy all .
.Sy filesystem , snapshot , snap, volume , No or Sy all .
For example, specifying
.Fl t Cm snapshot
displays only snapshots.
@ -2194,7 +2195,7 @@ Mount the specified filesystem.
.El
.It Xo
.Nm
.Cm unmount
.Cm unmount Ns | Ns Cm umount
.Op Fl f
.Fl a | Ar filesystem Ns | Ns Ar mountpoint
.Xc
@ -2377,13 +2378,13 @@ on future versions of
.Tn ZFS .
.It Xo
.Nm
.Cm receive
.Cm receive Ns | Ns Cm recv
.Op Fl vnFu
.Ar filesystem Ns | Ns Ar volume Ns | Ns Ar snapshot
.Xc
.It Xo
.Nm
.Cm receive
.Cm receive Ns | Ns Cm recv
.Op Fl vnFu
.Op Fl d | e
.Ar filesystem

View File

@ -58,6 +58,7 @@
#include <sys/types.h>
#include <time.h>
#include <err.h>
#include <jail.h>
#include <libzfs.h>
#include <libzfs_core.h>
@ -258,9 +259,9 @@ get_usage(zfs_help_t idx)
case HELP_PROMOTE:
return (gettext("\tpromote <clone-filesystem>\n"));
case HELP_RECEIVE:
return (gettext("\treceive [-vnFu] <filesystem|volume|"
return (gettext("\treceive|recv [-vnFu] <filesystem|volume|"
"snapshot>\n"
"\treceive [-vnFu] [-d | -e] <filesystem>\n"));
"\treceive|recv [-vnFu] [-d | -e] <filesystem>\n"));
case HELP_RENAME:
return (gettext("\trename [-f] <filesystem|volume|snapshot> "
"<filesystem|volume|snapshot>\n"
@ -279,10 +280,10 @@ get_usage(zfs_help_t idx)
case HELP_SHARE:
return (gettext("\tshare <-a | filesystem>\n"));
case HELP_SNAPSHOT:
return (gettext("\tsnapshot [-r] [-o property=value] ... "
return (gettext("\tsnapshot|snap [-r] [-o property=value] ... "
"<filesystem@snapname|volume@snapname> ...\n"));
case HELP_UNMOUNT:
return (gettext("\tunmount [-f] "
return (gettext("\tunmount|umount [-f] "
"<-a | filesystem|mountpoint>\n"));
case HELP_UNSHARE:
return (gettext("\tunshare "
@ -2010,7 +2011,7 @@ zfs_do_upgrade(int argc, char **argv)
boolean_t showversions = B_FALSE;
int ret = 0;
upgrade_cbdata_t cb = { 0 };
char c;
int c;
int flags = ZFS_ITER_ARGS_CAN_BE_PATHS;
/* check options */
@ -3026,7 +3027,7 @@ zfs_do_list(int argc, char **argv)
flags &= ~ZFS_ITER_PROP_LISTSNAPS;
while (*optarg != '\0') {
static char *type_subopts[] = { "filesystem",
"volume", "snapshot", "all", NULL };
"volume", "snapshot", "snap", "all", NULL };
switch (getsubopt(&optarg, type_subopts,
&value)) {
@ -3037,9 +3038,10 @@ zfs_do_list(int argc, char **argv)
types |= ZFS_TYPE_VOLUME;
break;
case 2:
case 3:
types |= ZFS_TYPE_SNAPSHOT;
break;
case 3:
case 4:
types = ZFS_TYPE_DATASET;
break;
@ -3559,7 +3561,7 @@ static int
zfs_do_snapshot(int argc, char **argv)
{
int ret = 0;
char c;
int c;
nvlist_t *props;
snap_cbdata_t sd = { 0 };
boolean_t multiple_snaps = B_FALSE;
@ -6724,6 +6726,12 @@ main(int argc, char **argv)
if (strcmp(cmdname, "recv") == 0)
cmdname = "receive";
/*
* The 'snap' command is an alias for 'snapshot'
*/
if (strcmp(cmdname, "snap") == 0)
cmdname = "snapshot";
/*
* Special case '-?'
*/

View File

@ -23,7 +23,7 @@
.\"
.\" $FreeBSD$
.\"
.Dd September 20, 2013
.Dd October 08, 2013
.Dt ZPOOL-FEATURES 7
.Os
.Sh NAME
@ -251,6 +251,24 @@ configuration.
.\" .Xr dumpon 8
.\" command to configure a
.\" dump device on a pool comprised of multiple vdevs.
.It Sy spacemap_histogram
.Bl -column "READ\-ONLY COMPATIBLE" "com.delphix:spacemap_histogram"
.It GUID Ta com.delphix:spacemap_histogram
.It READ\-ONLY COMPATIBLE Ta yes
.It DEPENDENCIES Ta none
.El
.Pp
This features allows ZFS to maintain more information about how free space
is organized within the pool. If this feature is
.Sy enabled ,
ZFS will
set this feature to
.Sy active
when a new space map object is created or
an existing space map is upgraded to the new format.
Once the feature is
.Sy active ,
it will remain in that state until the pool is destroyed.
.El
.Sh SEE ALSO
.Xr zpool 8

View File

@ -1702,6 +1702,12 @@ show_import(nvlist_t *config)
"resilvered.\n"));
break;
case ZPOOL_STATUS_NON_NATIVE_ASHIFT:
(void) printf(gettext("status: One or more devices were "
"configured to use a non-native block size.\n"
"\tExpect reduced performance.\n"));
break;
default:
/*
* No other status can be seen when importing pools.

View File

@ -186,7 +186,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;
extern uint64_t zfs_deadman_synctime_ms;
static ztest_shared_opts_t *ztest_shared_opts;
static ztest_shared_opts_t ztest_opts;
@ -5328,10 +5328,10 @@ ztest_deadman_thread(void *arg)
hrtime_t delta, total = 0;
for (;;) {
delta = (zs->zs_thread_stop - zs->zs_thread_start) /
NANOSEC + zfs_deadman_synctime;
delta = zs->zs_thread_stop - zs->zs_thread_start +
MSEC2NSEC(zfs_deadman_synctime_ms);
(void) poll(NULL, 0, (int)(1000 * delta));
(void) poll(NULL, 0, (int)NSEC2MSEC(delta));
/*
* If the pool is suspended then fail immediately. Otherwise,
@ -5339,15 +5339,15 @@ ztest_deadman_thread(void *arg)
* vdev_deadman() discovers that there hasn't been any recent
* I/Os then it will end up aborting the tests.
*/
if (spa_suspended(spa)) {
if (spa_suspended(spa) || spa->spa_root_vdev == NULL) {
fatal(0, "aborting test after %llu seconds because "
"pool has transitioned to a suspended state.",
zfs_deadman_synctime);
zfs_deadman_synctime_ms / 1000);
return (NULL);
}
vdev_deadman(spa->spa_root_vdev);
total += zfs_deadman_synctime;
total += zfs_deadman_synctime_ms/1000;
(void) printf("ztest has been running for %lld seconds\n",
total);
}
@ -6080,7 +6080,7 @@ main(int argc, char **argv)
(void) setvbuf(stdout, NULL, _IOLBF, 0);
dprintf_setup(&argc, argv);
zfs_deadman_synctime = 300;
zfs_deadman_synctime_ms = 300000;
ztest_fd_rand = open("/dev/urandom", O_RDONLY);
ASSERT3S(ztest_fd_rand, >=, 0);

View File

@ -65,7 +65,7 @@ ctf_create(int *errp)
cts.cts_name = _CTF_SECTION;
cts.cts_type = SHT_PROGBITS;
cts.cts_flags = 0;
cts.cts_data = &hdr;
cts.cts_data = (void *)&hdr;
cts.cts_size = sizeof (hdr);
cts.cts_entsize = 1;
cts.cts_offset = 0;

View File

@ -242,8 +242,14 @@ printf("%s:%s(%d): DOODAD\n",__FUNCTION__,__FILE__,__LINE__);
/* XXX */
printf("%s:%s(%d): DOODAD\n",__FUNCTION__,__FILE__,__LINE__);
#elif defined(__powerpc__)
/* XXX */
printf("%s:%s(%d): DOODAD\n",__FUNCTION__,__FILE__,__LINE__);
/*
* Add 4 bytes to hit the low half of this 64-bit
* big-endian address.
*/
rel->r_offset = s->dofs_offset +
dofr[j].dofr_offset + 4;
rel->r_info = ELF32_R_INFO(count + dep->de_global,
R_PPC_REL32);
#elif defined(__sparc)
/*
* Add 4 bytes to hit the low half of this 64-bit
@ -423,7 +429,10 @@ prepare_elf64(dtrace_hdl_t *dtp, const dof_hdr_t *dof, dof_elf64_t *dep)
#elif defined(__mips__)
/* XXX */
#elif defined(__powerpc__)
/* XXX */
rel->r_offset = s->dofs_offset +
dofr[j].dofr_offset;
rel->r_info = ELF64_R_INFO(count + dep->de_global,
R_PPC64_REL64);
#elif defined(__i386) || defined(__amd64)
rel->r_offset = s->dofs_offset +
dofr[j].dofr_offset;
@ -824,12 +833,84 @@ printf("%s:%s(%d): DOODAD\n",__FUNCTION__,__FILE__,__LINE__);
return (0);
}
#elif defined(__powerpc__)
/* The sentinel is 'xor r3,r3,r3'. */
#define DT_OP_XOR_R3 0x7c631a78
#define DT_OP_NOP 0x60000000
#define DT_OP_BLR 0x4e800020
/* This captures all forms of branching to address. */
#define DT_IS_BRANCH(inst) ((inst & 0xfc000000) == 0x48000000)
#define DT_IS_BL(inst) (DT_IS_BRANCH(inst) && (inst & 0x01))
/* 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__);
uint32_t *ip;
if ((rela->r_offset & (sizeof (uint32_t) - 1)) != 0)
return (-1);
/*LINTED*/
ip = (uint32_t *)(p + rela->r_offset);
/*
* We only know about some specific relocation types.
*/
if (GELF_R_TYPE(rela->r_info) != R_PPC_REL24 &&
GELF_R_TYPE(rela->r_info) != R_PPC_PLTREL24)
return (-1);
/*
* We may have already processed this object file in an earlier linker
* invocation. Check to see if the present instruction sequence matches
* the one we would install below.
*/
if (isenabled) {
if (ip[0] == DT_OP_XOR_R3) {
(*off) += sizeof (ip[0]);
return (0);
}
} else {
if (ip[0] == DT_OP_NOP) {
(*off) += sizeof (ip[0]);
return (0);
}
}
/*
* We only expect branch to address instructions.
*/
if (!DT_IS_BRANCH(ip[0])) {
dt_dprintf("found %x instead of a branch instruction at %llx\n",
ip[0], (u_longlong_t)rela->r_offset);
return (-1);
}
if (isenabled) {
/*
* It would necessarily indicate incorrect usage if an is-
* enabled probe were tail-called so flag that as an error.
* It's also potentially (very) tricky to handle gracefully,
* but could be done if this were a desired use scenario.
*/
if (!DT_IS_BL(ip[0])) {
dt_dprintf("tail call to is-enabled probe at %llx\n",
(u_longlong_t)rela->r_offset);
return (-1);
}
ip[0] = DT_OP_XOR_R3;
(*off) += sizeof (ip[0]);
} else {
if (DT_IS_BL(ip[0]))
ip[0] = DT_OP_NOP;
else
ip[0] = DT_OP_BLR;
}
return (0);
}
@ -1628,8 +1709,6 @@ dtrace_program_link(dtrace_hdl_t *dtp, dtrace_prog_t *pgp, uint_t dflags,
*/
return (0);
}
/* XXX Should get a temp file name here. */
snprintf(tfile, sizeof(tfile), "%s.tmp", file);
#endif
/*
@ -1704,9 +1783,11 @@ dtrace_program_link(dtrace_hdl_t *dtp, dtrace_prog_t *pgp, uint_t dflags,
"failed to open %s: %s", file, strerror(errno)));
}
#else
if ((fd = open(tfile, O_RDWR | O_CREAT | O_TRUNC, 0666)) == -1)
snprintf(tfile, sizeof(tfile), "%s.XXXXXX", file);
if ((fd = mkstemp(tfile)) == -1)
return (dt_link_error(dtp, NULL, -1, NULL,
"failed to open %s: %s", tfile, strerror(errno)));
"failed to create temporary file %s: %s",
tfile, strerror(errno)));
#endif
/*
@ -1749,13 +1830,15 @@ dtrace_program_link(dtrace_hdl_t *dtp, dtrace_prog_t *pgp, uint_t dflags,
status = dump_elf32(dtp, dof, fd);
if (status != 0 || lseek(fd, 0, SEEK_SET) != 0) {
#else
/* We don't write the ELF header, just the DOF section */
if (dt_write(dtp, fd, dof, dof->dofh_filesz) < dof->dofh_filesz) {
#endif
return (dt_link_error(dtp, NULL, -1, NULL,
"failed to write %s: %s", file, strerror(errno)));
}
#else
/* We don't write the ELF header, just the DOF section */
if (dt_write(dtp, fd, dof, dof->dofh_filesz) < dof->dofh_filesz)
return (dt_link_error(dtp, NULL, -1, NULL,
"failed to write %s: %s", tfile, strerror(errno)));
#endif
if (!dtp->dt_lazyload) {
#if defined(sun)
@ -1783,7 +1866,7 @@ dtrace_program_link(dtrace_hdl_t *dtp, dtrace_prog_t *pgp, uint_t dflags,
* Arches which default to 64-bit need to explicitly use
* the 32-bit library path.
*/
int use_32 = !(dtp->dt_oflags & DTRACE_O_LP64);
int use_32 = (dtp->dt_oflags & DTRACE_O_ILP32);
#else
/*
* Arches which are 32-bit only just use the normal
@ -1798,9 +1881,7 @@ dtrace_program_link(dtrace_hdl_t *dtp, dtrace_prog_t *pgp, uint_t dflags,
len = snprintf(&tmp, 1, fmt, dtp->dt_ld_path, file, tfile,
drti) + 1;
#if !defined(sun)
len *= 2;
#endif
cmd = alloca(len);
(void) snprintf(cmd, len, fmt, dtp->dt_ld_path, file,

View File

@ -311,6 +311,10 @@ static const dt_ident_t _dtrace_globals[] = {
&dt_idops_func, "void(@)" },
{ "memref", DT_IDENT_FUNC, 0, DIF_SUBR_MEMREF, DT_ATTR_STABCMN, DT_VERS_1_1,
&dt_idops_func, "uintptr_t *(void *, size_t)" },
#if !defined(sun)
{ "memstr", DT_IDENT_FUNC, 0, DIF_SUBR_MEMSTR, DT_ATTR_STABCMN, DT_VERS_1_0,
&dt_idops_func, "string(void *, char, size_t)" },
#endif
{ "min", DT_IDENT_AGGFUNC, 0, DTRACEAGG_MIN, DT_ATTR_STABCMN, DT_VERS_1_0,
&dt_idops_func, "void(@)" },
{ "mod", DT_IDENT_ACTFUNC, 0, DT_ACT_MOD, DT_ATTR_STABCMN,
@ -483,22 +487,16 @@ static const dt_ident_t _dtrace_globals[] = {
DT_VERS_1_0, &dt_idops_func, "void(...)" },
{ "typeref", DT_IDENT_FUNC, 0, DIF_SUBR_TYPEREF, DT_ATTR_STABCMN, DT_VERS_1_1,
&dt_idops_func, "uintptr_t *(void *, size_t, string, size_t)" },
#if defined(sun)
{ "uaddr", DT_IDENT_ACTFUNC, 0, DT_ACT_UADDR, DT_ATTR_STABCMN,
DT_VERS_1_2, &dt_idops_func, "_usymaddr(uintptr_t)" },
#endif
{ "ucaller", DT_IDENT_SCALAR, 0, DIF_VAR_UCALLER, DT_ATTR_STABCMN,
DT_VERS_1_2, &dt_idops_type, "uint64_t" },
#if defined(sun)
{ "ufunc", DT_IDENT_ACTFUNC, 0, DT_ACT_USYM, DT_ATTR_STABCMN,
DT_VERS_1_2, &dt_idops_func, "_usymaddr(uintptr_t)" },
#endif
{ "uid", DT_IDENT_SCALAR, 0, DIF_VAR_UID, DT_ATTR_STABCMN, DT_VERS_1_0,
&dt_idops_type, "uid_t" },
#if defined(sun)
{ "umod", DT_IDENT_ACTFUNC, 0, DT_ACT_UMOD, DT_ATTR_STABCMN,
DT_VERS_1_2, &dt_idops_func, "_usymaddr(uintptr_t)" },
#endif
{ "uregs", DT_IDENT_ARRAY, 0, DIF_VAR_UREGS, DT_ATTR_STABCMN, DT_VERS_1_0,
&dt_idops_regs, NULL },
{ "ustack", DT_IDENT_ACTFUNC, 0, DT_ACT_USTACK, DT_ATTR_STABCMN, DT_VERS_1_0,
@ -506,10 +504,8 @@ static const dt_ident_t _dtrace_globals[] = {
{ "ustackdepth", DT_IDENT_SCALAR, 0, DIF_VAR_USTACKDEPTH,
DT_ATTR_STABCMN, DT_VERS_1_2,
&dt_idops_type, "uint32_t" },
#if defined(sun)
{ "usym", DT_IDENT_ACTFUNC, 0, DT_ACT_USYM, DT_ATTR_STABCMN,
DT_VERS_1_2, &dt_idops_func, "_usymaddr(uintptr_t)" },
#endif
{ "vtimestamp", DT_IDENT_SCALAR, 0, DIF_VAR_VTIMESTAMP,
DT_ATTR_STABCMN, DT_VERS_1_0,
&dt_idops_type, "uint64_t" },

View File

@ -35,14 +35,26 @@
#include <dt_impl.h>
#include <dt_pid.h>
#include <libproc_compat.h>
/*ARGSUSED*/
int
dt_pid_create_entry_probe(struct ps_prochandle *P, dtrace_hdl_t *dtp,
fasttrap_probe_spec_t *ftp, const GElf_Sym *symp)
{
ftp->ftps_type = DTFTP_ENTRY;
ftp->ftps_pc = (uintptr_t)symp->st_value;
ftp->ftps_size = (size_t)symp->st_size;
ftp->ftps_noffs = 1;
ftp->ftps_offs[0] = 0;
dt_dprintf("%s: unimplemented\n", __func__);
return (DT_PROC_ERR);
if (ioctl(dtp->dt_ftfd, FASTTRAPIOC_MAKEPROBE, ftp) != 0) {
dt_dprintf("fasttrap probe creation ioctl failed: %s\n",
strerror(errno));
return (dt_set_errno(dtp, errno));
}
return (1);
}
int
@ -50,8 +62,74 @@ dt_pid_create_return_probe(struct ps_prochandle *P, dtrace_hdl_t *dtp,
fasttrap_probe_spec_t *ftp, const GElf_Sym *symp, uint64_t *stret)
{
dt_dprintf("%s: unimplemented\n", __func__);
return (DT_PROC_ERR);
uintptr_t temp;
uint32_t *text;
int i;
int srdepth = 0;
if ((text = malloc(symp->st_size + 4)) == NULL) {
dt_dprintf("mr sparkle: malloc() failed\n");
return (DT_PROC_ERR);
}
if (Pread(P, text, symp->st_size, symp->st_value) != symp->st_size) {
dt_dprintf("mr sparkle: Pread() failed\n");
free(text);
return (DT_PROC_ERR);
}
/*
* Leave a dummy instruction in the last slot to simplify edge
* conditions.
*/
text[symp->st_size / 4] = 0;
ftp->ftps_type = DTFTP_RETURN;
ftp->ftps_pc = symp->st_value;
ftp->ftps_size = symp->st_size;
ftp->ftps_noffs = 0;
for (i = 0; i < symp->st_size / 4; i++) {
if ((text[i] & 0xfc000001) != 0x48000000 &&
text[i] != 0x4e800020)
continue;
/*
* Check for a jump within this function. If it's outside this
* function then it's a tail-call, so a return point.
*/
if ((text[i] & 0xfc000000) == 0x48000000) {
temp = (text[i] & 0x03fffffc);
/* Bit 30 denotes an absolute address. */
if (!(text[i] & 0x02)) {
temp += symp->st_value + i * 4;
}
else {
/* Sign extend the absolute address. */
if (temp & 0x02000000) {
temp |= (UINTPTR_MAX - 0x03ffffff);
}
}
if (temp >= symp->st_value &&
temp <= (symp->st_value + symp->st_size))
continue;
}
dt_dprintf("return at offset %x\n", i * 4);
ftp->ftps_offs[ftp->ftps_noffs++] = i * 4;
}
free(text);
if (ftp->ftps_noffs > 0) {
if (ioctl(dtp->dt_ftfd, FASTTRAPIOC_MAKEPROBE, ftp) != 0) {
dt_dprintf("fasttrap probe creation ioctl failed: %s\n",
strerror(errno));
return (dt_set_errno(dtp, errno));
}
}
return (ftp->ftps_noffs);
}
/*ARGSUSED*/
@ -59,9 +137,22 @@ int
dt_pid_create_offset_probe(struct ps_prochandle *P, dtrace_hdl_t *dtp,
fasttrap_probe_spec_t *ftp, const GElf_Sym *symp, ulong_t off)
{
if (off & 0x3)
return (DT_PROC_ALIGN);
dt_dprintf("%s: unimplemented\n", __func__);
return (DT_PROC_ERR);
ftp->ftps_type = DTFTP_OFFSETS;
ftp->ftps_pc = (uintptr_t)symp->st_value;
ftp->ftps_size = (size_t)symp->st_size;
ftp->ftps_noffs = 1;
ftp->ftps_offs[0] = off;
if (ioctl(dtp->dt_ftfd, FASTTRAPIOC_MAKEPROBE, ftp) != 0) {
dt_dprintf("fasttrap probe creation ioctl failed: %s\n",
strerror(errno));
return (dt_set_errno(dtp, errno));
}
return (1);
}
/*ARGSUSED*/
@ -69,7 +160,38 @@ int
dt_pid_create_glob_offset_probes(struct ps_prochandle *P, dtrace_hdl_t *dtp,
fasttrap_probe_spec_t *ftp, const GElf_Sym *symp, const char *pattern)
{
ulong_t i;
dt_dprintf("%s: unimplemented\n", __func__);
return (DT_PROC_ERR);
ftp->ftps_type = DTFTP_OFFSETS;
ftp->ftps_pc = (uintptr_t)symp->st_value;
ftp->ftps_size = (size_t)symp->st_size;
ftp->ftps_noffs = 0;
/*
* If we're matching against everything, just iterate through each
* instruction in the function, otherwise look for matching offset
* names by constructing the string and comparing it against the
* pattern.
*/
if (strcmp("*", pattern) == 0) {
for (i = 0; i < symp->st_size; i += 4) {
ftp->ftps_offs[ftp->ftps_noffs++] = i;
}
} else {
char name[sizeof (i) * 2 + 1];
for (i = 0; i < symp->st_size; i += 4) {
(void) sprintf(name, "%lx", i);
if (gmatch(name, pattern))
ftp->ftps_offs[ftp->ftps_noffs++] = i;
}
}
if (ioctl(dtp->dt_ftfd, FASTTRAPIOC_MAKEPROBE, ftp) != 0) {
dt_dprintf("fasttrap probe creation ioctl failed: %s\n",
strerror(errno));
return (dt_set_errno(dtp, errno));
}
return (ftp->ftps_noffs);
}

View File

@ -210,7 +210,7 @@ NVLIST_PRTFUNC(int32, int32_t, int32_t, "%d")
NVLIST_PRTFUNC(uint32, uint32_t, uint32_t, "0x%x")
NVLIST_PRTFUNC(int64, int64_t, longlong_t, "%lld")
NVLIST_PRTFUNC(uint64, uint64_t, u_longlong_t, "0x%llx")
NVLIST_PRTFUNC(double, double, double, "0x%llf")
NVLIST_PRTFUNC(double, double, double, "0x%f")
NVLIST_PRTFUNC(string, char *, char *, "%s")
NVLIST_PRTFUNC(hrtime, hrtime_t, hrtime_t, "0x%llx")

View File

@ -995,10 +995,10 @@ nozpool_all_slices(avl_tree_t *r, const char *sname)
#endif /* sun */
}
#ifdef sun
static void
check_slices(avl_tree_t *r, int fd, const char *sname)
{
#ifdef sun
struct extvtoc vtoc;
struct dk_gpt *gpt;
char diskname[MAXNAMELEN];
@ -1028,8 +1028,8 @@ check_slices(avl_tree_t *r, int fd, const char *sname)
check_one_slice(r, diskname, i, 0, 1);
efi_free(gpt);
}
#endif /* sun */
}
#endif /* sun */
static void
zpool_open_func(void *arg)
@ -1059,6 +1059,7 @@ zpool_open_func(void *arg)
return;
}
/* this file is too small to hold a zpool */
#ifdef sun
if (S_ISREG(statbuf.st_mode) &&
statbuf.st_size < SPA_MINDEVSIZE) {
(void) close(fd);
@ -1070,6 +1071,12 @@ zpool_open_func(void *arg)
*/
check_slices(rn->rn_avl, fd, rn->rn_name);
}
#else /* !sun */
if (statbuf.st_size < SPA_MINDEVSIZE) {
(void) close(fd);
return;
}
#endif /* sun */
if ((zpool_read_label(fd, &config)) != 0) {
(void) close(fd);

View File

@ -23,6 +23,9 @@
* Copyright (c) 2013 by Delphix. All rights reserved.
* Copyright (c) 2012, Joyent, Inc. All rights reserved.
*/
/*
* Copyright 2011 Nexenta Systems, Inc. All rights reserved.
*/
#ifndef _SYS_ZFS_CONTEXT_H
#define _SYS_ZFS_CONTEXT_H
@ -62,6 +65,7 @@ extern "C" {
#include <inttypes.h>
#include <fsshare.h>
#include <pthread.h>
#include <sched.h>
#include <sys/debug.h>
#include <sys/note.h>
#include <sys/types.h>
@ -201,6 +205,8 @@ extern int aok;
*/
#define curthread ((void *)(uintptr_t)thr_self())
#define kpreempt(x) sched_yield()
typedef struct kthread kthread_t;
#define thread_create(stk, stksize, func, arg, len, pp, state, pri) \
@ -367,6 +373,16 @@ typedef struct taskq taskq_t;
typedef uintptr_t taskqid_t;
typedef void (task_func_t)(void *);
typedef struct taskq_ent {
struct taskq_ent *tqent_next;
struct taskq_ent *tqent_prev;
task_func_t *tqent_func;
void *tqent_arg;
uintptr_t tqent_flags;
} taskq_ent_t;
#define TQENT_FLAG_PREALLOC 0x1 /* taskq_dispatch_ent used */
#define TASKQ_PREPOPULATE 0x0001
#define TASKQ_CPR_SAFE 0x0002 /* Use CPR safe protocol */
#define TASKQ_DYNAMIC 0x0004 /* Use dynamic thread scheduling */
@ -378,6 +394,7 @@ typedef void (task_func_t)(void *);
#define TQ_NOQUEUE 0x02 /* Do not enqueue if can't dispatch */
#define TQ_FRONT 0x08 /* Queue in front */
extern taskq_t *system_taskq;
extern taskq_t *taskq_create(const char *, int, pri_t, int, int, uint_t);
@ -386,6 +403,8 @@ extern taskq_t *taskq_create(const char *, int, pri_t, int, int, uint_t);
#define taskq_create_sysdc(a, b, d, e, p, dc, f) \
(taskq_create(a, b, maxclsyspri, d, e, f))
extern taskqid_t taskq_dispatch(taskq_t *, task_func_t, void *, uint_t);
extern void taskq_dispatch_ent(taskq_t *, task_func_t, void *, uint_t,
taskq_ent_t *);
extern void taskq_destroy(taskq_t *);
extern void taskq_wait(taskq_t *);
extern int taskq_member(taskq_t *, void *);

View File

@ -22,19 +22,15 @@
* Copyright 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
* Copyright 2011 Nexenta Systems, Inc. All rights reserved.
*/
#include <sys/zfs_context.h>
int taskq_now;
taskq_t *system_taskq;
typedef struct task {
struct task *task_next;
struct task *task_prev;
task_func_t *task_func;
void *task_arg;
} task_t;
#define TASKQ_ACTIVE 0x00010000
struct taskq {
@ -51,18 +47,18 @@ struct taskq {
int tq_maxalloc;
kcondvar_t tq_maxalloc_cv;
int tq_maxalloc_wait;
task_t *tq_freelist;
task_t tq_task;
taskq_ent_t *tq_freelist;
taskq_ent_t tq_task;
};
static task_t *
static taskq_ent_t *
task_alloc(taskq_t *tq, int tqflags)
{
task_t *t;
taskq_ent_t *t;
int rv;
again: if ((t = tq->tq_freelist) != NULL && tq->tq_nalloc >= tq->tq_minalloc) {
tq->tq_freelist = t->task_next;
tq->tq_freelist = t->tqent_next;
} else {
if (tq->tq_nalloc >= tq->tq_maxalloc) {
if (!(tqflags & KM_SLEEP))
@ -87,7 +83,7 @@ again: if ((t = tq->tq_freelist) != NULL && tq->tq_nalloc >= tq->tq_minalloc) {
}
mutex_exit(&tq->tq_lock);
t = kmem_alloc(sizeof (task_t), tqflags & KM_SLEEP);
t = kmem_alloc(sizeof (taskq_ent_t), tqflags & KM_SLEEP);
mutex_enter(&tq->tq_lock);
if (t != NULL)
@ -97,15 +93,15 @@ again: if ((t = tq->tq_freelist) != NULL && tq->tq_nalloc >= tq->tq_minalloc) {
}
static void
task_free(taskq_t *tq, task_t *t)
task_free(taskq_t *tq, taskq_ent_t *t)
{
if (tq->tq_nalloc <= tq->tq_minalloc) {
t->task_next = tq->tq_freelist;
t->tqent_next = tq->tq_freelist;
tq->tq_freelist = t;
} else {
tq->tq_nalloc--;
mutex_exit(&tq->tq_lock);
kmem_free(t, sizeof (task_t));
kmem_free(t, sizeof (taskq_ent_t));
mutex_enter(&tq->tq_lock);
}
@ -116,7 +112,7 @@ task_free(taskq_t *tq, task_t *t)
taskqid_t
taskq_dispatch(taskq_t *tq, task_func_t func, void *arg, uint_t tqflags)
{
task_t *t;
taskq_ent_t *t;
if (taskq_now) {
func(arg);
@ -130,26 +126,58 @@ taskq_dispatch(taskq_t *tq, task_func_t func, void *arg, uint_t tqflags)
return (0);
}
if (tqflags & TQ_FRONT) {
t->task_next = tq->tq_task.task_next;
t->task_prev = &tq->tq_task;
t->tqent_next = tq->tq_task.tqent_next;
t->tqent_prev = &tq->tq_task;
} else {
t->task_next = &tq->tq_task;
t->task_prev = tq->tq_task.task_prev;
t->tqent_next = &tq->tq_task;
t->tqent_prev = tq->tq_task.tqent_prev;
}
t->task_next->task_prev = t;
t->task_prev->task_next = t;
t->task_func = func;
t->task_arg = arg;
t->tqent_next->tqent_prev = t;
t->tqent_prev->tqent_next = t;
t->tqent_func = func;
t->tqent_arg = arg;
cv_signal(&tq->tq_dispatch_cv);
mutex_exit(&tq->tq_lock);
return (1);
}
void
taskq_dispatch_ent(taskq_t *tq, task_func_t func, void *arg, uint_t flags,
taskq_ent_t *t)
{
ASSERT(func != NULL);
ASSERT(!(tq->tq_flags & TASKQ_DYNAMIC));
/*
* Mark it as a prealloc'd task. This is important
* to ensure that we don't free it later.
*/
t->tqent_flags |= TQENT_FLAG_PREALLOC;
/*
* Enqueue the task to the underlying queue.
*/
mutex_enter(&tq->tq_lock);
if (flags & TQ_FRONT) {
t->tqent_next = tq->tq_task.tqent_next;
t->tqent_prev = &tq->tq_task;
} else {
t->tqent_next = &tq->tq_task;
t->tqent_prev = tq->tq_task.tqent_prev;
}
t->tqent_next->tqent_prev = t;
t->tqent_prev->tqent_next = t;
t->tqent_func = func;
t->tqent_arg = arg;
cv_signal(&tq->tq_dispatch_cv);
mutex_exit(&tq->tq_lock);
}
void
taskq_wait(taskq_t *tq)
{
mutex_enter(&tq->tq_lock);
while (tq->tq_task.task_next != &tq->tq_task || tq->tq_active != 0)
while (tq->tq_task.tqent_next != &tq->tq_task || tq->tq_active != 0)
cv_wait(&tq->tq_wait_cv, &tq->tq_lock);
mutex_exit(&tq->tq_lock);
}
@ -158,27 +186,32 @@ static void *
taskq_thread(void *arg)
{
taskq_t *tq = arg;
task_t *t;
taskq_ent_t *t;
boolean_t prealloc;
mutex_enter(&tq->tq_lock);
while (tq->tq_flags & TASKQ_ACTIVE) {
if ((t = tq->tq_task.task_next) == &tq->tq_task) {
if ((t = tq->tq_task.tqent_next) == &tq->tq_task) {
if (--tq->tq_active == 0)
cv_broadcast(&tq->tq_wait_cv);
cv_wait(&tq->tq_dispatch_cv, &tq->tq_lock);
tq->tq_active++;
continue;
}
t->task_prev->task_next = t->task_next;
t->task_next->task_prev = t->task_prev;
t->tqent_prev->tqent_next = t->tqent_next;
t->tqent_next->tqent_prev = t->tqent_prev;
t->tqent_next = NULL;
t->tqent_prev = NULL;
prealloc = t->tqent_flags & TQENT_FLAG_PREALLOC;
mutex_exit(&tq->tq_lock);
rw_enter(&tq->tq_threadlock, RW_READER);
t->task_func(t->task_arg);
t->tqent_func(t->tqent_arg);
rw_exit(&tq->tq_threadlock);
mutex_enter(&tq->tq_lock);
task_free(tq, t);
if (!prealloc)
task_free(tq, t);
}
tq->tq_nthreads--;
cv_broadcast(&tq->tq_wait_cv);
@ -217,8 +250,8 @@ taskq_create(const char *name, int nthreads, pri_t pri,
tq->tq_nthreads = nthreads;
tq->tq_minalloc = minalloc;
tq->tq_maxalloc = maxalloc;
tq->tq_task.task_next = &tq->tq_task;
tq->tq_task.task_prev = &tq->tq_task;
tq->tq_task.tqent_next = &tq->tq_task;
tq->tq_task.tqent_prev = &tq->tq_task;
tq->tq_threadlist = kmem_alloc(nthreads * sizeof (thread_t), KM_SLEEP);
if (flags & TASKQ_PREPOPULATE) {

View File

@ -57,7 +57,8 @@ translator psinfo_t < struct proc *T > {
pr_gid = T->p_ucred->cr_rgid;
pr_egid = T->p_ucred->cr_groups[0];
pr_addr = 0;
pr_psargs = stringof(T->p_args->ar_args);
pr_psargs = (T->p_args->ar_args == 0) ? "" :
memstr(T->p_args->ar_args, ' ', T->p_args->ar_length);
pr_arglen = T->p_args->ar_length;
pr_jailid = T->p_ucred->cr_prison->pr_id;
};

View File

@ -21,4 +21,13 @@ CFLAGS+= -I${.CURDIR}/../../../sys
CFLAGS+= -I${.CURDIR}/../../../cddl/contrib/opensolaris/head
CFLAGS+= -I${.CURDIR}/../../../cddl/compat/opensolaris/lib/libumem
# This library uses macros to define fprintf behavior for several object types
# The compiler will see the non-string literal arguments to the fprintf calls and
# omit warnings for them. Quiesce these warnings in contrib code:
#
# cddl/contrib/opensolaris/lib/libnvpair/libnvpair.c:743:12: warning: format
# string is not a string literal (potentially insecure) [-Wformat-security]
# ARENDER(pctl, nvlist_array, nvl, name, val, nelem);
#
CFLAGS+= -Wno-format-security
.include <bsd.lib.mk>

View File

@ -3,7 +3,6 @@
.PATH: ${.CURDIR}/../../../cddl/contrib/opensolaris/cmd/lockstat
PROG= lockstat
NO_MAN=
SRCS= lockstat.c sym.c
BINDIR?= /usr/sbin

View File

@ -1,4 +1,23 @@
-*- coding: utf-8 -*-
Changes with APR-util 1.5.3
*) Cygwin: Use correct file extension when loading APR DSOs. PR 55587.
[Carlo Bramini <carlo.bramix libero.it>]
*) Add experimental cmake-based build system for Windows. Refer to
README.cmake for more information. [Jeff Trawick, Tom Donovan]
*) Fix warnings in odbc driver on 64bit systems.
PR 55197 [Tom Donovan]
*) Add support to apr_memcache for unix domain sockets. PR 54573 [Remi
Gacogne <rgacogne+asf aquaray.com>]
*) Add support for Berkeley DB 6.0. [Rainer Jung]
*) Improve platform detection for bundled expat by updating
config.guess and config.sub. [Rainer Jung]
Changes with APR-util 1.5.2
*) Windows: Add command line makefiles. [Gregg Smith]

View File

@ -3,7 +3,7 @@
Summary: Apache Portable Runtime Utility library
Name: apr-util
Version: 1.5.2
Version: 1.5.3
Release: 1
License: Apache Software License
Group: System Environment/Libraries

View File

@ -1440,7 +1440,7 @@ Optional Packages:
--with-ldap-lib=path path to ldap lib file
--with-ldap=library ldap library to use
--with-dbm=DBM choose the DBM type to use.
DBM={sdbm,gdbm,ndbm,db,db1,db185,db2,db3,db4,db4X,db5X}
DBM={sdbm,gdbm,ndbm,db,db1,db185,db2,db3,db4,db4X,db5X,db6X}
for some X=0,...,9
--with-gdbm=DIR enable GDBM support
--with-ndbm=PATH Find the NDBM header and library in `PATH/include'
@ -11218,8 +11218,10 @@ fi
fi
test ${apu_has_ldap} != "1" && as_fn_error $? "could not find an LDAP library" "$LINENO" 5
test ${apu_has_ldap} == "1" &&
if test ${apu_has_ldap} != "1"; then
as_fn_error $? "could not find an LDAP library" "$LINENO" 5
else
if test "x$LDADD_ldap" = "x"; then
test "x$silent" != "xyes" && echo " setting LDADD_ldap to \"$LDADD_ldap_found\""
LDADD_ldap="$LDADD_ldap_found"
@ -11240,6 +11242,7 @@ fi
done
fi
fi
as_ac_Lib=`$as_echo "ac_cv_lib_$apu_liblber_name''_ber_init" | $as_tr_sh`
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ber_init in -l$apu_liblber_name" >&5
$as_echo_n "checking for ber_init in -l$apu_liblber_name... " >&6; }
@ -11617,6 +11620,7 @@ fi
dbm_list="$dbm_list, db$db_version"
db_version=`expr $db_version + 1`
done
dbm_list="$dbm_list, db60"
# Check whether --with-dbm was given.
@ -15708,7 +15712,7 @@ fi
as_fn_error $? "Berkeley db3 not found" "$LINENO" 5
fi
;;
db[45][0-9])
db[456][0-9])
db_major=`echo "$requested" | sed -e 's/db//' -e 's/.$//'`
db_minor=`echo "$requested" | sed -e 's/db//' -e 's/.//'`
@ -16113,7 +16117,7 @@ fi
as_fn_error $? "Berkeley db$db_major not found" "$LINENO" 5
fi
;;
db[45])
db[456])
db_major=`echo "$requested" | sed -e 's/db//'`
# Start version search at version x.9
db_minor=9
@ -18561,11 +18565,11 @@ fi
eval "apu_use_$requested=1"
apu_default_dbm=$requested
;;
db185 | db[12345])
db185 | db[123456])
apu_use_db=1
apu_default_dbm=$requested
;;
db[45][0-9])
db[456][0-9])
apu_use_db=1
apu_default_dbm=`echo $requested | sed -e 's/.$//'`
;;

View File

@ -100,7 +100,9 @@ APU_DECLARE(apr_status_t) apr_crypto_init(apr_pool_t *pool)
}
/* Top level pool scope, need process-scope lifetime */
for (parent = pool; parent; parent = apr_pool_parent_get(pool))
for (parent = apr_pool_parent_get(pool);
parent && parent != pool;
parent = apr_pool_parent_get(pool))
pool = parent;
#if APU_DSO_BUILD
/* deprecate in 2.0 - permit implicit initialization */
@ -176,7 +178,7 @@ APU_DECLARE(apr_status_t) apr_crypto_get_driver(
#if defined(NETWARE)
apr_snprintf(modname, sizeof(modname), "crypto%s.nlm", name);
#elif defined(WIN32)
#elif defined(WIN32) || defined(__CYGWIN__)
apr_snprintf(modname, sizeof(modname),
"apr_crypto_%s-" APU_STRINGIFY(APU_MAJOR_VERSION) ".dll", name);
#else

View File

@ -102,8 +102,10 @@ APU_DECLARE(apr_status_t) apr_dbd_init(apr_pool_t *pool)
}
/* Top level pool scope, need process-scope lifetime */
for (parent = pool; parent; parent = apr_pool_parent_get(pool))
pool = parent;
for (parent = apr_pool_parent_get(pool);
parent && parent != pool;
parent = apr_pool_parent_get(pool))
pool = parent;
#if APU_DSO_BUILD
/* deprecate in 2.0 - permit implicit initialization */
apu_dso_init(pool);
@ -184,7 +186,7 @@ APU_DECLARE(apr_status_t) apr_dbd_get_driver(apr_pool_t *pool, const char *name,
#if defined(NETWARE)
apr_snprintf(modname, sizeof(modname), "dbd%s.nlm", name);
#elif defined(WIN32)
#elif defined(WIN32) || defined(__CYGWIN__)
apr_snprintf(modname, sizeof(modname),
"apr_dbd_%s-" APU_STRINGIFY(APU_MAJOR_VERSION) ".dll", name);
#else
@ -204,7 +206,7 @@ APU_DECLARE(apr_status_t) apr_dbd_get_driver(apr_pool_t *pool, const char *name,
}
apu_dso_mutex_unlock();
#else /* not builtin and !APR_HAS_DSO => not implemented */
#else /* not builtin and !APU_DSO_BUILD => not implemented */
rv = APR_ENOTIMPL;
#endif

View File

@ -114,9 +114,9 @@ struct apr_dbd_t
char lastError[MAX_ERROR_STRING];
int defaultBufferSize; /* used for CLOBs in text mode,
* and when fld size is indeterminate */
int transaction_mode;
int dboptions; /* driver options re SQLGetData */
int default_transaction_mode;
intptr_t transaction_mode;
intptr_t dboptions; /* driver options re SQLGetData */
intptr_t default_transaction_mode;
int can_commit; /* controls end_trans behavior */
};
@ -359,7 +359,7 @@ static SQLRETURN odbc_set_result_column(int icol, apr_dbd_results_t *res,
SQLHANDLE stmt)
{
SQLRETURN rc;
int maxsize, textsize, realsize, type, isunsigned = 1;
intptr_t maxsize, textsize, realsize, type, isunsigned = 1;
/* discover the sql type */
rc = SQLColAttribute(stmt, icol + 1, SQL_DESC_UNSIGNED, NULL, 0, NULL,
@ -409,7 +409,7 @@ static SQLRETURN odbc_set_result_column(int icol, apr_dbd_results_t *res,
type = SQL_C_CHAR;
}
res->coltypes[icol] = type;
res->coltypes[icol] = (SQLSMALLINT)type;
/* size if retrieved as text */
rc = SQLColAttribute(stmt, icol + 1, SQL_DESC_DISPLAY_SIZE, NULL, 0,
@ -441,12 +441,12 @@ static SQLRETURN odbc_set_result_column(int icol, apr_dbd_results_t *res,
res->colptrs[icol] = NULL;
res->colstate[icol] = COL_AVAIL;
res->colsizes[icol] = maxsize;
res->colsizes[icol] = (SQLINTEGER)maxsize;
rc = SQL_SUCCESS;
}
else {
res->colptrs[icol] = apr_pcalloc(res->pool, maxsize);
res->colsizes[icol] = maxsize;
res->colsizes[icol] = (SQLINTEGER)maxsize;
if (res->apr_dbd->dboptions & SQL_GD_BOUND) {
/* we are allowed to call SQLGetData if we need to */
rc = SQLBindCol(stmt, icol + 1, res->coltypes[icol],
@ -747,7 +747,7 @@ static void *odbc_get(const apr_dbd_row_t *row, const int col,
SQLRETURN rc;
SQLLEN indicator;
int state = row->res->colstate[col];
int options = row->res->apr_dbd->dboptions;
intptr_t options = row->res->apr_dbd->dboptions;
switch (state) {
case (COL_UNAVAIL):
@ -817,13 +817,13 @@ static apr_status_t odbc_parse_params(apr_pool_t *pool, const char *params,
int *connect, SQLCHAR **datasource,
SQLCHAR **user, SQLCHAR **password,
int *defaultBufferSize, int *nattrs,
int **attrs, int **attrvals)
int **attrs, intptr_t **attrvals)
{
char *seps, *last, *next, *name[MAX_PARAMS], *val[MAX_PARAMS];
int nparams = 0, i, j;
*attrs = apr_pcalloc(pool, MAX_PARAMS * sizeof(char *));
*attrvals = apr_pcalloc(pool, MAX_PARAMS * sizeof(int));
*attrvals = apr_pcalloc(pool, MAX_PARAMS * sizeof(intptr_t));
*nattrs = 0;
seps = DEFAULTSEPS;
name[nparams] = apr_strtok(apr_pstrdup(pool, params), seps, &last);
@ -1062,7 +1062,8 @@ static apr_dbd_t *odbc_open(apr_pool_t *pool, const char *params, const char **e
SQLHANDLE err_h = NULL;
SQLCHAR *datasource = (SQLCHAR *)"", *user = (SQLCHAR *)"",
*password = (SQLCHAR *)"";
int nattrs = 0, *attrs = NULL, *attrvals = NULL, connect = 0;
int nattrs = 0, *attrs = NULL, connect = 0;
intptr_t *attrvals = NULL;
err_step = "SQLAllocHandle (SQL_HANDLE_DBC)";
err_htype = SQL_HANDLE_ENV;
@ -1116,10 +1117,10 @@ static apr_dbd_t *odbc_open(apr_pool_t *pool, const char *params, const char **e
handle->default_transaction_mode = 0;
handle->can_commit = APR_DBD_TRANSACTION_IGNORE_ERRORS;
SQLGetInfo(hdbc, SQL_DEFAULT_TXN_ISOLATION,
&(handle->default_transaction_mode), sizeof(int), NULL);
&(handle->default_transaction_mode), sizeof(intptr_t), NULL);
handle->transaction_mode = handle->default_transaction_mode;
SQLGetInfo(hdbc, SQL_GETDATA_EXTENSIONS ,&(handle->dboptions),
sizeof(int), NULL);
sizeof(intptr_t), NULL);
apr_pool_cleanup_register(pool, handle, odbc_close_cleanup, apr_pool_cleanup_null);
return handle;
}

View File

@ -129,8 +129,10 @@ static apr_status_t dbm_open_type(apr_dbm_type_t const* * vtable,
apr_pool_t *parent;
/* Top level pool scope, need process-scope lifetime */
for (parent = pool; parent; parent = apr_pool_parent_get(pool))
pool = parent;
for (parent = apr_pool_parent_get(pool);
parent && parent != pool;
parent = apr_pool_parent_get(pool))
pool = parent;
/* deprecate in 2.0 - permit implicit initialization */
apu_dso_init(pool);
@ -162,7 +164,7 @@ static apr_status_t dbm_open_type(apr_dbm_type_t const* * vtable,
#if defined(NETWARE)
apr_snprintf(modname, sizeof(modname), "dbm%s.nlm", type);
#elif defined(WIN32)
#elif defined(WIN32) || defined (__CYGWIN__)
apr_snprintf(modname, sizeof(modname),
"apr_dbm_%s-" APU_STRINGIFY(APU_MAJOR_VERSION) ".dll", type);
#else

View File

@ -351,9 +351,9 @@ typedef apr_status_t (*apr_brigade_flush)(apr_bucket_brigade *bb, void *ctx);
#define APR_BRIGADE_LAST(b) APR_RING_LAST(&(b)->list)
/**
* Insert a list of buckets at the front of a brigade
* Insert a single bucket at the front of a brigade
* @param b The brigade to add to
* @param e The first bucket in a list of buckets to insert
* @param e The bucket to insert
*/
#define APR_BRIGADE_INSERT_HEAD(b, e) do { \
apr_bucket *ap__b = (e); \
@ -362,9 +362,9 @@ typedef apr_status_t (*apr_brigade_flush)(apr_bucket_brigade *bb, void *ctx);
} while (0)
/**
* Insert a list of buckets at the end of a brigade
* Insert a single bucket at the end of a brigade
* @param b The brigade to add to
* @param e The first bucket in a list of buckets to insert
* @param e The bucket to insert
*/
#define APR_BRIGADE_INSERT_TAIL(b, e) do { \
apr_bucket *ap__b = (e); \
@ -393,9 +393,9 @@ typedef apr_status_t (*apr_brigade_flush)(apr_bucket_brigade *bb, void *ctx);
} while (0)
/**
* Insert a list of buckets before a specified bucket
* Insert a single bucket before a specified bucket
* @param a The bucket to insert before
* @param b The buckets to insert
* @param b The bucket to insert
*/
#define APR_BUCKET_INSERT_BEFORE(a, b) do { \
apr_bucket *ap__a = (a), *ap__b = (b); \
@ -404,9 +404,9 @@ typedef apr_status_t (*apr_brigade_flush)(apr_bucket_brigade *bb, void *ctx);
} while (0)
/**
* Insert a list of buckets after a specified bucket
* Insert a single bucket after a specified bucket
* @param a The bucket to insert after
* @param b The buckets to insert
* @param b The bucket to insert
*/
#define APR_BUCKET_INSERT_AFTER(a, b) do { \
apr_bucket *ap__a = (a), *ap__b = (b); \

View File

@ -107,10 +107,10 @@ APU_DECLARE(apr_status_t) apr_dbd_get_driver(apr_pool_t *pool, const char *name,
/** apr_dbd_open_ex: open a connection to a backend
*
* @param driver - driver struct.
* @param pool - working pool
* @param params - arguments to driver (implementation-dependent)
* @param handle - pointer to handle to return
* @param driver - driver struct.
* @param error - descriptive error.
* @return APR_SUCCESS for success
* @return APR_EGENERAL if driver exists but connection failed
@ -147,10 +147,10 @@ APU_DECLARE(apr_status_t) apr_dbd_open_ex(const apr_dbd_driver_t *driver,
/** apr_dbd_open: open a connection to a backend
*
* @param driver - driver struct.
* @param pool - working pool
* @param params - arguments to driver (implementation-dependent)
* @param handle - pointer to handle to return
* @param driver - driver struct.
* @return APR_SUCCESS for success
* @return APR_EGENERAL if driver exists but connection failed
* @see apr_dbd_open_ex
@ -161,8 +161,8 @@ APU_DECLARE(apr_status_t) apr_dbd_open(const apr_dbd_driver_t *driver,
/** apr_dbd_close: close a connection to a backend
*
* @param handle - handle to close
* @param driver - driver struct.
* @param handle - handle to close
* @return APR_SUCCESS for success or error status
*/
APU_DECLARE(apr_status_t) apr_dbd_close(const apr_dbd_driver_t *driver,

View File

@ -313,24 +313,24 @@ APU_DECLARE_DATA extern apr_pool_t *apr_hook_global_pool;
/**
* A global variable to determine if debugging information about the
* hooks functions should be printed
* hooks functions should be printed.
*/
APU_DECLARE_DATA extern int apr_hook_debug_enabled;
/**
* The name of the module that is currently registering a function
* The name of the module that is currently registering a function.
*/
APU_DECLARE_DATA extern const char *apr_hook_debug_current;
/**
* Register a hook function to be sorted
* Register a hook function to be sorted.
* @param szHookName The name of the Hook the function is registered for
* @param aHooks The array which stores all of the functions for this hook
*/
APU_DECLARE(void) apr_hook_sort_register(const char *szHookName,
apr_array_header_t **aHooks);
/**
* Sort all of the registerd functions for a given hook
* Sort all of the registered functions for a given hook.
*/
APU_DECLARE(void) apr_hook_sort_all(void);

View File

@ -33,11 +33,11 @@ extern "C" {
* @{
*/
/**
* Function to implemnt the APR_OPTIONAL_HOOK Macro
* Function to implement the APR_OPTIONAL_HOOK Macro
* @internal
* @see APR_OPTIONAL_HOOK
*
* @param name The name of the hook
* @param szName The name of the hook
* @param pfn A pointer to a function that will be called
* @param aszPre a NULL-terminated array of strings that name modules whose hooks should precede this one
* @param aszSucc a NULL-terminated array of strings that name modules whose hooks should succeed this one

View File

@ -22,7 +22,7 @@
* @brief Thread Safe FIFO bounded queue
* @note Since most implementations of the queue are backed by a condition
* variable implementation, it isn't available on systems without threads.
* Although condition variables are some times available without threads.
* Although condition variables are sometimes available without threads.
*/
#include "apu.h"

View File

@ -44,7 +44,7 @@ typedef struct apr_reslist_t apr_reslist_t;
/* Generic constructor called by resource list when it needs to create a
* resource.
* @param resource opaque resource
* @param param flags
* @param params flags
* @param pool Pool
*/
typedef apr_status_t (*apr_reslist_constructor)(void **resource, void *params,
@ -53,7 +53,7 @@ typedef apr_status_t (*apr_reslist_constructor)(void **resource, void *params,
/* Generic destructor called by resource list when it needs to destroy a
* resource.
* @param resource opaque resource
* @param param flags
* @param params flags
* @param pool Pool
*/
typedef apr_status_t (*apr_reslist_destructor)(void *resource, void *params,
@ -111,12 +111,17 @@ APU_DECLARE(apr_status_t) apr_reslist_destroy(apr_reslist_t *reslist);
* Retrieve a resource from the list, creating a new one if necessary.
* If we have met our maximum number of resources, we will block
* until one becomes available.
* @param reslist The resource list.
* @param resource An address where the pointer to the resource
* will be stored.
*/
APU_DECLARE(apr_status_t) apr_reslist_acquire(apr_reslist_t *reslist,
void **resource);
/**
* Return a resource back to the list of available resources.
* @param reslist The resource list.
* @param resource The resource to return to the list.
*/
APU_DECLARE(apr_status_t) apr_reslist_release(apr_reslist_t *reslist,
void *resource);
@ -140,6 +145,8 @@ APU_DECLARE(apr_uint32_t) apr_reslist_acquired_count(apr_reslist_t *reslist);
* Invalidate a resource in the pool - e.g. a database connection
* that returns a "lost connection" error and can't be restored.
* Use this instead of apr_reslist_release if the resource is bad.
* @param reslist The resource list.
* @param resource The resource to invalidate.
*/
APU_DECLARE(apr_status_t) apr_reslist_invalidate(apr_reslist_t *reslist,
void *resource);

View File

@ -42,6 +42,12 @@
* conventions at compile time.
*/
/* Make sure we have our platform identifier macro defined we ask for later.
*/
#if defined(_WIN32) && !defined(WIN32)
#define WIN32 1
#endif
#if defined(DOXYGEN) || !defined(WIN32)
/**
* The public APR-UTIL functions are declared with APU_DECLARE(), so they may

View File

@ -38,6 +38,9 @@
*/
#define APU_COPYRIGHT "Copyright (c) 2013 The Apache Software " \
"Foundation or its licensors, as applicable."
/* The numeric compile-time version constants. These constants are the
* authoritative version numbers for APU.
*/
@ -59,7 +62,7 @@
* The Patch Level never includes API changes, simply bug fixes.
* Reset to 0 when upgrading APR_MINOR_VERSION
*/
#define APU_PATCH_VERSION 2
#define APU_PATCH_VERSION 3
/**
* The symbol APU_IS_DEV_VERSION is only defined for internal,
@ -71,7 +74,9 @@
#if defined(APU_IS_DEV_VERSION) || defined(DOXYGEN)
/** Internal: string form of the "is dev" flag */
#ifndef APU_IS_DEV_STRING
#define APU_IS_DEV_STRING "-dev"
#endif
#else
#define APU_IS_DEV_STRING ""
#endif

View File

@ -1,8 +1,5 @@
#include "apu_version.h"
#define APU_COPYRIGHT "Copyright (c) 2011 The Apache Software " \
"Foundation or its licensors, as applicable."
#define APU_LICENSE \
"Licensed to the Apache Software Foundation (ASF) under one or more " \
"contributor license agreements. See the NOTICE file distributed with " \

View File

@ -181,7 +181,7 @@ apr_memcache_find_server_hash_default(void *baton, apr_memcache_t *mc,
#if APR_HAS_THREADS
apr_thread_mutex_lock(ms->lock);
#endif
/* Try the the dead server, every 5 seconds */
/* Try the dead server, every 5 seconds */
if (curtime - ms->btime > apr_time_from_sec(5)) {
ms->btime = curtime;
if (mc_version_ping(ms) == APR_SUCCESS) {
@ -289,8 +289,13 @@ static apr_status_t conn_connect(apr_memcache_conn_t *conn)
{
apr_status_t rv = APR_SUCCESS;
apr_sockaddr_t *sa;
#if APR_HAVE_SOCKADDR_UN
apr_int32_t family = conn->ms->host[0] != '/' ? APR_INET : APR_UNIX;
#else
apr_int32_t family = APR_INET;
#endif
rv = apr_sockaddr_info_get(&sa, conn->ms->host, APR_INET, conn->ms->port, 0, conn->p);
rv = apr_sockaddr_info_get(&sa, conn->ms->host, family, conn->ms->port, 0, conn->p);
if (rv != APR_SUCCESS) {
return rv;
}
@ -322,6 +327,11 @@ mc_conn_construct(void **conn_, void *params, apr_pool_t *pool)
apr_pool_t *np;
apr_pool_t *tp;
apr_memcache_server_t *ms = params;
#if APR_HAVE_SOCKADDR_UN
apr_int32_t family = ms->host[0] != '/' ? APR_INET : APR_UNIX;
#else
apr_int32_t family = APR_INET;
#endif
rv = apr_pool_create(&np, pool);
if (rv != APR_SUCCESS) {
@ -339,7 +349,7 @@ mc_conn_construct(void **conn_, void *params, apr_pool_t *pool)
conn->p = np;
conn->tp = tp;
rv = apr_socket_create(&conn->sock, APR_INET, SOCK_STREAM, 0, np);
rv = apr_socket_create(&conn->sock, family, SOCK_STREAM, 0, np);
if (rv != APR_SUCCESS) {
apr_pool_destroy(np);

View File

@ -75,7 +75,6 @@ static apr_status_t apu_dso_term(void *ptr)
apr_status_t apu_dso_init(apr_pool_t *pool)
{
apr_status_t ret = APR_SUCCESS;
apr_pool_t *global;
apr_pool_t *parent;
if (apr_atomic_inc32(&initialised)) {
@ -88,17 +87,19 @@ apr_status_t apu_dso_init(apr_pool_t *pool)
}
/* Top level pool scope, need process-scope lifetime */
for (parent = global = pool; parent; parent = apr_pool_parent_get(global))
global = parent;
for (parent = apr_pool_parent_get(pool);
parent && parent != pool;
parent = apr_pool_parent_get(pool))
pool = parent;
dsos = apr_hash_make(global);
dsos = apr_hash_make(pool);
#if APR_HAS_THREADS
ret = apr_thread_mutex_create(&mutex, APR_THREAD_MUTEX_DEFAULT, global);
ret = apr_thread_mutex_create(&mutex, APR_THREAD_MUTEX_DEFAULT, pool);
/* This already registers a pool cleanup */
#endif
apr_pool_cleanup_register(global, NULL, apu_dso_term,
apr_pool_cleanup_register(pool, NULL, apu_dso_term,
apr_pool_cleanup_null);
apr_atomic_dec32(&in_init);

View File

@ -106,6 +106,9 @@ abts_suite *abts_add_suite(abts_suite *suite, const char *suite_name_full)
/* suite_name_full may be an absolute path depending on __FILE__
* expansion */
suite_name = strrchr(suite_name_full, '/');
if (!suite_name) {
suite_name = strrchr(suite_name_full, '\\');
}
if (suite_name) {
suite_name++;
} else {
@ -247,7 +250,8 @@ void abts_int_nequal(abts_case *tc, const int expected, const int actual, int li
tc->failed = TRUE;
if (verbose) {
fprintf(stderr, "Line %d: expected <%d>, but saw <%d>\n", lineno, expected, actual);
fprintf(stderr, "Line %d: expected something other than <%d>, but saw <%d>\n",
lineno, expected, actual);
fflush(stderr);
}
}
@ -279,7 +283,8 @@ void abts_str_nequal(abts_case *tc, const char *expected, const char *actual,
tc->failed = TRUE;
if (verbose) {
fprintf(stderr, "Line %d: expected <%s>, but saw <%s>\n", lineno, expected, actual);
fprintf(stderr, "Line %d: expected something other than <%s>, but saw <%s>\n",
lineno, expected, actual);
fflush(stderr);
}
}

View File

@ -14,7 +14,6 @@
* limitations under the License.
*/
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>

View File

@ -1,240 +0,0 @@
/* 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.
*/
/*
* testssl: Simple APR SSL sockets test.
*/
#include "apr.h"
#include "apr_general.h"
#include "apr_pools.h"
#include "apr_errno.h"
#include "apr_getopt.h"
#include "apr_time.h"
#define APR_WANT_STRFUNC
#include "apr_want.h"
#include "apr_ssl.h"
#include "apr_network_io.h"
#if APR_HAVE_STDIO_H
#include <stdio.h>
#endif
#if APR_HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <stdlib.h> /* for atexit(), malloc() */
#include <string.h>
struct sslTestCase {
char *host;
int port;
const char *request;
int result;
} tests[] = {
{ "svn.apache.org", 443, "GET / HTTP/1.0\n\n", 1 },
{ NULL }
};
static apr_ssl_socket_t *createSocket(apr_ssl_factory_t *asf,
apr_pollset_t *pollset,
apr_pool_t *pool, int blocking)
{
apr_ssl_socket_t *sock;
apr_status_t rv;
printf("::Creating SSL socket\n");
rv = apr_ssl_socket_create(&sock, AF_INET, SOCK_STREAM, 0, asf, NULL);
if (rv != APR_SUCCESS) {
printf("\tFailed to create socket\n");
return NULL;
}
rv = apr_pollset_add_ssl_socket(pollset, sock);
if (rv != APR_SUCCESS) {
printf("\tFailed to add to pollset\n");
return NULL;
}
printf("\tOK\n");
return sock;
}
static apr_status_t connectSocket(apr_ssl_socket_t *sock,
const char *host, int port,
apr_pool_t *pool)
{
apr_status_t rv;
apr_sockaddr_t *remoteSA;
printf("::Connecting socket\n");
rv = apr_sockaddr_info_get(&remoteSA, host, APR_UNSPEC, port, 0, pool);
if (rv != APR_SUCCESS) {
printf("\tFailed to get address for '%s', port %d\n", host, port);
return rv;
}
rv = apr_ssl_socket_connect(sock, remoteSA);
if (rv != APR_SUCCESS) {
printf("\tFailed to connect to '%s' port %d\n", host, port);
return rv;
}
printf("\tOK\n");
return rv;
}
static apr_status_t socketRead(apr_ssl_socket_t *sock,
apr_pollset_t *pollset,
char *buf, apr_size_t *len)
{
int lrv;
const apr_pollfd_t *descs = NULL;
apr_status_t rv;
printf("::Reading from socket\n");
rv = apr_ssl_socket_set_poll_events(sock, APR_POLLIN);
if (rv != APR_SUCCESS) {
printf("\tUnable to change socket poll events!\n");
return rv;
}
rv = apr_pollset_poll(pollset, 30 * APR_USEC_PER_SEC, &lrv, &descs);
if (APR_STATUS_IS_TIMEUP(rv)) {
printf("\tTime up!\n");
return rv;
}
if (lrv != 1) {
printf("\tIncorrect return count, %d\n", lrv);
return rv;
}
if (descs[0].client_data != sock) {
printf("\tWrong socket returned?!\n");
return rv;
}
if ((descs[0].rtnevents & APR_POLLIN) == 0) {
printf("\tSocket wasn't ready? huh? req [%08x] vs rtn [%08x]\n",
descs[0].reqevents, descs[0].rtnevents);
return rv;
}
rv = apr_ssl_socket_recv(sock, buf, len);
if (rv == APR_SUCCESS)
printf("\tOK, read %d bytes\n", *len);
else
printf("\tFailed\n");
return rv;
}
static apr_status_t socketWrite(apr_ssl_socket_t *sock,
apr_pollset_t *pollset,
const char *buf, apr_size_t *len)
{
int lrv;
const apr_pollfd_t *descs = NULL;
apr_status_t rv;
printf("::Writing to socket\n");
rv = apr_ssl_socket_set_poll_events(sock, APR_POLLOUT);
if (rv != APR_SUCCESS) {
printf("\tUnable to change socket poll events!\n");
return rv;
}
rv = apr_pollset_poll(pollset, 30 * APR_USEC_PER_SEC, &lrv, &descs);
if (APR_STATUS_IS_TIMEUP(rv)) {
printf("\tTime up!\n");
return rv;
}
if (lrv != 1) {
printf("\tIncorrect return count, %d\n", lrv);
return rv;
}
if (descs[0].client_data != sock) {
printf("\tWrong socket returned?!\n");
return rv;
}
if ((descs[0].rtnevents & APR_POLLOUT) == 0) {
printf("\tSocket wasn't ready? huh?\n");
return rv;
}
rv = apr_ssl_socket_send(sock, buf, len);
if (rv == APR_SUCCESS)
printf("\tOK, wrote %d bytes\n", *len);
else
printf("\tFailed\n");
return rv;
}
apr_status_t socketClose(apr_ssl_socket_t *sock, apr_pollset_t *pollset)
{
apr_status_t rv;
printf("::Closing socket\n");
rv = apr_pollset_remove_ssl_socket(sock);
if (rv != APR_SUCCESS)
printf("\tUnable to remove socket from pollset?\n");
rv = apr_ssl_socket_close(sock);
if (rv != APR_SUCCESS)
printf("\tFailed to close SSL socket\n");
else
printf("\tOK\n");
return rv;
}
int main(int argc, const char * const * argv)
{
apr_pool_t *pool;
apr_ssl_factory_t *asf = NULL;
apr_status_t rv;
apr_pollset_t *pollset;
(void) apr_initialize();
apr_pool_create(&pool, NULL);
atexit(apr_terminate);
printf("SSL Library: %s\n", apr_ssl_library_name());
if (apr_pollset_create(&pollset, 1, pool, 0) != APR_SUCCESS) {
printf("Failed to create pollset!\n");
exit(1);
}
if (apr_ssl_factory_create(&asf, NULL, NULL, NULL,
APR_SSL_FACTORY_CLIENT, pool) != APR_SUCCESS) {
fprintf(stderr, "Unable to create client factory\n");
} else {
int i;
for(i = 0; tests[i].host; i++) {
apr_ssl_socket_t *sslSock = createSocket(asf, pollset, pool, 0);
if (!sslSock)
continue;
rv = connectSocket(sslSock, tests[i].host, tests[i].port, pool);
if (rv == APR_SUCCESS) {
apr_size_t len = strlen(tests[i].request);
rv = socketWrite(sslSock, pollset, tests[i].request, &len);
if (rv == APR_SUCCESS) {
char buffer[4096];
len = 4096;
rv = socketRead(sslSock, pollset, buffer, &len);
}
}
socketClose(sslSock, pollset);
}
}
apr_pollset_destroy(pollset);
apr_pool_destroy(pool);
return 0;
}

View File

@ -1,12 +0,0 @@
Content-Type: application/X-atf-atffile; version="1"
prop: test-suite = atf
tp: atf-c
tp: atf-c++
tp: atf-sh
tp: test-programs
tp-glob: atf-config*
tp-glob: atf-report*
tp-glob: atf-run*

View File

@ -1,8 +1,21 @@
*/*/Atffile
*/*/Makefile*
*/Atffile
*/Makefile*
Atffile
INSTALL
Makefile*
aclocal.m4
admin/
atf-*/atf-*.m4
atf-*/atf-*.pc.in
atf-config/
atf-report/
atf-run/
atf-version/
bconfig.h.in
bootstrap/
config.log
config.status
libtool
Makefile
stamp-h1
*/*/.deps/
*/.deps/
configure*
doc/atf-formats.5
doc/atf.7.in
m4/

View File

@ -1,28 +1,48 @@
$FreeBSD$
atf
This document contains a collection of notes specific to the import
of atf into head. These notes are built on the instructions in
the FreeBSD Subversion Primer that detail how to deal with vendor
branches and you are supposed to follow those:
The source code is hosted on GoogleCode as a subcomponent of the Kyua project:
http://www.freebsd.org/doc/en/articles/committers-guide/subversion-primer.html
The ATF source code is hosted on Google Code as a subcomponent of the
Kyua project:
http://code.google.com/p/kyua/downloads/list
For the contrib directory, the sources were initially prepared like so:
and is imported into the atf vendor branch (see base/vendor/atf/).
./configure --prefix=/ --exec-prefix=/usr --datarootdir=/usr/share
To merge the vendor branch into head do something like this:
For the contrib directory, files and directories were pruned by:
cd .../base/head/contrib/atf
svn merge --accept=postpone \
svn+ssh://svn.freebsd.org/base/vendor/atf/dist .
svn remove --force $(cat FREEBSD-Xlist)
sh -c 'for F in `cat FREEBSD-Xlist`; do rm -rf ./$F ; done'
and resolve any conflicts that may arise at this point.
You may check if there are any new files that we don't need.
Once this is done, you must regenerate bconfig.h. The recommended way
of doing so is by using the release files already imported into the
vendor branch (which is a good justification for importing the verbatim
sources in the first place so that this step is reproducible). You can
use a set of commands similar to the following:
The instructions for importing new release and merging to HEAD can be found
at FreeBSD wiki:
mkdir /tmp/atf
cd /tmp/atf
.../vendor/atf/dist/configure \
--prefix=/ \
--exec-prefix=/usr \
--datarootdir=/usr/share
cp bconfig.h .../base/head/contrib/atf/
http://wiki.freebsd.org/SubversionPrimer/VendorImports
Please do NOT run './configure' straight from the 'dist' directory of
the vendor branch as you easily risk committing build products into the
tree.
To make local changes to atf, simply patch and commit to the trunk
branch (aka HEAD). Never make local changes on the vendor branch.
Lastly, with the list of old and new files in this import, make sure
to udpate the reachover Makefiles accordingly.
gcooper@FreeBSD.org
5-August-2012
Test the build (keeping in mind the WITH_TESTS/WITHOUT_TESTS knobs) and,
if all looks good, you are ready to commit all the changes in one go.

View File

@ -1,151 +0,0 @@
#
# Automated Testing Framework (atf)
#
# Copyright (c) 2007 The NetBSD Foundation, Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND
# CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
# IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
# GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
atf_aclocal_DATA =
BUILT_SOURCES =
CLEANFILES =
EXTRA_DIST =
bin_PROGRAMS =
dist_man_MANS =
include_HEADERS =
lib_LTLIBRARIES =
libexec_PROGRAMS =
man_MANS =
noinst_DATA =
noinst_LTLIBRARIES =
INSTALLCHECK_TARGETS =
PHONY_TARGETS =
ACLOCAL_AMFLAGS = -I m4
AM_DISTCHECK_CONFIGURE_FLAGS = --enable-tools
include admin/Makefile.am.inc
include atf-c/Makefile.am.inc
include atf-c++/Makefile.am.inc
include atf-sh/Makefile.am.inc
include bootstrap/Makefile.am.inc
include doc/Makefile.am.inc
include test-programs/Makefile.am.inc
if ENABLE_TOOLS
include atf-report/Makefile.am.inc
include atf-config/Makefile.am.inc
include atf-run/Makefile.am.inc
include atf-version/Makefile.am.inc
endif
#
# Top-level distfile documents.
#
doc_DATA = AUTHORS COPYING NEWS README
noinst_DATA += INSTALL README
EXTRA_DIST += $(doc_DATA) INSTALL README
#
# Supporting logic to run our custom testsuite.
#
TESTS_ENVIRONMENT = PATH=$(prefix)/bin:$${PATH} \
PKG_CONFIG_PATH=$(prefix)/lib/pkgconfig
testsdir = $(exec_prefix)/tests
pkgtestsdir = $(testsdir)/$(PACKAGE)
if ENABLE_TOOLS
INSTALLCHECK_TARGETS += installcheck-atf
PHONY_TARGETS += installcheck-atf
installcheck-atf:
logfile=$$(pwd)/installcheck.log; \
fifofile=$$(pwd)/installcheck.fifo; \
cd $(pkgtestsdir); \
rm -f $${fifofile}; \
mkfifo $${fifofile}; \
cat $${fifofile} | tee $${logfile} | $(TESTS_ENVIRONMENT) atf-report & \
$(TESTS_ENVIRONMENT) atf-run >>$${fifofile}; \
res=$${?}; \
wait; \
rm $${fifofile}; \
echo; \
echo "The verbatim output of atf-run has been saved to" \
"installcheck.log; exit was $${res}"; \
test $${res} -eq 0
CLEANFILES += installcheck.fifo installcheck.log
endif
PHONY_TARGETS += installcheck-kyua
if HAVE_KYUA
installcheck-kyua:
cd $(pkgtestsdir) && $(TESTS_ENVIRONMENT) $(KYUA) test
endif
installcheck-targets: $(INSTALLCHECK_TARGETS)
pkgtests_DATA = Kyuafile
if ENABLE_TOOLS
pkgtests_DATA += Atffile
endif
EXTRA_DIST += $(pkgtests_DATA)
BUILD_SH_TP = \
echo "Creating $${dst}"; \
echo "\#! $(bindir)/atf-sh" >$${dst}; \
cat $${src} >>$${dst}; \
chmod +x $${dst}
#
# Custom targets.
#
dist-hook: forbid-dist
if ENABLE_TOOLS
forbid-dist:
@true
else
forbid-dist:
@echo "Sorry; cannot make dist without the tools enabled."
@echo "Please reconfigure with --enable-tools."
@false
endif
PHONY_TARGETS += clean-all
clean-all:
GIT="$(GIT)" $(SH) $(srcdir)/admin/clean-all.sh
PHONY_TARGETS += release
release:
$(SH) $(srcdir)/admin/release.sh $(PACKAGE_VERSION) $(DIST_ARCHIVES)
PHONY_TARGETS += release-test
release-test:
$(SH) $(srcdir)/admin/release-test.sh $(DIST_ARCHIVES)
.PHONY: $(PHONY_TARGETS)
# vim: syntax=make:noexpandtab:shiftwidth=8:softtabstop=8

File diff suppressed because it is too large Load Diff

View File

@ -2,6 +2,58 @@ Major changes between releases Automated Testing Framework
===========================================================================
Changes in version 0.18
***********************
Experimental version released on November 16th, 2013.
* Issue 45: Added require.memory support in atf-run for FreeBSD.
* Fixed an issue with the handling of cin with libc++.
* Issue 64: Fixed various mandoc formatting warnings.
* NetBSD PR bin/48284: Made atf-check flush its progress message to
stdout so that an interrupted test case always shows the last message
being executed.
* NetBSD PR bin/48285: Fixed atf_check examples in atf-sh-api(3).
Changes in version 0.17
***********************
Experimental version released on February 14th, 2013.
* Added the atf_utils_cat_file, atf_utils_compare_file,
atf_utils_copy_file, atf_utils_create_file, atf_utils_file_exists,
atf_utils_fork, atf_utils_grep_file, atf_utils_grep_string,
atf_utils_readline, atf_utils_redirect and atf_utils_wait utility
functions to atf-c-api. Documented the already-public
atf_utils_free_charpp function.
* Added the cat_file, compare_file, copy_file, create_file, file_exists,
fork, grep_collection, grep_file, grep_string, redirect and wait
functions to the atf::utils namespace of atf-c++-api. These are
wrappers around the same functions added to the atf-c-api library.
* Added the ATF_CHECK_MATCH, ATF_CHECK_MATCH_MSG, ATF_REQUIRE_MATCH and
ATF_REQUIRE_MATCH_MSG macros to atf-c to simplify the validation of a
string against a regular expression.
* Miscellaneous fixes for manpage typos and compilation problems with
clang.
* Added caching of the results of those configure tests that rely on
executing a test program. This should help crossbuild systems by
providing a mechanism to pre-specify what the results should be.
* PR bin/45690: Make atf-report convert any non-printable characters to
a plain-text representation (matching their corresponding hexadecimal
entities) in XML output files. This is to prevent the output of test
cases from breaking xsltproc later.
Changes in version 0.16
***********************

View File

@ -1,48 +0,0 @@
#
# Automated Testing Framework (atf)
#
# Copyright (c) 2007 The NetBSD Foundation, Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND
# CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
# IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
# GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
dist-hook: check-install
PHONY_TARGETS += check-install
check-install: $(srcdir)/INSTALL
$(srcdir)/admin/check-install.sh $(srcdir)/INSTALL
dist-hook: check-style
PHONY_TARGETS += check-style
check-style:
$(srcdir)/admin/check-style.sh
EXTRA_DIST += admin/check-install.sh \
admin/check-style-common.awk \
admin/check-style-c.awk \
admin/check-style-cpp.awk \
admin/check-style-man.awk \
admin/check-style-shell.awk \
admin/check-style.sh
# vim: syntax=make:noexpandtab:shiftwidth=8:softtabstop=8

View File

@ -1,92 +0,0 @@
#! /bin/sh
#
# Automated Testing Framework (atf)
#
# Copyright (c) 2007 The NetBSD Foundation, Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND
# CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
# IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
# GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
#
# A utility to ensure that INSTALL lists the correct versions of the
# tools used to generate the distfile.
#
Prog_Name=${0##*/}
#
# err message
#
err() {
echo "${Prog_Name}: ${@}" 1>&2
exit 1
}
#
# warn message
#
warn() {
echo "${Prog_Name}: ${@}" 1>&2
}
#
# check_tool readme_file prog_name verbose_name
#
# Executes 'prog_name' to determine its version and checks if the
# given 'readme_file' contains 'verbose_name <version>' in it.
#
check_tool() {
readme=${1}
prog=${2}
name=${3}
ver=$(${prog} --version | head -n 1 | cut -d ' ' -f 4)
if grep "\\* ${name} ${ver}" ${readme} >/dev/null; then
true
else
warn "Incorrect version of ${name}"
false
fi
}
#
# main readme_file
#
# Entry point.
#
main() {
readme=${1}
ret=0
check_tool ${readme} autoconf "GNU autoconf" || ret=1
check_tool ${readme} automake "GNU automake" || ret=1
check_tool ${readme} libtool "GNU libtool" || ret=1
return ${ret}
}
main "${@}"
# vim: syntax=sh:expandtab:shiftwidth=4:softtabstop=4

View File

@ -1,94 +0,0 @@
#
# Automated Testing Framework (atf)
#
# Copyright (c) 2007 The NetBSD Foundation, Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND
# CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
# IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
# GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
function warn(msg) {
print FILENAME "[" FNR "]: " msg > "/dev/stderr"
error = 1
}
BEGIN {
skip = 0
error = 0
}
/NO_CHECK_STYLE_BEGIN/ {
skip = 1
next
}
/NO_CHECK_STYLE_END/ {
skip = 0
next
}
/NO_CHECK_STYLE/ {
next
}
{
if (skip)
next
}
/#ifdef/ {
warn("Undesired usage of #ifdef; use #if defined()")
}
/#ifndef/ {
warn("Undesired usage of #ifndef; use #if !defined()")
}
/assert[ \t]*\(/ {
warn("Use the macros in sanity.h instead of assert");
}
/getprogname/ {
warn("getprogname(3) is not portable");
}
/include.*assert.h/ {
warn("Do not include assert.h");
}
/setprogname/ {
warn("setprogname(3) is not portable");
}
/\/\// {
warn("Do not use C99-style comments");
}
END {
if (skip)
warn("Missing NO_CHECK_STYLE_END");
if (error)
exit 1
}
# vim: syntax=awk:expandtab:shiftwidth=4:softtabstop=4

View File

@ -1,82 +0,0 @@
#
# Automated Testing Framework (atf)
#
# Copyright (c) 2007 The NetBSD Foundation, Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND
# CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
# IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
# GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
function warn(msg) {
print FILENAME "[" FNR "]: " msg > "/dev/stderr"
error = 1
}
BEGIN {
skip = 0
error = 0
}
/NO_CHECK_STYLE_BEGIN/ {
skip = 1
next
}
/NO_CHECK_STYLE_END/ {
skip = 0
next
}
/NO_CHECK_STYLE/ {
next
}
{
if (skip)
next
if (length > 80)
warn("Line too long to fit on screen")
}
/^ *\t+/ {
if (! match(FILENAME, "Makefile"))
warn("Tab character used for indentation");
}
/[ \t]+$/ {
warn("Trailing spaces or tabs");
}
/#![^ ]/ { # NO_CHECK_STYLE
warn("Invalid shellbang: missing space after !");
}
END {
if (skip)
warn("Missing NO_CHECK_STYLE_END");
if (error)
exit 1
}
# vim: syntax=awk:expandtab:shiftwidth=4:softtabstop=4

View File

@ -1,90 +0,0 @@
#
# Automated Testing Framework (atf)
#
# Copyright (c) 2007 The NetBSD Foundation, Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND
# CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
# IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
# GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
function warn(msg) {
print FILENAME "[" FNR "]: " msg > "/dev/stderr"
error = 1
}
BEGIN {
skip = 0
error = 0
}
/NO_CHECK_STYLE_BEGIN/ {
skip = 1
next
}
/NO_CHECK_STYLE_END/ {
skip = 0
next
}
/NO_CHECK_STYLE/ {
next
}
{
if (skip)
next
}
/#ifdef/ {
warn("Undesired usage of #ifdef; use #if defined()")
}
/#ifndef/ {
warn("Undesired usage of #ifndef; use #if !defined()")
}
/assert[ \t]*\(/ {
warn("Use the macros in sanity.hpp instead of assert");
}
/include.*assert/ {
warn("Do not include assert.h nor cassert");
}
/std::endl/ {
warn("Use \\n instead of std::endl");
}
/\/\*/ {
warn("Do not use C-style comments");
}
END {
if (skip)
warn("Missing NO_CHECK_STYLE_END");
if (error)
exit 1
}
# vim: syntax=awk:expandtab:shiftwidth=4:softtabstop=4

View File

@ -1,78 +0,0 @@
#
# Automated Testing Framework (atf)
#
# Copyright (c) 2007 The NetBSD Foundation, Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND
# CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
# IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
# GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
function warn(msg) {
print FILENAME "[" FNR "]: " msg > "/dev/stderr"
error = 1
}
BEGIN {
skip = 0
error = 0
}
/NO_CHECK_STYLE_BEGIN|^\.Bd/ {
skip = 1
next
}
/NO_CHECK_STYLE_END|^\.Ed/ {
skip = 0
next
}
/NO_CHECK_STYLE/ {
next
}
/^\.\\"/ {
next
}
{
if (skip)
next
}
/\.\.|e\.g\.|i\.e\./ {
next
}
/\.[ ]+[a-zA-Z]+/ {
warn("Sentence does not start on new line")
}
END {
if (skip)
warn("Missing NO_CHECK_STYLE_END");
if (error)
exit 1
}
# vim: syntax=awk:expandtab:shiftwidth=4:softtabstop=4

View File

@ -1,106 +0,0 @@
#
# Automated Testing Framework (atf)
#
# Copyright (c) 2007 The NetBSD Foundation, Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND
# CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
# IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
# GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
function warn(msg) {
print FILENAME "[" FNR "]: " msg > "/dev/stderr"
error = 1
}
BEGIN {
skip = 0
error = 0
emacs_modeline = 0
vim_modeline = 0
}
/NO_CHECK_STYLE_BEGIN/ {
skip = 1
next
}
/NO_CHECK_STYLE_END/ {
skip = 0
next
}
/NO_CHECK_STYLE/ {
next
}
{
if (skip)
next
}
/vim: syntax=sh/ {
vim_modeline = 1
}
/^[ \t]*#/ {
next
}
/[$ \t]+_[a-zA-Z0-9]+=/ {
warn("Variable should not start with an underline")
}
/[^\\]\$[^0-9!'"$?@#*{}(|\/,]+/ {
warn("Missing braces around variable name")
}
/=(""|'')/ {
warn("Assignment to the empty string does not need quotes");
}
/basename[ \t]+/ {
warn("Use parameter expansion instead of basename");
}
/if[ \t]+(test|![ \t]+test)/ {
warn("Use [ instead of test");
}
/[ \t]+(test|\[).*==/ {
warn("test(1)'s == operator is not portable");
}
/if.*;[ \t]*fi$/ {
warn("Avoid using a single-line if conditional");
}
END {
if (skip)
warn("Missing NO_CHECK_STYLE_END");
if (! vim_modeline)
warn("Missing mode lines");
if (error)
exit 1
}
# vim: syntax=awk:expandtab:shiftwidth=4:softtabstop=4

View File

@ -1,189 +0,0 @@
#! /bin/sh
#
# Automated Testing Framework (atf)
#
# Copyright (c) 2007 The NetBSD Foundation, Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND
# CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
# IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
# GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
#
# A utility to sanity check the coding style of all source files in the
# project tree.
#
Prog_Name=${0##*/}
#
# err message
#
err() {
echo "${Prog_Name}: ${@}" 1>&2
exit 1
}
#
# warn message
#
warn() {
echo "${Prog_Name}: ${@}" 1>&2
}
#
# guess_topdir
#
# Locates the project's top directory and prints its path. The caller
# must verify if the result is correct or not.
#
guess_topdir() {
olddir=$(pwd)
topdir=$(pwd)
while [ ${topdir} != / ]; do
if [ -f ./atf-c.h ]; then
break
else
cd ..
topdir=$(pwd)
fi
done
cd ${olddir}
echo ${topdir}
}
#
# find_sources
#
# Locates all source files within the project, relative to the current
# directory, and prints their paths.
#
find_sources() {
find . \( -name "AUTHORS" -o \
-name "COPYING" -o \
-name "ChangeLog" -o \
-name "NEWS" -o \
-name "README" -o \
-name "TODO" -o \
-name "*.[0-9]" -o \
-name "*.ac" -o \
-name "*.at" -o \
-name "*.awk" -o \
-name "*.c" -o \
-name "*.cpp" -o \
-name "*.h" -o \
-name "*.h.in" -o \
-name "*.hpp" -o \
-name "*.m4" -o \
-name "*.sh" \
\) -a \( \
\! -path "*/atf-[0-9]*" -a \
\! -path "*autom4te*" -a \
-type f -a \
\! -name "aclocal.m4" \
\! -name "bconfig.h" \
\! -name "defs.h" \
\! -name "libtool.m4" \
\! -name "ltoptions.m4" \
\! -name "ltsugar.m4" \
\! -name "lt~obsolete.m4" \
\! -name "*.so.*" \
\)
}
#
# guess_formats file
#
# Guesses the formats applicable to the given file and prints the resulting
# list.
#
guess_formats() {
case ${1} in
*/ltmain.sh)
;;
*.[0-9])
echo common man
;;
*.c|*.h)
echo common c
;;
*.cpp|*.hpp)
echo common cpp
;;
*.sh)
echo common shell
;;
*)
echo common
;;
esac
}
#
# check_file file
#
# Checks the validity of the given file.
#
check_file() {
err=0
for format in $(guess_formats ${1}); do
awk -f ${topdir}/admin/check-style-${format}.awk ${1} || err=1
done
return ${err}
}
#
# main [file list]
#
# Entry point.
#
main() {
topdir=$(guess_topdir)
if [ ! -f ${topdir}/atf-c.h ]; then
err "Could not locate the project's top directory"
fi
if [ ${#} -gt 0 ]; then
sources=${@}
else
cd ${topdir}
sources=$(find_sources)
fi
ok=0
for file in ${sources}; do
file=$(echo ${file} | sed -e "s,\\./,,")
if [ ! -f ${file} ]; then
err "Could not open ${file}"
else
check_file ${file} || ok=1
fi
done
return ${ok}
}
main "${@}"
# vim: syntax=sh:expandtab:shiftwidth=4:softtabstop=4

View File

@ -1,310 +0,0 @@
#! /bin/sh
# Wrapper for compilers which do not understand '-c -o'.
scriptversion=2012-01-04.17; # UTC
# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2009, 2010, 2012 Free
# Software Foundation, Inc.
# Written by Tom Tromey <tromey@cygnus.com>.
#
# 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 <http://www.gnu.org/licenses/>.
# 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.
# This file is maintained in Automake, please report
# bugs to <bug-automake@gnu.org> or send patches to
# <automake-patches@gnu.org>.
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_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*)
func_file_conv "${1#-I}" mingw
set x "$@" -I"$file"
shift
;;
-l*)
lib=${1#-l}
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
set x "$@" "$dir/$lib.dll.lib"
break
fi
if test -f "$dir/$lib.lib"; then
found=yes
set x "$@" "$dir/$lib.lib"
break
fi
done
IFS=$save_IFS
test "$found" != yes && set x "$@" "$lib.lib"
shift
;;
-L*)
func_file_conv "${1#-L}"
if test -z "$lib_path"; then
lib_path=$file
else
lib_path="$lib_path;$file"
fi
linker_opts="$linker_opts -LIBPATH:$file"
;;
-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
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
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'.
Report bugs to <bug-automake@gnu.org>.
EOF
exit $?
;;
-v | --v*)
echo "compile $scriptversion"
exit $?
;;
cl | *[/\\]cl | cl.exe | *[/\\]cl.exe )
func_cl_wrapper "$@" # Doesn't return...
;;
esac
ofile=
cfile=
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'.
# So we strip '-o arg' only if arg is an object.
eat=1
case $2 in
*.o | *.obj)
ofile=$2
;;
*)
set x "$@" -o "$2"
shift
;;
esac
;;
*.c)
cfile=$1
set x "$@" "$1"
shift
;;
*)
set x "$@" "$1"
shift
;;
esac
fi
shift
done
if test -z "$ofile" || test -z "$cfile"; then
# 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
# ok.
exec "$@"
fi
# Name of file we expect compiler to create.
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
# 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
while true; do
if mkdir "$lockdir" >/dev/null 2>&1; then
break
fi
sleep 1
done
# FIXME: race condition here if user kills between mkdir and trap.
trap "rmdir '$lockdir'; exit 1" 1 2 15
# Run the compile.
"$@"
ret=$?
if test -f "$cofile"; then
test "$cofile" = "$ofile" || mv "$cofile" "$ofile"
elif test -f "${cofile}bj"; then
test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile"
fi
rmdir "$lockdir"
exit $ret
# 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:

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,688 +0,0 @@
#! /bin/sh
# depcomp - compile a program generating dependencies as side-effects
scriptversion=2011-12-04.11; # UTC
# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009, 2010,
# 2011 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 <http://www.gnu.org/licenses/>.
# 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 <oliva@dcc.unicamp.br>.
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 <bug-automake@gnu.org>.
EOF
exit $?
;;
-v | --v*)
echo "depcomp $scriptversion"
exit $?
;;
esac
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"
# 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
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 -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
mv "$tmpdepfile" "$depfile"
;;
gcc)
## 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).
## - 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 -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
echo "$object : \\" > "$depfile"
alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
## 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.
tr ' ' '
' < "$tmpdepfile" |
## 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.
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 -eq 0; then :
else
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 ' ' '
' < "$tmpdepfile" \
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
tr '
' ' ' >> "$depfile"
echo >> "$depfile"
# The second pass generates a dummy entry for each header file.
tr ' ' '
' < "$tmpdepfile" \
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
>> "$depfile"
else
# The sourcefile does not contain any dependencies, so just
# store a dummy comment line, to avoid errors with the Makefile
# "include basename.Plo" scheme.
echo "#dummy" > "$depfile"
fi
rm -f "$tmpdepfile"
;;
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.
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
test "x$dir" = "x$object" && dir=
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
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 -eq 0; then :
else
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
exit $stat
fi
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
do
test -f "$tmpdepfile" && break
done
if test -f "$tmpdepfile"; then
# Each line is of the form `foo.o: dependent.h'.
# Do two passes, one to just change these to
# `$object: dependent.h' and one to simply `dependent.h:'.
sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
# That's a tab and a space in the [].
sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
else
# The sourcefile does not contain any dependencies, so just
# store a dummy comment line, to avoid errors with the Makefile
# "include basename.Plo" scheme.
echo "#dummy" > "$depfile"
fi
rm -f "$tmpdepfile"
;;
icc)
# Intel's C compiler understands `-MD -MF file'. However on
# icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c
# ICC 7.0 will fill foo.d with something like
# foo.o: sub/foo.c
# foo.o: sub/foo.h
# which is wrong. We want:
# sub/foo.o: sub/foo.c
# sub/foo.o: sub/foo.h
# sub/foo.c:
# sub/foo.h:
# ICC 7.1 will output
# foo.o: sub/foo.c sub/foo.h
# and will wrap long lines using \ :
# foo.o: sub/foo.c ... \
# sub/foo.h ... \
# ...
"$@" -MD -MF "$tmpdepfile"
stat=$?
if test $stat -eq 0; then :
else
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.
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
test "x$dir" = "x$object" && dir=
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
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 -eq 0; then :
else
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,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile"
# Add `dependent.h:' lines.
sed -ne '2,${
s/^ *//
s/ \\*$//
s/$/:/
p
}' "$tmpdepfile" >> "$depfile"
else
echo "#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.
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
test "x$dir" = "x$object" && dir=
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
if test "$libtool" = yes; then
# With Tru64 cc, shared objects can also be used to make a
# static library. This mechanism is used in libtool 1.4 series to
# handle both shared and static libraries in a single compilation.
# With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d.
#
# With libtool 1.5 this exception was removed, and libtool now
# 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.libs/$base.lo.d # libtool 1.4
tmpdepfile2=$dir$base.o.d # libtool 1.5
tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5
tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504
"$@" -Wc,-MD
else
tmpdepfile1=$dir$base.o.d
tmpdepfile2=$dir$base.d
tmpdepfile3=$dir$base.d
tmpdepfile4=$dir$base.d
"$@" -MD
fi
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
exit $stat
fi
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
do
test -f "$tmpdepfile" && break
done
if test -f "$tmpdepfile"; then
sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
# That's a tab and a space in the [].
sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
else
echo "#dummy" > "$depfile"
fi
rm -f "$tmpdepfile"
;;
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" = 0; then :
else
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/\(.*\)/ \1 \\/p
s/.\(.*\) \\/\1:/
H
$ {
s/.*/ /
G
p
}' >> "$depfile"
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:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile"
rm -f "$depfile"
cat < "$tmpdepfile" > "$depfile"
tr ' ' '
' < "$tmpdepfile" | \
## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly. Breaking it into two sed invocations is a workaround.
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"
sed '1,2d' "$tmpdepfile" | tr ' ' '
' | \
## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly. Breaking it into two sed invocations is a workaround.
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:: \1 \\:p' >> "$depfile"
echo " " >> "$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:

View File

@ -1,527 +0,0 @@
#!/bin/sh
# install - install a program, script, or datafile
scriptversion=2011-01-19.21; # UTC
# This originates from X11R5 (mit/util/scripts/install.sh), which was
# later released in X11R6 (xc/config/util/install.sh) with the
# following copyright and license.
#
# Copyright (C) 1994 X Consortium
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
# sell copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
# Except as contained in this notice, the name of the X Consortium shall not
# be used in advertising or otherwise to promote the sale, use or other deal-
# ings in this Software without prior written authorization from the X Consor-
# tium.
#
#
# 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
# when there is no Makefile.
#
# This script is compatible with the BSD install script, but was written
# from scratch.
nl='
'
IFS=" "" $nl"
# set DOITPROG to echo to test this script
# Don't use :- since 4.3BSD and earlier shells don't like it.
doit=${DOITPROG-}
if test -z "$doit"; then
doit_exec=exec
else
doit_exec=$doit
fi
# Put in absolute file names if you don't have them in your path;
# or use environment vars.
chgrpprog=${CHGRPPROG-chgrp}
chmodprog=${CHMODPROG-chmod}
chownprog=${CHOWNPROG-chown}
cmpprog=${CMPPROG-cmp}
cpprog=${CPPROG-cp}
mkdirprog=${MKDIRPROG-mkdir}
mvprog=${MVPROG-mv}
rmprog=${RMPROG-rm}
stripprog=${STRIPPROG-strip}
posix_glob='?'
initialize_posix_glob='
test "$posix_glob" != "?" || {
if (set -f) 2>/dev/null; then
posix_glob=
else
posix_glob=:
fi
}
'
posix_mkdir=
# Desired mode of installed file.
mode=0755
chgrpcmd=
chmodcmd=$chmodprog
chowncmd=
mvcmd=$mvprog
rmcmd="$rmprog -f"
stripcmd=
src=
dst=
dir_arg=
dst_arg=
copy_on_change=false
no_target_directory=
usage="\
Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
or: $0 [OPTION]... SRCFILES... DIRECTORY
or: $0 [OPTION]... -t DIRECTORY SRCFILES...
or: $0 [OPTION]... -d DIRECTORIES...
In the 1st form, copy SRCFILE to DSTFILE.
In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
In the 4th, create DIRECTORIES.
Options:
--help display this help and exit.
--version display version info and exit.
-c (ignored)
-C install only if different (preserve the last data modification time)
-d create directories instead of installing files.
-g GROUP $chgrpprog installed files to GROUP.
-m MODE $chmodprog installed files to MODE.
-o USER $chownprog installed files to USER.
-s $stripprog installed files.
-t DIRECTORY install into DIRECTORY.
-T report an error if DSTFILE is a directory.
Environment variables override the default commands:
CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
RMPROG STRIPPROG
"
while test $# -ne 0; do
case $1 in
-c) ;;
-C) copy_on_change=true;;
-d) dir_arg=true;;
-g) chgrpcmd="$chgrpprog $2"
shift;;
--help) echo "$usage"; exit $?;;
-m) mode=$2
case $mode in
*' '* | *' '* | *'
'* | *'*'* | *'?'* | *'['*)
echo "$0: invalid mode: $mode" >&2
exit 1;;
esac
shift;;
-o) chowncmd="$chownprog $2"
shift;;
-s) stripcmd=$stripprog;;
-t) dst_arg=$2
# Protect names problematic for `test' and other utilities.
case $dst_arg in
-* | [=\(\)!]) dst_arg=./$dst_arg;;
esac
shift;;
-T) no_target_directory=true;;
--version) echo "$0 $scriptversion"; exit $?;;
--) shift
break;;
-*) echo "$0: invalid option: $1" >&2
exit 1;;
*) break;;
esac
shift
done
if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
# When -d is used, all remaining arguments are directories to create.
# When -t is used, the destination is already specified.
# Otherwise, the last argument is the destination. Remove it from $@.
for arg
do
if test -n "$dst_arg"; then
# $@ is not empty: it contains at least $arg.
set fnord "$@" "$dst_arg"
shift # fnord
fi
shift # arg
dst_arg=$arg
# Protect names problematic for `test' and other utilities.
case $dst_arg in
-* | [=\(\)!]) dst_arg=./$dst_arg;;
esac
done
fi
if test $# -eq 0; then
if test -z "$dir_arg"; then
echo "$0: no input file specified." >&2
exit 1
fi
# It's OK to call `install-sh -d' without argument.
# This can happen when creating conditional directories.
exit 0
fi
if test -z "$dir_arg"; then
do_exit='(exit $ret); exit $ret'
trap "ret=129; $do_exit" 1
trap "ret=130; $do_exit" 2
trap "ret=141; $do_exit" 13
trap "ret=143; $do_exit" 15
# Set umask so as not to create temps with too-generous modes.
# However, 'strip' requires both read and write access to temps.
case $mode in
# Optimize common cases.
*644) cp_umask=133;;
*755) cp_umask=22;;
*[0-7])
if test -z "$stripcmd"; then
u_plus_rw=
else
u_plus_rw='% 200'
fi
cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
*)
if test -z "$stripcmd"; then
u_plus_rw=
else
u_plus_rw=,u+rw
fi
cp_umask=$mode$u_plus_rw;;
esac
fi
for src
do
# Protect names problematic for `test' and other utilities.
case $src in
-* | [=\(\)!]) src=./$src;;
esac
if test -n "$dir_arg"; then
dst=$src
dstdir=$dst
test -d "$dstdir"
dstdir_status=$?
else
# Waiting for this to be detected by the "$cpprog $src $dsttmp" command
# might cause directories to be created, which would be especially bad
# if $src (and thus $dsttmp) contains '*'.
if test ! -f "$src" && test ! -d "$src"; then
echo "$0: $src does not exist." >&2
exit 1
fi
if test -z "$dst_arg"; then
echo "$0: no destination specified." >&2
exit 1
fi
dst=$dst_arg
# If destination is a directory, append the input filename; won't work
# if double slashes aren't ignored.
if test -d "$dst"; then
if test -n "$no_target_directory"; then
echo "$0: $dst_arg: Is a directory" >&2
exit 1
fi
dstdir=$dst
dst=$dstdir/`basename "$src"`
dstdir_status=0
else
# Prefer dirname, but fall back on a substitute if dirname fails.
dstdir=`
(dirname "$dst") 2>/dev/null ||
expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
X"$dst" : 'X\(//\)[^/]' \| \
X"$dst" : 'X\(//\)$' \| \
X"$dst" : 'X\(/\)' \| . 2>/dev/null ||
echo X"$dst" |
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
s//\1/
q
}
/^X\(\/\/\)[^/].*/{
s//\1/
q
}
/^X\(\/\/\)$/{
s//\1/
q
}
/^X\(\/\).*/{
s//\1/
q
}
s/.*/./; q'
`
test -d "$dstdir"
dstdir_status=$?
fi
fi
obsolete_mkdir_used=false
if test $dstdir_status != 0; then
case $posix_mkdir in
'')
# Create intermediate dirs using mode 755 as modified by the umask.
# This is like FreeBSD 'install' as of 1997-10-28.
umask=`umask`
case $stripcmd.$umask in
# Optimize common cases.
*[2367][2367]) mkdir_umask=$umask;;
.*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
*[0-7])
mkdir_umask=`expr $umask + 22 \
- $umask % 100 % 40 + $umask % 20 \
- $umask % 10 % 4 + $umask % 2
`;;
*) mkdir_umask=$umask,go-w;;
esac
# With -d, create the new directory with the user-specified mode.
# Otherwise, rely on $mkdir_umask.
if test -n "$dir_arg"; then
mkdir_mode=-m$mode
else
mkdir_mode=
fi
posix_mkdir=false
case $umask in
*[123567][0-7][0-7])
# POSIX mkdir -p sets u+wx bits regardless of umask, which
# is incompatible with FreeBSD 'install' when (umask & 300) != 0.
;;
*)
tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0
if (umask $mkdir_umask &&
exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1
then
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.
# FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
ls_ld_tmpdir=`ls -ld "$tmpdir"`
case $ls_ld_tmpdir in
d????-?r-*) different_mode=700;;
d????-?--*) different_mode=755;;
*) false;;
esac &&
$mkdirprog -m$different_mode -p -- "$tmpdir" && {
ls_ld_tmpdir_1=`ls -ld "$tmpdir"`
test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
}
}
then posix_mkdir=:
fi
rmdir "$tmpdir/d" "$tmpdir"
else
# Remove any dirs left behind by ancient mkdir implementations.
rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null
fi
trap '' 0;;
esac;;
esac
if
$posix_mkdir && (
umask $mkdir_umask &&
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
)
then :
else
# The umask is ridiculous, or mkdir does not conform to POSIX,
# or it failed possibly due to a race condition. Create the
# directory the slow way, step by step, checking for races as we go.
case $dstdir in
/*) prefix='/';;
[-=\(\)!]*) prefix='./';;
*) prefix='';;
esac
eval "$initialize_posix_glob"
oIFS=$IFS
IFS=/
$posix_glob set -f
set fnord $dstdir
shift
$posix_glob set +f
IFS=$oIFS
prefixes=
for d
do
test X"$d" = X && continue
prefix=$prefix$d
if test -d "$prefix"; then
prefixes=
else
if $posix_mkdir; then
(umask=$mkdir_umask &&
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
# Don't fail if two instances are running concurrently.
test -d "$prefix" || exit 1
else
case $prefix in
*\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
*) qprefix=$prefix;;
esac
prefixes="$prefixes '$qprefix'"
fi
fi
prefix=$prefix/
done
if test -n "$prefixes"; then
# Don't fail if two instances are running concurrently.
(umask $mkdir_umask &&
eval "\$doit_exec \$mkdirprog $prefixes") ||
test -d "$dstdir" || exit 1
obsolete_mkdir_used=true
fi
fi
fi
if test -n "$dir_arg"; then
{ test -z "$chowncmd" || $doit $chowncmd "$dst"; } &&
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } &&
{ test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false ||
test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1
else
# Make a couple of temp file names in the proper directory.
dsttmp=$dstdir/_inst.$$_
rmtmp=$dstdir/_rm.$$_
# Trap to clean up those temp files at exit.
trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
# Copy the file name to the temp name.
(umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") &&
# and set any options; do chmod last to preserve setuid bits.
#
# If any of these fail, we abort the whole thing. If we want to
# ignore errors from any of these, just make sure not to ignore
# errors from the above "$doit $cpprog $src $dsttmp" command.
#
{ test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } &&
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } &&
{ test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } &&
{ test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
# If -C, don't bother to copy if it wouldn't change the file.
if $copy_on_change &&
old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` &&
new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` &&
eval "$initialize_posix_glob" &&
$posix_glob set -f &&
set X $old && old=:$2:$4:$5:$6 &&
set X $new && new=:$2:$4:$5:$6 &&
$posix_glob set +f &&
test "$old" = "$new" &&
$cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
then
rm -f "$dsttmp"
else
# Rename the file to the real destination.
$doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null ||
# The rename failed, perhaps because mv can't rename something else
# to itself, or perhaps because mv is so ancient that it does not
# support -f.
{
# Now remove or move aside any old file at destination location.
# We try this two ways since rm can't unlink itself on some
# systems and the destination file might be busy for other
# reasons. In this case, the final cleanup might fail but the new
# file should still install successfully.
{
test ! -f "$dst" ||
$doit $rmcmd -f "$dst" 2>/dev/null ||
{ $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
{ $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
} ||
{ echo "$0: cannot unlink or rename $dst" >&2
(exit 1); exit 1
}
} &&
# Now rename the file to the real destination.
$doit $mvcmd "$dsttmp" "$dst"
}
fi || exit 1
trap '' 0
fi
done
# 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:

File diff suppressed because it is too large Load Diff

View File

@ -1,331 +0,0 @@
#! /bin/sh
# Common stub for a few missing GNU programs while installing.
scriptversion=2012-01-06.13; # UTC
# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006,
# 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 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 <http://www.gnu.org/licenses/>.
# 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
run=:
sed_output='s/.* --output[ =]\([^ ]*\).*/\1/p'
sed_minuso='s/.* -o \([^ ]*\).*/\1/p'
# In the cases where this matters, `missing' is being run in the
# srcdir already.
if test -f configure.ac; then
configure_ac=configure.ac
else
configure_ac=configure.in
fi
msg="missing on your system"
case $1 in
--run)
# Try to run requested program, and just exit if it succeeds.
run=
shift
"$@" && exit 0
# Exit code 63 means version mismatch. This often happens
# when the user try to use an ancient version of a tool on
# a file that requires a minimum version. In this case we
# we should proceed has if the program had been absent, or
# if --run hadn't been passed.
if test $? = 63; then
run=:
msg="probably too old"
fi
;;
-h|--h|--he|--hel|--help)
echo "\
$0 [OPTION]... PROGRAM [ARGUMENT]...
Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
error status if there is no known handling for PROGRAM.
Options:
-h, --help display this help and exit
-v, --version output version information and exit
--run try to run the given command, and emulate it if it fails
Supported PROGRAM values:
aclocal touch file \`aclocal.m4'
autoconf touch file \`configure'
autoheader touch file \`config.h.in'
autom4te touch the output file, or create a stub one
automake touch all \`Makefile.in' files
bison create \`y.tab.[ch]', if possible, from existing .[ch]
flex create \`lex.yy.c', if possible, from existing .c
help2man touch the output file
lex create \`lex.yy.c', if possible, from existing .c
makeinfo touch the output file
yacc create \`y.tab.[ch]', if possible, from existing .[ch]
Version suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and
\`g' are ignored when checking the name.
Send bug reports to <bug-automake@gnu.org>."
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
# normalize program name to check for.
program=`echo "$1" | sed '
s/^gnu-//; t
s/^gnu//; t
s/^g//; t'`
# Now exit if we have it, but it failed. Also exit now if we
# don't have it and --version was passed (most likely to detect
# the program). This is about non-GNU programs, so use $1 not
# $program.
case $1 in
lex*|yacc*)
# Not GNU programs, they don't have --version.
;;
*)
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
# We have it, but it failed.
exit 1
elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
# Could not run --version or --help. This is probably someone
# running `$TOOL --version' or `$TOOL --help' to check whether
# $TOOL exists and not knowing $TOOL uses missing.
exit 1
fi
;;
esac
# If it does not exist, or fails to run (possibly an outdated version),
# try to emulate it.
case $program in
aclocal*)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified \`acinclude.m4' or \`${configure_ac}'. You might want
to install the \`Automake' and \`Perl' packages. Grab them from
any GNU archive site."
touch aclocal.m4
;;
autoconf*)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified \`${configure_ac}'. You might want to install the
\`Autoconf' and \`GNU m4' packages. Grab them from any GNU
archive site."
touch configure
;;
autoheader*)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified \`acconfig.h' or \`${configure_ac}'. You might want
to install the \`Autoconf' and \`GNU m4' packages. Grab them
from any GNU archive site."
files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
test -z "$files" && files="config.h"
touch_files=
for f in $files; do
case $f in
*:*) touch_files="$touch_files "`echo "$f" |
sed -e 's/^[^:]*://' -e 's/:.*//'`;;
*) touch_files="$touch_files $f.in";;
esac
done
touch $touch_files
;;
automake*)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
You might want to install the \`Automake' and \`Perl' packages.
Grab them from any GNU archive site."
find . -type f -name Makefile.am -print |
sed 's/\.am$/.in/' |
while read f; do touch "$f"; done
;;
autom4te*)
echo 1>&2 "\
WARNING: \`$1' is needed, but is $msg.
You might have modified some files without having the
proper tools for further handling them.
You can get \`$1' as part of \`Autoconf' from any GNU
archive site."
file=`echo "$*" | sed -n "$sed_output"`
test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
if test -f "$file"; then
touch $file
else
test -z "$file" || exec >$file
echo "#! /bin/sh"
echo "# Created by GNU Automake missing as a replacement of"
echo "# $ $@"
echo "exit 0"
chmod +x $file
exit 1
fi
;;
bison*|yacc*)
echo 1>&2 "\
WARNING: \`$1' $msg. You should only need it if
you modified a \`.y' file. You may need the \`Bison' package
in order for those modifications to take effect. You can get
\`Bison' from any GNU archive site."
rm -f y.tab.c y.tab.h
if test $# -ne 1; then
eval LASTARG=\${$#}
case $LASTARG in
*.y)
SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
if test -f "$SRCFILE"; then
cp "$SRCFILE" y.tab.c
fi
SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
if test -f "$SRCFILE"; then
cp "$SRCFILE" y.tab.h
fi
;;
esac
fi
if test ! -f y.tab.h; then
echo >y.tab.h
fi
if test ! -f y.tab.c; then
echo 'main() { return 0; }' >y.tab.c
fi
;;
lex*|flex*)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified a \`.l' file. You may need the \`Flex' package
in order for those modifications to take effect. You can get
\`Flex' from any GNU archive site."
rm -f lex.yy.c
if test $# -ne 1; then
eval LASTARG=\${$#}
case $LASTARG in
*.l)
SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
if test -f "$SRCFILE"; then
cp "$SRCFILE" lex.yy.c
fi
;;
esac
fi
if test ! -f lex.yy.c; then
echo 'main() { return 0; }' >lex.yy.c
fi
;;
help2man*)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified a dependency of a manual page. You may need the
\`Help2man' package in order for those modifications to take
effect. You can get \`Help2man' from any GNU archive site."
file=`echo "$*" | sed -n "$sed_output"`
test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
if test -f "$file"; then
touch $file
else
test -z "$file" || exec >$file
echo ".ab help2man is required to generate this page"
exit $?
fi
;;
makeinfo*)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified a \`.texi' or \`.texinfo' file, or any other file
indirectly affecting the aspect of the manual. The spurious
call might also be the consequence of using a buggy \`make' (AIX,
DU, IRIX). You might want to install the \`Texinfo' package or
the \`GNU make' package. Grab either from any GNU archive site."
# The file to touch is that specified with -o ...
file=`echo "$*" | sed -n "$sed_output"`
test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
if test -z "$file"; then
# ... or it is the one specified with @setfilename ...
infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
file=`sed -n '
/^@setfilename/{
s/.* \([^ ]*\) *$/\1/
p
q
}' $infile`
# ... or it is derived from the source name (dir/f.texi becomes f.info)
test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info
fi
# If the file does not exist, the user really needs makeinfo;
# let's fail without touching anything.
test -f $file || exit 1
touch $file
;;
*)
echo 1>&2 "\
WARNING: \`$1' is needed, and is $msg.
You might have modified some files without having the
proper tools for further handling them. Check the \`README' file,
it often tells you about the needed prerequisites for installing
this package. You may also peek at any GNU archive site, in case
some other package would contain this missing \`$1' program."
exit 1
;;
esac
exit 0
# 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:

View File

@ -31,5 +31,6 @@
#define _ATF_CXX_HPP_
#include <atf-c++/macros.hpp>
#include <atf-c++/utils.hpp>
#endif // !defined(_ATF_CXX_HPP_)

View File

@ -1,14 +0,0 @@
Content-Type: application/X-atf-atffile; version="1"
prop: test-suite = atf
tp: detail
tp: atf_c++_test
tp: build_test
tp: check_test
tp: config_test
tp: macros_test
tp: pkg_config_test
tp: tests_test
tp: utils_test

View File

@ -1,111 +0,0 @@
#
# Automated Testing Framework (atf)
#
# Copyright (c) 2007 The NetBSD Foundation, Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND
# CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
# IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
# GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
ATF_CXX_LIBS = libatf-c++.la libatf-c.la
lib_LTLIBRARIES += libatf-c++.la
libatf_c___la_LIBADD = libatf-c.la
libatf_c___la_SOURCES = atf-c++/build.cpp \
atf-c++/build.hpp \
atf-c++/check.cpp \
atf-c++/check.hpp \
atf-c++/config.cpp \
atf-c++/config.hpp \
atf-c++/macros.hpp \
atf-c++/tests.cpp \
atf-c++/tests.hpp \
atf-c++/utils.hpp
libatf_c___la_LDFLAGS = -version-info 0:0:0
include_HEADERS += atf-c++.hpp
atf_c___HEADERS = atf-c++/build.hpp \
atf-c++/check.hpp \
atf-c++/config.hpp \
atf-c++/macros.hpp \
atf-c++/tests.hpp \
atf-c++/utils.hpp
atf_c__dir = $(includedir)/atf-c++
dist_man_MANS += atf-c++/atf-c++-api.3
atf_aclocal_DATA += atf-c++/atf-c++.m4
EXTRA_DIST += atf-c++/atf-c++.m4
atf_c__dirpkgconfigdir = $(atf_pkgconfigdir)
atf_c__dirpkgconfig_DATA = atf-c++/atf-c++.pc
CLEANFILES += atf-c++/atf-c++.pc
EXTRA_DIST += atf-c++/atf-c++.pc.in
atf-c++/atf-c++.pc: $(srcdir)/atf-c++/atf-c++.pc.in Makefile
test -d atf-c++ || mkdir -p atf-c++
sed -e 's#__ATF_VERSION__#$(PACKAGE_VERSION)#g' \
-e 's#__CXX__#$(CXX)#g' \
-e 's#__INCLUDEDIR__#$(includedir)#g' \
-e 's#__LIBDIR__#$(libdir)#g' \
<$(srcdir)/atf-c++/atf-c++.pc.in >atf-c++/atf-c++.pc.tmp
mv atf-c++/atf-c++.pc.tmp atf-c++/atf-c++.pc
tests_atf_c___DATA = atf-c++/Atffile \
atf-c++/Kyuafile \
atf-c++/macros_hpp_test.cpp \
atf-c++/unused_test.cpp
tests_atf_c__dir = $(pkgtestsdir)/atf-c++
EXTRA_DIST += $(tests_atf_c___DATA)
tests_atf_c___PROGRAMS = atf-c++/atf_c++_test
atf_c___atf_c___test_SOURCES = atf-c++/atf_c++_test.cpp
atf_c___atf_c___test_LDADD = atf-c++/detail/libtest_helpers.la $(ATF_CXX_LIBS)
tests_atf_c___PROGRAMS += atf-c++/build_test
atf_c___build_test_SOURCES = atf-c++/build_test.cpp atf-c/h_build.h
atf_c___build_test_LDADD = atf-c++/detail/libtest_helpers.la $(ATF_CXX_LIBS)
tests_atf_c___PROGRAMS += atf-c++/check_test
atf_c___check_test_SOURCES = atf-c++/check_test.cpp
atf_c___check_test_LDADD = atf-c++/detail/libtest_helpers.la $(ATF_CXX_LIBS)
tests_atf_c___PROGRAMS += atf-c++/config_test
atf_c___config_test_SOURCES = atf-c++/config_test.cpp
atf_c___config_test_LDADD = atf-c++/detail/libtest_helpers.la $(ATF_CXX_LIBS)
tests_atf_c___PROGRAMS += atf-c++/macros_test
atf_c___macros_test_SOURCES = atf-c++/macros_test.cpp
atf_c___macros_test_LDADD = atf-c++/detail/libtest_helpers.la $(ATF_CXX_LIBS)
tests_atf_c___SCRIPTS = atf-c++/pkg_config_test
CLEANFILES += atf-c++/pkg_config_test
EXTRA_DIST += atf-c++/pkg_config_test.sh
atf-c++/pkg_config_test: $(srcdir)/atf-c++/pkg_config_test.sh
test -d atf-c++ || mkdir -p atf-c++
@src="$(srcdir)/atf-c++/pkg_config_test.sh"; \
dst="atf-c++/pkg_config_test"; $(BUILD_SH_TP)
tests_atf_c___PROGRAMS += atf-c++/tests_test
atf_c___tests_test_SOURCES = atf-c++/tests_test.cpp
atf_c___tests_test_LDADD = atf-c++/detail/libtest_helpers.la $(ATF_CXX_LIBS)
tests_atf_c___PROGRAMS += atf-c++/utils_test
atf_c___utils_test_SOURCES = atf-c++/utils_test.cpp
atf_c___utils_test_LDADD = atf-c++/detail/libtest_helpers.la $(ATF_CXX_LIBS)
include atf-c++/detail/Makefile.am.inc
# vim: syntax=make:noexpandtab:shiftwidth=8:softtabstop=8

View File

@ -26,10 +26,11 @@
.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd January 21, 2012
.Dd November 15, 2013
.Dt ATF-C++-API 3
.Os
.Sh NAME
.Nm atf-c++-api ,
.Nm ATF_ADD_TEST_CASE ,
.Nm ATF_CHECK_ERRNO ,
.Nm ATF_FAIL ,
@ -52,6 +53,17 @@
.Nm ATF_TEST_CASE_USE ,
.Nm ATF_TEST_CASE_WITH_CLEANUP ,
.Nm ATF_TEST_CASE_WITHOUT_HEAD ,
.Nm atf::utils::cat_file ,
.Nm atf::utils::compare_file ,
.Nm atf::utils::copy_file ,
.Nm atf::utils::create_file ,
.Nm atf::utils::file_exists ,
.Nm atf::utils::fork ,
.Nm atf::utils::grep_collection ,
.Nm atf::utils::grep_file ,
.Nm atf::utils::grep_string ,
.Nm atf::utils::redirect ,
.Nm atf::utils::wait
.Nd C++ API to write ATF-based test programs
.Sh SYNOPSIS
.In atf-c++.hpp
@ -77,18 +89,64 @@
.Fn ATF_TEST_CASE_USE "name"
.Fn ATF_TEST_CASE_WITH_CLEANUP "name"
.Fn ATF_TEST_CASE_WITHOUT_HEAD "name"
.Ft void
.Fo atf::utils::cat_file
.Fa "const std::string& path"
.Fa "const std::string& prefix"
.Fc
.Ft bool
.Fo atf::utils::compare_file
.Fa "const std::string& path"
.Fa "const std::string& contents"
.Fc
.Ft void
.Fo atf::utils::copy_file
.Fa "const std::string& source"
.Fa "const std::string& destination"
.Fc
.Ft void
.Fo atf::utils::create_file
.Fa "const std::string& path"
.Fa "const std::string& contents"
.Fc
.Ft void
.Fo atf::utils::file_exists
.Fa "const std::string& path"
.Fc
.Ft pid_t
.Fo atf::utils::fork
.Fa "void"
.Fc
.Ft bool
.Fo atf::utils::grep_collection
.Fa "const std::string& regexp"
.Fa "const Collection& collection"
.Fc
.Ft bool
.Fo atf::utils::grep_file
.Fa "const std::string& regexp"
.Fa "const std::string& path"
.Fc
.Ft bool
.Fo atf::utils::grep_string
.Fa "const std::string& regexp"
.Fa "const std::string& path"
.Fc
.Ft void
.Fo atf::utils::redirect
.Fa "const int fd"
.Fa "const std::string& path"
.Fc
.Ft void
.Fo atf::utils::wait
.Fa "const pid_t pid"
.Fa "const int expected_exit_status"
.Fa "const std::string& expected_stdout"
.Fa "const std::string& expected_stderr"
.Fc
.Sh DESCRIPTION
ATF provides a mostly-macro-based programming interface to implement test
programs in C or C++.
This interface is backed by a C++ implementation, but this fact is
hidden from the developer as much as possible through the use of
macros to simplify programming.
However, the use of C++ is not hidden everywhere and while you can
implement test cases without knowing anything at all about the object model
underneath the provided calls, you might need some minimum notions of the
language in very specific circumstances.
.Pp
C++-based test programs always follow this template:
ATF provides a C++ programming interface to implement test programs.
C++-based test programs follow this template:
.Bd -literal -offset indent
extern "C" {
.Ns ... C-specific includes go here ...
@ -205,7 +263,7 @@ The first parameter of this macro matches the name you provided in the
former call.
.Ss Header definitions
The test case's header can define the meta-data by using the
.Fn set
.Fn set_md_var
method, which takes two parameters: the first one specifies the
meta-data variable to be set and the second one specifies its value.
Both of them are strings.
@ -348,7 +406,7 @@ in the collection.
.Fn ATF_REQUIRE_THROW
takes the name of an exception and a statement and raises a failure if
the statement does not throw the specified exception.
.Fn ATF_REQUIRE_THROW_EQ
.Fn ATF_REQUIRE_THROW_RE
takes the name of an exception, a regular expresion and a statement and raises a
failure if the statement does not throw the specified exception and if the
message of the exception does not match the regular expression.
@ -362,6 +420,163 @@ variable and, second, a boolean expression that, if evaluates to true,
means that a call failed and
.Va errno
has to be checked against the first value.
.Ss Utility functions
The following functions are provided as part of the
.Nm
API to simplify the creation of a variety of tests.
In particular, these are useful to write tests for command-line interfaces.
.Pp
.Ft void
.Fo atf::utils::cat_file
.Fa "const std::string& path"
.Fa "const std::string& prefix"
.Fc
.Bd -ragged -offset indent
Prints the contents of
.Fa path
to the standard output, prefixing every line with the string in
.Fa prefix .
.Ed
.Pp
.Ft bool
.Fo atf::utils::compare_file
.Fa "const std::string& path"
.Fa "const std::string& contents"
.Fc
.Bd -ragged -offset indent
Returns true if the given
.Fa path
matches exactly the expected inlined
.Fa contents .
.Ed
.Pp
.Ft void
.Fo atf::utils::copy_file
.Fa "const std::string& source"
.Fa "const std::string& destination"
.Fc
.Bd -ragged -offset indent
Copies the file
.Fa source
to
.Fa destination .
The permissions of the file are preserved during the code.
.Ed
.Pp
.Ft void
.Fo atf::utils::create_file
.Fa "const std::string& path"
.Fa "const std::string& contents"
.Fc
.Bd -ragged -offset indent
Creates
.Fa file
with the text given in
.Fa contents .
.Ed
.Pp
.Ft void
.Fo atf::utils::file_exists
.Fa "const std::string& path"
.Fc
.Bd -ragged -offset indent
Checks if
.Fa path
exists.
.Ed
.Pp
.Ft pid_t
.Fo atf::utils::fork
.Fa "void"
.Fc
.Bd -ragged -offset indent
Forks a process and redirects the standard output and standard error of the
child to files for later validation with
.Fn atf::utils::wait .
Fails the test case if the fork fails, so this does not return an error.
.Ed
.Pp
.Ft bool
.Fo atf::utils::grep_collection
.Fa "const std::string& regexp"
.Fa "const Collection& collection"
.Fc
.Bd -ragged -offset indent
Searches for the regular expression
.Fa regexp
in any of the strings contained in the
.Fa collection .
This is a template that accepts any one-dimensional container of strings.
.Ed
.Pp
.Ft bool
.Fo atf::utils::grep_file
.Fa "const std::string& regexp"
.Fa "const std::string& path"
.Fc
.Bd -ragged -offset indent
Searches for the regular expression
.Fa regexp
in the file
.Fa path .
The variable arguments are used to construct the regular expression.
.Ed
.Pp
.Ft bool
.Fo atf::utils::grep_string
.Fa "const std::string& regexp"
.Fa "const std::string& str"
.Fc
.Bd -ragged -offset indent
Searches for the regular expression
.Fa regexp
in the string
.Fa str .
.Ed
.Ft void
.Fo atf::utils::redirect
.Fa "const int fd"
.Fa "const std::string& path"
.Fc
.Bd -ragged -offset indent
Redirects the given file descriptor
.Fa fd
to the file
.Fa path .
This function exits the process in case of an error and does not properly mark
the test case as failed.
As a result, it should only be used in subprocesses of the test case; specially
those spawned by
.Fn atf::utils::fork .
.Ed
.Pp
.Ft void
.Fo atf::utils::wait
.Fa "const pid_t pid"
.Fa "const int expected_exit_status"
.Fa "const std::string& expected_stdout"
.Fa "const std::string& expected_stderr"
.Fc
.Bd -ragged -offset indent
Waits and validates the result of a subprocess spawned with
.Fn atf::utils::wait .
The validation involves checking that the subprocess exited cleanly and returned
the code specified in
.Fa expected_exit_status
and that its standard output and standard error match the strings given in
.Fa expected_stdout
and
.Fa expected_stderr .
.Pp
If any of the
.Fa expected_stdout
or
.Fa expected_stderr
strings are prefixed with
.Sq save: ,
then they specify the name of the file into which to store the stdout or stderr
of the subprocess, and no comparison is performed.
.Ed
.Sh EXAMPLES
The following shows a complete test program with a single test case that
validates the addition operator:
@ -371,7 +586,7 @@ validates the addition operator:
ATF_TEST_CASE(addition);
ATF_TEST_CASE_HEAD(addition)
{
set("descr", "Sample tests for the addition operator");
set_md_var("descr", "Sample tests for the addition operator");
}
ATF_TEST_CASE_BODY(addition)
{
@ -387,7 +602,7 @@ ATF_TEST_CASE_BODY(addition)
ATF_TEST_CASE(open_failure);
ATF_TEST_CASE_HEAD(open_failure)
{
set("descr", "Sample tests for the open function");
set_md_var("descr", "Sample tests for the open function");
}
ATF_TEST_CASE_BODY(open_failure)
{
@ -397,7 +612,7 @@ ATF_TEST_CASE_BODY(open_failure)
ATF_TEST_CASE(known_bug);
ATF_TEST_CASE_HEAD(known_bug)
{
set("descr", "Reproduces a known bug");
set_md_var("descr", "Reproduces a known bug");
}
ATF_TEST_CASE_BODY(known_bug)
{

View File

@ -39,7 +39,7 @@ extern "C" {
#include <string>
#include <vector>
#include <atf-c++/utils.hpp>
#include <atf-c++/noncopyable.hpp>
namespace atf {
@ -60,7 +60,7 @@ namespace check {
//! of executing arbitrary command and manages files containing
//! its output.
//!
class check_result : utils::noncopyable {
class check_result : noncopyable {
//!
//! \brief Internal representation of a result.
//!

View File

@ -193,15 +193,15 @@ ATF_TEST_CASE_BODY(build_c_o)
{
ATF_TEST_CASE_USE(h_build_c_o_ok);
run_h_tc< ATF_TEST_CASE_NAME(h_build_c_o_ok) >();
ATF_REQUIRE(grep_file("stdout", "-o test.o"));
ATF_REQUIRE(grep_file("stdout", "-c test.c"));
ATF_REQUIRE(atf::utils::grep_file("-o test.o", "stdout"));
ATF_REQUIRE(atf::utils::grep_file("-c test.c", "stdout"));
ATF_TEST_CASE_USE(h_build_c_o_fail);
run_h_tc< ATF_TEST_CASE_NAME(h_build_c_o_fail) >();
ATF_REQUIRE(grep_file("stdout", "-o test.o"));
ATF_REQUIRE(grep_file("stdout", "-c test.c"));
ATF_REQUIRE(grep_file("stderr", "test.c"));
ATF_REQUIRE(grep_file("stderr", "UNDEFINED_SYMBOL"));
ATF_REQUIRE(atf::utils::grep_file("-o test.o", "stdout"));
ATF_REQUIRE(atf::utils::grep_file("-c test.c", "stdout"));
ATF_REQUIRE(atf::utils::grep_file("test.c", "stderr"));
ATF_REQUIRE(atf::utils::grep_file("UNDEFINED_SYMBOL", "stderr"));
}
ATF_TEST_CASE(build_cpp);
@ -213,16 +213,16 @@ ATF_TEST_CASE_BODY(build_cpp)
{
ATF_TEST_CASE_USE(h_build_cpp_ok);
run_h_tc< ATF_TEST_CASE_NAME(h_build_cpp_ok) >();
ATF_REQUIRE(grep_file("stdout", "-o.*test.p"));
ATF_REQUIRE(grep_file("stdout", "test.c"));
ATF_REQUIRE(grep_file("test.p", "foo bar"));
ATF_REQUIRE(atf::utils::grep_file("-o.*test.p", "stdout"));
ATF_REQUIRE(atf::utils::grep_file("test.c", "stdout"));
ATF_REQUIRE(atf::utils::grep_file("foo bar", "test.p"));
ATF_TEST_CASE_USE(h_build_cpp_fail);
run_h_tc< ATF_TEST_CASE_NAME(h_build_cpp_fail) >();
ATF_REQUIRE(grep_file("stdout", "-o test.p"));
ATF_REQUIRE(grep_file("stdout", "test.c"));
ATF_REQUIRE(grep_file("stderr", "test.c"));
ATF_REQUIRE(grep_file("stderr", "non-existent.h"));
ATF_REQUIRE(atf::utils::grep_file("-o test.p", "stdout"));
ATF_REQUIRE(atf::utils::grep_file("test.c", "stdout"));
ATF_REQUIRE(atf::utils::grep_file("test.c", "stderr"));
ATF_REQUIRE(atf::utils::grep_file("non-existent.h", "stderr"));
}
ATF_TEST_CASE(build_cxx_o);
@ -234,15 +234,15 @@ ATF_TEST_CASE_BODY(build_cxx_o)
{
ATF_TEST_CASE_USE(h_build_cxx_o_ok);
run_h_tc< ATF_TEST_CASE_NAME(h_build_cxx_o_ok) >();
ATF_REQUIRE(grep_file("stdout", "-o test.o"));
ATF_REQUIRE(grep_file("stdout", "-c test.cpp"));
ATF_REQUIRE(atf::utils::grep_file("-o test.o", "stdout"));
ATF_REQUIRE(atf::utils::grep_file("-c test.cpp", "stdout"));
ATF_TEST_CASE_USE(h_build_cxx_o_fail);
run_h_tc< ATF_TEST_CASE_NAME(h_build_cxx_o_fail) >();
ATF_REQUIRE(grep_file("stdout", "-o test.o"));
ATF_REQUIRE(grep_file("stdout", "-c test.cpp"));
ATF_REQUIRE(grep_file("stderr", "test.cpp"));
ATF_REQUIRE(grep_file("stderr", "UNDEFINED_SYMBOL"));
ATF_REQUIRE(atf::utils::grep_file("-o test.o", "stdout"));
ATF_REQUIRE(atf::utils::grep_file("-c test.cpp", "stdout"));
ATF_REQUIRE(atf::utils::grep_file("test.cpp", "stderr"));
ATF_REQUIRE(atf::utils::grep_file("UNDEFINED_SYMBOL", "stderr"));
}
ATF_TEST_CASE(exec_cleanup);

View File

@ -1,13 +0,0 @@
Content-Type: application/X-atf-atffile; version="1"
prop: test-suite = atf
tp: application_test
tp: env_test
tp: exceptions_test
tp: expand_test
tp: fs_test
tp: parser_test
tp: sanity_test
tp: text_test
tp: ui_test

Some files were not shown because too many files have changed in this diff Show More