Sync with HEAD.
This commit is contained in:
commit
d9a447559b
@ -4,7 +4,7 @@
|
||||
The compilation of software known as FreeBSD is distributed under the
|
||||
following terms:
|
||||
|
||||
Copyright (c) 1992-2012 The FreeBSD Project. All rights reserved.
|
||||
Copyright (c) 1992-2013 The FreeBSD Project. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
|
1
LOCKS
1
LOCKS
@ -11,3 +11,4 @@ releng/4.* Requires Security Officer approval.
|
||||
releng/5.* Requires Security Officer approval.
|
||||
releng/6.* Requires Security Officer approval.
|
||||
releng/7.* Requires Security Officer approval.
|
||||
releng/8.* Requires Security Officer approval.
|
||||
|
158
Makefile.inc1
158
Makefile.inc1
@ -4,6 +4,8 @@
|
||||
# Make command line options:
|
||||
# -DNO_CLEANDIR run ${MAKE} clean, instead of ${MAKE} cleandir
|
||||
# -DNO_CLEAN do not clean at all
|
||||
# -DDB_FROM_SRC use the user/group databases in src/etc instead of
|
||||
# the system database when installing.
|
||||
# -DNO_SHARE do not go into share subdir
|
||||
# -DKERNFAST define NO_KERNEL{CONFIG,CLEAN,DEPEND,OBJ}
|
||||
# -DNO_KERNELCONFIG do not run config in ${MAKE} buildkernel
|
||||
@ -11,8 +13,8 @@
|
||||
# -DNO_KERNELDEPEND do not run ${MAKE} depend in ${MAKE} buildkernel
|
||||
# -DNO_KERNELOBJ do not run ${MAKE} obj in ${MAKE} buildkernel
|
||||
# -DNO_PORTSUPDATE do not update ports in ${MAKE} update
|
||||
# -DNO_ROOT install without using root privilege
|
||||
# -DNO_DOCUPDATE do not update doc in ${MAKE} update
|
||||
# -DNO_WWWUPDATE do not update www in ${MAKE} update
|
||||
# -DNO_CTF do not run the DTrace CTF conversion tools on built objects
|
||||
# LOCAL_DIRS="list of dirs" to add additional dirs to the SUBDIR list
|
||||
# LOCAL_LIB_DIRS="list of dirs" to add additional dirs to libraries target
|
||||
@ -20,9 +22,13 @@
|
||||
# to be created before files are installed
|
||||
# LOCAL_TOOL_DIRS="list of dirs" to add additional dirs to the build-tools
|
||||
# list
|
||||
# METALOG="path to metadata log" to write permission and ownership
|
||||
# when NO_ROOT is set. (default: ${DESTDIR}/METALOG)
|
||||
# TARGET="machine" to crossbuild world for a different machine type
|
||||
# TARGET_ARCH= may be required when a TARGET supports multiple endians
|
||||
# BUILDENV_SHELL= shell to launch for the buildenv target (def:/bin/sh)
|
||||
# WORLD_FLAGS= additional flags to pass to make(1) during buildworld
|
||||
# KERNEL_FLAGS= additional flags to pass to make(1) during buildkernel
|
||||
|
||||
#
|
||||
# The intended user-driven targets are:
|
||||
@ -183,7 +189,7 @@ OBJTREE= ${MAKEOBJDIRPREFIX}/${TARGET}.${TARGET_ARCH}
|
||||
.endif
|
||||
WORLDTMP= ${OBJTREE}${.CURDIR}/tmp
|
||||
# /usr/games added for fortune which depend on strfile
|
||||
BPATH= ${WORLDTMP}/legacy/usr/sbin:${WORLDTMP}/legacy/usr/bin:${WORLDTMP}/legacy/usr/games
|
||||
BPATH= ${WORLDTMP}/legacy/usr/sbin:${WORLDTMP}/legacy/usr/bin:${WORLDTMP}/legacy/usr/games:${WORLDTMP}/legacy/bin
|
||||
XPATH= ${WORLDTMP}/usr/sbin:${WORLDTMP}/usr/bin:${WORLDTMP}/usr/games
|
||||
STRICTTMPPATH= ${BPATH}:${XPATH}
|
||||
TMPPATH= ${STRICTTMPPATH}:${PATH}
|
||||
@ -243,7 +249,7 @@ BMAKEENV= INSTALL="sh ${.CURDIR}/tools/install.sh" \
|
||||
MAKEFLAGS="-m ${.CURDIR}/tools/build/mk ${.MAKEFLAGS}" \
|
||||
COMPILER_TYPE=${COMPILER_TYPE}
|
||||
BMAKE= MAKEOBJDIRPREFIX=${WORLDTMP} \
|
||||
${BMAKEENV} ${MAKE} -f Makefile.inc1 \
|
||||
${BMAKEENV} ${MAKE} ${WORLD_FLAGS} -f Makefile.inc1 \
|
||||
DESTDIR= \
|
||||
BOOTSTRAPPING=${OSRELDATE} \
|
||||
SSP_CFLAGS= \
|
||||
@ -254,7 +260,7 @@ BMAKE= MAKEOBJDIRPREFIX=${WORLDTMP} \
|
||||
|
||||
# build-tools stage
|
||||
TMAKE= MAKEOBJDIRPREFIX=${OBJTREE} \
|
||||
${BMAKEENV} ${MAKE} -f Makefile.inc1 \
|
||||
${BMAKEENV} ${MAKE} ${WORLD_FLAGS} -f Makefile.inc1 \
|
||||
TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \
|
||||
DESTDIR= \
|
||||
BOOTSTRAPPING=${OSRELDATE} \
|
||||
@ -289,7 +295,7 @@ WMAKE_COMPILER_TYPE= gcc
|
||||
WMAKE_COMPILER_TYPE= clang
|
||||
.endif
|
||||
WMAKEENV+= COMPILER_TYPE=${WMAKE_COMPILER_TYPE}
|
||||
WMAKE= ${WMAKEENV} ${MAKE} -f Makefile.inc1 DESTDIR=${WORLDTMP}
|
||||
WMAKE= ${WMAKEENV} ${MAKE} ${WORLD_FLAGS} -f Makefile.inc1 DESTDIR=${WORLDTMP}
|
||||
|
||||
.if ${TARGET_ARCH} == "amd64" || ${TARGET_ARCH} == "powerpc64"
|
||||
# 32 bit world
|
||||
@ -339,18 +345,20 @@ LIB32WMAKEFLAGS+= \
|
||||
CXX="${CXX} ${LIB32FLAGS}" \
|
||||
DESTDIR=${LIB32TMP} \
|
||||
-DCOMPAT_32BIT \
|
||||
-DLIBRARIES_ONLY \
|
||||
-DNO_CPU_CFLAGS \
|
||||
-DNO_CTF \
|
||||
-DNO_LINT
|
||||
|
||||
LIB32WMAKE= ${LIB32WMAKEENV} ${MAKE} ${LIB32WMAKEFLAGS} \
|
||||
-DWITHOUT_BIND -DWITHOUT_MAN -DWITHOUT_INFO -DWITHOUT_HTML
|
||||
LIB32IMAKE= ${LIB32WMAKE:NINSTALL=*:NDESTDIR=*:N_LDSCRIPTROOT=*} -DNO_INCS
|
||||
LIB32IMAKE= ${LIB32WMAKE:NINSTALL=*:NDESTDIR=*:N_LDSCRIPTROOT=*} -DNO_INCS \
|
||||
${IMAKE_INSTALL}
|
||||
.endif
|
||||
|
||||
# install stage
|
||||
IMAKEENV= ${CROSSENV:N_LDSCRIPTROOT=*}
|
||||
IMAKE= ${IMAKEENV} ${MAKE} -f Makefile.inc1
|
||||
IMAKE= ${IMAKEENV} ${MAKE} -f Makefile.inc1 \
|
||||
${IMAKE_INSTALL} ${IMAKE_MTREE}
|
||||
.if empty(.MAKEFLAGS:M-n)
|
||||
IMAKEENV+= PATH=${STRICTTMPPATH}:${INSTALLTMP} \
|
||||
LD_LIBRARY_PATH=${INSTALLTMP} \
|
||||
@ -359,10 +367,25 @@ IMAKE+= __MAKE_SHELL=${INSTALLTMP}/sh
|
||||
.else
|
||||
IMAKEENV+= PATH=${TMPPATH}:${INSTALLTMP}
|
||||
.endif
|
||||
.if defined(DB_FROM_SRC)
|
||||
INSTALLFLAGS+= -N ${.CURDIR}/etc
|
||||
MTREEFLAGS+= -N ${.CURDIR}/etc
|
||||
.endif
|
||||
.if defined(NO_ROOT)
|
||||
METALOG?= ${DESTDIR}/${DISTDIR}/METALOG
|
||||
IMAKE+= -DNO_ROOT METALOG=${METALOG}
|
||||
INSTALL_DDIR= ${DESTDIR}/${DISTDIR}
|
||||
INSTALLFLAGS+= -U -M ${METALOG} -D ${INSTALL_DDIR:S://:/:g:C:/$::}
|
||||
MTREEFLAGS+= -W
|
||||
.endif
|
||||
.if defined(DB_FROM_SRC) || defined(NO_ROOT)
|
||||
IMAKE_INSTALL= INSTALL="install ${INSTALLFLAGS}"
|
||||
IMAKE_MTREE= MTREE_CMD="nmtree ${MTREEFLAGS}"
|
||||
.endif
|
||||
|
||||
# kernel stage
|
||||
KMAKEENV= ${WMAKEENV}
|
||||
KMAKE= ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME}
|
||||
KMAKE= ${KMAKEENV} ${MAKE} ${KERNEL_FLAGS} KERNEL=${INSTKERNNAME}
|
||||
|
||||
#
|
||||
# buildworld
|
||||
@ -396,7 +419,7 @@ _worldtmp:
|
||||
rm -f ${OBJTREE}${.CURDIR}/usr.bin/truss/ioctl.c
|
||||
.endif
|
||||
.for _dir in \
|
||||
lib usr legacy/usr
|
||||
lib usr legacy/bin legacy/usr
|
||||
mkdir -p ${WORLDTMP}/${_dir}
|
||||
.endfor
|
||||
mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
|
||||
@ -516,6 +539,8 @@ build32:
|
||||
.endfor
|
||||
.for _dir in lib/ncurses/ncurses lib/ncurses/ncursesw lib/libmagic
|
||||
cd ${.CURDIR}/${_dir}; \
|
||||
WORLDTMP=${WORLDTMP} \
|
||||
MAKEFLAGS="-m ${.CURDIR}/tools/build/mk ${.MAKEFLAGS}" \
|
||||
MAKEOBJDIRPREFIX=${OBJTREE}/lib32 ${MAKE} SSP_CFLAGS= DESTDIR= \
|
||||
DIRPRFX=${_dir}/ -DNO_LINT -DNO_CPU_CFLAGS -DNO_WARNS -DNO_CTF \
|
||||
-DEARLY_BUILD build-tools
|
||||
@ -598,9 +623,11 @@ kernel-toolchain: ${TOOLCHAIN_TGTS:N_includes:N_libraries}
|
||||
installcheck:
|
||||
|
||||
#
|
||||
# Require DESTDIR to be set if installing for a different architecture.
|
||||
# Require DESTDIR to be set if installing for a different architecture or
|
||||
# using the user/group database in the source tree.
|
||||
#
|
||||
.if ${TARGET_ARCH} != ${MACHINE_ARCH} || ${TARGET} != ${MACHINE}
|
||||
.if ${TARGET_ARCH} != ${MACHINE_ARCH} || ${TARGET} != ${MACHINE} || \
|
||||
defined(DB_FROM_SRC)
|
||||
.if !make(distributeworld)
|
||||
installcheck: installcheck_DESTDIR
|
||||
installcheck_DESTDIR:
|
||||
@ -611,10 +638,11 @@ installcheck_DESTDIR:
|
||||
.endif
|
||||
.endif
|
||||
|
||||
.if !defined(DB_FROM_SRC)
|
||||
#
|
||||
# Check for missing UIDs/GIDs.
|
||||
#
|
||||
CHECK_UIDS=
|
||||
CHECK_UIDS= auditdistd
|
||||
CHECK_GIDS= audit
|
||||
.if ${MK_SENDMAIL} != "no"
|
||||
CHECK_UIDS+= smmsp
|
||||
@ -638,6 +666,7 @@ installcheck_UGID:
|
||||
false; \
|
||||
fi
|
||||
.endfor
|
||||
.endif
|
||||
|
||||
#
|
||||
# Required install tools to be saved in a scratch dir for safety.
|
||||
@ -650,9 +679,9 @@ _zoneinfo= zic tzsetup
|
||||
.endif
|
||||
|
||||
ITOOLS= [ awk cap_mkdb cat chflags chmod chown \
|
||||
date echo egrep find grep ${_install-info} \
|
||||
ln lockf make mkdir mtree mv pwd_mkdb rm sed sh sysctl \
|
||||
test true uname wc ${_zoneinfo}
|
||||
date echo egrep find grep id install ${_install-info} \
|
||||
ln lockf make mkdir mtree ${_nmtree_itools} mv pwd_mkdb \
|
||||
rm sed sh sysctl test true uname wc ${_zoneinfo}
|
||||
|
||||
#
|
||||
# distributeworld
|
||||
@ -673,6 +702,8 @@ EXTRA_DISTRIBUTIONS+= games
|
||||
EXTRA_DISTRIBUTIONS+= lib32
|
||||
.endif
|
||||
|
||||
MTREE_MAGIC?= mtree 2.0
|
||||
|
||||
distributeworld installworld: installcheck
|
||||
mkdir -p ${INSTALLTMP}
|
||||
progs=$$(for prog in ${ITOOLS}; do \
|
||||
@ -695,6 +726,9 @@ distributeworld installworld: installcheck
|
||||
done); \
|
||||
cp $$libs $$progs ${INSTALLTMP}
|
||||
cp -R $${PATH_LOCALE:-"/usr/share/locale"} ${INSTALLTMP}/locale
|
||||
.if defined(NO_ROOT)
|
||||
echo "#${MTREE_MAGIC}" > ${METALOG}
|
||||
.endif
|
||||
.if make(distributeworld)
|
||||
.for dist in ${EXTRA_DISTRIBUTIONS}
|
||||
-mkdir ${DESTDIR}/${DISTDIR}/${dist}
|
||||
@ -704,10 +738,20 @@ distributeworld installworld: installcheck
|
||||
-p ${DESTDIR}/${DISTDIR}/${dist}/usr >/dev/null
|
||||
mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
|
||||
-p ${DESTDIR}/${DISTDIR}/${dist}/usr/include >/dev/null
|
||||
.if defined(NO_ROOT)
|
||||
${IMAKEENV} nmtree -C -f ${.CURDIR}/etc/mtree/BSD.root.dist | \
|
||||
sed -e 's#^\./#./${dist}/#' >> ${METALOG}
|
||||
${IMAKEENV} nmtree -C -f ${.CURDIR}/etc/mtree/BSD.usr.dist | \
|
||||
sed -e 's#^\./#./${dist}/usr/#' >> ${METALOG}
|
||||
${IMAKEENV} nmtree -C -f ${.CURDIR}/etc/mtree/BSD.include.dist | \
|
||||
sed -e 's#^\./#./${dist}/usr/include/#' >> ${METALOG}
|
||||
.endif
|
||||
.endfor
|
||||
-mkdir ${DESTDIR}/${DISTDIR}/base
|
||||
${_+_}cd ${.CURDIR}; ${IMAKE} distrib-dirs \
|
||||
DESTDIR=${DESTDIR}/${DISTDIR}/base
|
||||
cd ${.CURDIR}/etc; ${CROSSENV} PATH=${TMPPATH} ${MAKE} \
|
||||
METALOG=${METALOG} ${IMAKE_INSTALL} ${IMAKE_MTREE} \
|
||||
DISTBASE=/base DESTDIR=${DESTDIR}/${DISTDIR}/base \
|
||||
LOCAL_MTREE=${LOCAL_MTREE} distrib-dirs
|
||||
.endif
|
||||
${_+_}cd ${.CURDIR}; ${IMAKE} re${.TARGET:S/world$//}; \
|
||||
${IMAKEENV} rm -rf ${INSTALLTMP}
|
||||
@ -715,12 +759,30 @@ distributeworld installworld: installcheck
|
||||
.for dist in ${EXTRA_DISTRIBUTIONS}
|
||||
find ${DESTDIR}/${DISTDIR}/${dist} -empty -delete
|
||||
.endfor
|
||||
.if defined(NO_ROOT)
|
||||
.for dist in base ${EXTRA_DISTRIBUTIONS}
|
||||
@# For each file that exists in this dist, print the corresponding
|
||||
@# line from the METALOG. This relies on the fact that
|
||||
@# a line containing only the filename will sort immediatly before
|
||||
@# the relevant mtree line.
|
||||
cd ${DESTDIR}/${DISTDIR}; \
|
||||
find ./${dist} | sort -u ${METALOG} - | \
|
||||
awk 'BEGIN { print "#${MTREE_MAGIC}" } !/ type=/ { file = $$1 } / type=/ { if ($$1 == file) { sub(/^\.\/${dist}\//, "./"); print } }' > \
|
||||
${DESTDIR}/${DISTDIR}/${dist}.meta
|
||||
.endfor
|
||||
.endif
|
||||
.endif
|
||||
|
||||
packageworld:
|
||||
.for dist in base ${EXTRA_DISTRIBUTIONS}
|
||||
.if defined(NO_ROOT)
|
||||
${_+_}cd ${DESTDIR}/${DISTDIR}/${dist}; \
|
||||
tar cvJf ${DESTDIR}/${DISTDIR}/${dist}.txz \
|
||||
@${DESTDIR}/${DISTDIR}/${dist}.meta
|
||||
.else
|
||||
${_+_}cd ${DESTDIR}/${DISTDIR}/${dist}; \
|
||||
tar cvJf ${DESTDIR}/${DISTDIR}/${dist}.txz .
|
||||
.endif
|
||||
.endfor
|
||||
|
||||
#
|
||||
@ -756,7 +818,8 @@ redistribute:
|
||||
.endif
|
||||
|
||||
distrib-dirs distribution:
|
||||
cd ${.CURDIR}/etc; ${CROSSENV} PATH=${TMPPATH} ${MAKE} ${.TARGET}
|
||||
cd ${.CURDIR}/etc; ${CROSSENV} PATH=${TMPPATH} ${MAKE} \
|
||||
${IMAKE_INSTALL} ${IMAKE_MTREE} METALOG=${METALOG} ${.TARGET}
|
||||
|
||||
#
|
||||
# buildkernel and installkernel
|
||||
@ -908,7 +971,7 @@ reinstallkernel reinstallkernel.debug: installcheck
|
||||
@echo "--------------------------------------------------------------"
|
||||
cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \
|
||||
${CROSSENV} PATH=${TMPPATH} \
|
||||
${MAKE} KERNEL=${INSTKERNNAME} ${.TARGET:S/kernel//}
|
||||
${MAKE} ${IMAKE_INSTALL} KERNEL=${INSTKERNNAME} ${.TARGET:S/kernel//}
|
||||
|
||||
distributekernel distributekernel.debug:
|
||||
.if empty(INSTALLKERNEL)
|
||||
@ -958,6 +1021,13 @@ update:
|
||||
@echo "--------------------------------------------------------------"
|
||||
@echo ">>> Running ${SUP}"
|
||||
@echo "--------------------------------------------------------------"
|
||||
@echo "!! WARNING WARNING WARNING WARNING WARNING WARNING WARNING !!"
|
||||
@echo "!! Update methods with ${SUP} are deprecated."
|
||||
@echo "!! Please see http://www.freebsd.org/handbook/svn.html"
|
||||
@echo "!! and convert your update method to SVN_UPDATE or"
|
||||
@echo "!! freebsd-update(8)."
|
||||
@echo "!! WARNING WARNING WARNING WARNING WARNING WARNING WARNING !!"
|
||||
@sleep 5
|
||||
.if defined(SUPFILE)
|
||||
@${SUP} ${SUPFLAGS} ${SUPFILE}
|
||||
.endif
|
||||
@ -973,9 +1043,6 @@ update:
|
||||
.if defined(DOCSUPFILE) && !defined(NO_DOCUPDATE)
|
||||
@${SUP} ${SUPFLAGS} ${DOCSUPFILE}
|
||||
.endif
|
||||
.if defined(WWWSUPFILE) && !defined(NO_WWWUPDATE)
|
||||
@${SUP} ${SUPFLAGS} ${WWWSUPFILE}
|
||||
.endif
|
||||
.endif
|
||||
.if defined(CVS_UPDATE)
|
||||
@cd ${.CURDIR} ; \
|
||||
@ -983,6 +1050,13 @@ update:
|
||||
echo "--------------------------------------------------------------" ; \
|
||||
echo ">>> Updating ${.CURDIR} from CVS repository" ${CVSROOT} ; \
|
||||
echo "--------------------------------------------------------------" ; \
|
||||
echo "!! WARNING WARNING WARNING WARNING WARNING WARNING WARNING !!" ; \
|
||||
echo "!! Update methods with CVS are deprecated." ; \
|
||||
echo "!! Please see http://www.freebsd.org/handbook/svn.html" ; \
|
||||
echo "!! and convert your update method to SVN_UPDATE or" ; \
|
||||
echo "!! freebsd-update(8)." ; \
|
||||
echo "!! WARNING WARNING WARNING WARNING WARNING WARNING WARNING !!" ; \
|
||||
sleep 5 ; \
|
||||
echo ${CVS} -R -q update ${CVSFLAGS} ; \
|
||||
${CVS} -R -q update ${CVSFLAGS} ; \
|
||||
fi
|
||||
@ -1062,6 +1136,17 @@ _lex= usr.bin/lex
|
||||
_yacc= usr.bin/yacc
|
||||
.endif
|
||||
|
||||
.if ${BOOTSTRAPPING} < 1000026
|
||||
_nmtree= lib/libnetbsd \
|
||||
usr.sbin/nmtree
|
||||
.else
|
||||
_nmtree_itools= nmtree
|
||||
.endif
|
||||
|
||||
.if ${BOOTSTRAPPING} < 1000027
|
||||
_cat= bin/cat
|
||||
.endif
|
||||
|
||||
.if ${BOOTSTRAPPING} >= 900040 && ${BOOTSTRAPPING} < 900041
|
||||
_awk= usr.bin/awk
|
||||
.endif
|
||||
@ -1087,7 +1172,10 @@ _dtrace_tools= cddl/usr.bin/sgsmsg cddl/lib/libctf lib/libelf \
|
||||
lib/libdwarf cddl/usr.bin/ctfconvert cddl/usr.bin/ctfmerge
|
||||
.endif
|
||||
|
||||
.if ${MK_FDT} != "no"
|
||||
# Default to building the BSDL DTC, but build the GPL one if users explicitly
|
||||
# request it.
|
||||
_dtc= usr.bin/dtc
|
||||
.if ${MK_GPL_DTC} != "no"
|
||||
_dtc= gnu/usr.bin/dtc
|
||||
.endif
|
||||
|
||||
@ -1114,6 +1202,7 @@ bootstrap-tools:
|
||||
${_ar} \
|
||||
${_dtc} \
|
||||
${_awk} \
|
||||
${_cat} \
|
||||
usr.bin/lorder \
|
||||
usr.bin/makewhatis \
|
||||
${_mklocale} \
|
||||
@ -1123,7 +1212,8 @@ bootstrap-tools:
|
||||
${_lex} \
|
||||
usr.bin/xinstall \
|
||||
${_gensnmptree} \
|
||||
usr.sbin/config
|
||||
usr.sbin/config \
|
||||
${_nmtree}
|
||||
${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \
|
||||
cd ${.CURDIR}/${_tool}; \
|
||||
${MAKE} DIRPRFX=${_tool}/ obj; \
|
||||
@ -1143,7 +1233,7 @@ _aicasm= sys/modules/aic7xxx/aicasm
|
||||
_share= share/syscons/scrnmaps
|
||||
.endif
|
||||
|
||||
.if ${MK_GCC} != "no" && ${MK_CLANG_IS_CC} == "no"
|
||||
.if ${MK_GCC} != "no"
|
||||
_gcc_tools= gnu/usr.bin/cc/cc_tools
|
||||
.endif
|
||||
|
||||
@ -1205,7 +1295,7 @@ _clang= usr.bin/clang
|
||||
_clang_libs= lib/clang
|
||||
.endif
|
||||
|
||||
.if ${MK_GCC} != "no" && ${MK_CLANG_IS_CC} == "no"
|
||||
.if ${MK_GCC} != "no" && (${MK_CLANG_IS_CC} == "no" || ${TARGET} == "pc98")
|
||||
_cc= gnu/usr.bin/cc
|
||||
.endif
|
||||
|
||||
@ -1231,11 +1321,12 @@ cross-tools:
|
||||
# hierarchy - ensure that all the needed directories are present
|
||||
#
|
||||
hierarchy hier:
|
||||
cd ${.CURDIR}/etc; ${MAKE} distrib-dirs
|
||||
.for _mtree in ${LOCAL_MTREE}
|
||||
mtree -eU ${MTREE_FOLLOWS_SYMLINKS} -f ${.CURDIR}/${_mtree} \
|
||||
-p ${DESTDIR}/
|
||||
.endfor
|
||||
.if defined(NO_ROOT)
|
||||
cd ${.CURDIR}/etc; ${MAKE} LOCAL_MTREE=${LOCAL_MTREE} \
|
||||
-DNO_ROOT METALOG=${METALOG} distrib-dirs
|
||||
.else
|
||||
cd ${.CURDIR}/etc; ${MAKE} LOCAL_MTREE=${LOCAL_MTREE} distrib-dirs
|
||||
.endif
|
||||
|
||||
#
|
||||
# libraries - build all libraries, and install them under ${DESTDIR}.
|
||||
@ -1647,7 +1738,8 @@ NOFUN=-DNO_FSCHG -DWITHOUT_HTML -DWITHOUT_INFO -DNO_LINT \
|
||||
|
||||
XDDIR=${XDEV_ARCH}-freebsd
|
||||
XDTP=/usr/${XDDIR}
|
||||
CDBENV=MAKEOBJDIRPREFIX=${MAKEOBJDIRPREFIX}/${XDDIR}
|
||||
CDBENV=MAKEOBJDIRPREFIX=${MAKEOBJDIRPREFIX}/${XDDIR} \
|
||||
INSTALL="sh ${.CURDIR}/tools/install.sh"
|
||||
CDENV= ${CDBENV} \
|
||||
_SHLIBDIRPREFIX=${XDTP} \
|
||||
TOOLS_PREFIX=${XDTP}
|
||||
|
@ -38,6 +38,25 @@
|
||||
# xargs -n1 | sort | uniq -d;
|
||||
# done
|
||||
|
||||
# 20130116: removed long unused directories for .1aout section manpages
|
||||
OLD_FILES+=usr/share/man/en.ISO8859-1/man1aout
|
||||
OLD_FILES+=usr/share/man/en.UTF-8/man1aout
|
||||
OLD_DIRS+=usr/share/man/man1aout
|
||||
OLD_DIRS+=usr/share/man/cat1aout
|
||||
OLD_DIRS+=usr/share/man/en.ISO8859-1/cat1aout
|
||||
OLD_DIRS+=usr/share/man/en.UTF-8/cat1aout
|
||||
# 20121230: libdisk removed
|
||||
OLD_FILES+=usr/share/man/man3/libdisk.3.gz usr/include/libdisk.h
|
||||
OLD_FILES+=usr/lib/libdisk.a usr/lib32/libdisk.a
|
||||
# 20121230: remove wrongly created directories for auditdistd
|
||||
OLD_DIRS+=var/dist
|
||||
OLD_DIRS+=var/remote
|
||||
# 20121114: zpool-features manual page moved from section 5 to 7
|
||||
OLD_FILES+=usr/share/man/man5/zpool-features.5.gz
|
||||
# 20121022: remove harp, hfa and idt man page
|
||||
OLD_FILES+=share/man/man4/harp.4
|
||||
OLD_FILES+=share/man/man4/hfa.4
|
||||
OLD_FILES+=share/man/man4/idt.4
|
||||
# 20121022: VFS_LOCK_GIANT elimination
|
||||
OLD_FILES+=usr/share/man/man9/VFS_LOCK_GIANT.9.gz
|
||||
OLD_FILES+=usr/share/man/man9/VFS_UNLOCK_GIANT.9.gz
|
||||
@ -46,6 +65,9 @@ OLD_FILES+=usr/include/clang/3.2/unwind.h
|
||||
# 20120910: NetBSD compat shims removed
|
||||
OLD_FILES+=usr/include/cam/scsi/scsi_low_pisa.h
|
||||
OLD_FILES+=usr/include/sys/device_port.h
|
||||
# 20120909: doc and www supfiles removed
|
||||
OLD_FILES+=usr/share/examples/cvsup/doc-supfile
|
||||
OLD_FILES+=usr/share/examples/cvsup/www-supfile
|
||||
# 20120908: pf cleanup
|
||||
OLD_FILES+=usr/include/net/if_pflow.h
|
||||
# 20120816: new clang import which bumps version from 3.1 to 3.2
|
||||
@ -1186,12 +1208,6 @@ OLD_FILES+=usr/include/sys/linedisc.h
|
||||
OLD_FILES+=usr/share/man/man3/posix_openpt.3.gz
|
||||
# 20080725: sgtty.h removed
|
||||
OLD_FILES+=usr/include/sgtty.h
|
||||
# 20080719: sade(8) removed on all but amd64, i386 and sparc64
|
||||
.if ${TARGET_ARCH} != "amd64" && ${TARGET_ARCH} != "i386" && \
|
||||
${TARGET_ARCH} != "sparc64"
|
||||
OLD_FILES+=usr/sbin/sade
|
||||
OLD_FILES+=usr/share/man/man8/sade.8.gz
|
||||
.endif
|
||||
# 20080706: bsdlabel(8) removed on powerpc
|
||||
.if ${TARGET_ARCH} == "powerpc"
|
||||
OLD_FILES+=sbin/bsdlabel
|
||||
|
58
UPDATING
58
UPDATING
@ -4,7 +4,9 @@ This file is maintained and copyrighted by M. Warner Losh <imp@freebsd.org>.
|
||||
See end of file for further details. For commonly done items, please see the
|
||||
COMMON ITEMS: section later in the file. These instructions assume that you
|
||||
basically know what you are doing. If not, then please consult the FreeBSD
|
||||
handbook.
|
||||
handbook:
|
||||
|
||||
http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/makeworld.html
|
||||
|
||||
Items affecting the ports and packages system can be found in
|
||||
/usr/ports/UPDATING. Please read that file before running portupgrade.
|
||||
@ -24,6 +26,60 @@ 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".)
|
||||
|
||||
20130129:
|
||||
A BSD-licensed patch(1) variant has been added and is installed
|
||||
as bsdpatch, being the GNU version the default patch.
|
||||
To inverse the logic and use the BSD-licensed one as default,
|
||||
while having the GNU version installed as gnupatch, rebuild
|
||||
and install world with the WITH_BSD_PATCH knob set.
|
||||
|
||||
20130118:
|
||||
The install(1) option -M has changed meaning and now takes an
|
||||
argument that is a file or path to append logs to. In the
|
||||
unlikely event that -M was the last option on the command line
|
||||
and the command line contained at least two files and a target
|
||||
directory the first file will have logs appended to it. The -M
|
||||
option served little practical purpose in the last decade so it's
|
||||
used expected to be extremely rare.
|
||||
|
||||
20121223:
|
||||
After switching to Clang as the default compiler some users of ZFS
|
||||
on i386 systems started to experience stack overflow kernel panics.
|
||||
Please consider using 'options KSTACK_PAGES=4' in such configurations.
|
||||
|
||||
20121222:
|
||||
GEOM_LABEL now mangles label names read from file system metadata.
|
||||
Mangling affect labels containing spaces, non-printable characters,
|
||||
'%' or '"'. Device names in /etc/fstab and other places may need to
|
||||
be updated.
|
||||
|
||||
20121217:
|
||||
By default, only the 10 most recent kernel dumps will be saved. To
|
||||
restore the previous behaviour (no limit on the number of kernel dumps
|
||||
stored in the dump directory) add the following line to /etc/rc.conf:
|
||||
|
||||
savecore_flags=""
|
||||
|
||||
20121201:
|
||||
With the addition of auditdistd(8), a new auditdistd user is now
|
||||
depended on during installworld. "mergemaster -p" can be used to add
|
||||
the user prior to installworld, as documented in the handbook.
|
||||
|
||||
20121117:
|
||||
The sin6_scope_id member variable in struct sockaddr_in6 is now
|
||||
filled by the kernel before passing the structure to the userland via
|
||||
sysctl or routing socket. This means the KAME-specific embedded scope
|
||||
id in sin6_addr.s6_addr[2] is always cleared in userland application.
|
||||
This behavior can be controlled by net.inet6.ip6.deembed_scopeid.
|
||||
__FreeBSD_version is bumped to 1000025.
|
||||
|
||||
20121105:
|
||||
On i386 and amd64 systems WITH_CLANG_IS_CC is now the default.
|
||||
This means that the world and kernel will be compiled with clang
|
||||
and that clang will be installed as /usr/bin/cc, /usr/bin/c++,
|
||||
and /usr/bin/cpp. To disable this behavior and revert to building
|
||||
with gcc, compile with WITHOUT_CLANG_IS_CC.
|
||||
|
||||
20121102:
|
||||
The IPFIREWALL_FORWARD kernel option has been removed. Its
|
||||
functionality now turned on by default.
|
||||
|
@ -32,7 +32,7 @@
|
||||
.\" @(#)cat.1 8.3 (Berkeley) 5/2/95
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd March 21, 2004
|
||||
.Dd January 29, 2013
|
||||
.Dt CAT 1
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -40,7 +40,7 @@
|
||||
.Nd concatenate and print files
|
||||
.Sh SYNOPSIS
|
||||
.Nm
|
||||
.Op Fl benstuv
|
||||
.Op Fl belnstuv
|
||||
.Op Ar
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
@ -79,6 +79,16 @@ Display non-printing characters (see the
|
||||
option), and display a dollar sign
|
||||
.Pq Ql \&$
|
||||
at the end of each line.
|
||||
.It Fl l
|
||||
Set an exclusive advisory lock on the standard output file descriptor.
|
||||
This lock is set using
|
||||
.Xr fcntl 2
|
||||
with the
|
||||
.Dv F_SETLKW
|
||||
command.
|
||||
If the output file is already locked,
|
||||
.Nm
|
||||
will block until the lock is acquired.
|
||||
.It Fl n
|
||||
Number the output lines, starting at 1.
|
||||
.It Fl s
|
||||
@ -160,6 +170,7 @@ operand.
|
||||
.Xr tail 1 ,
|
||||
.Xr vis 1 ,
|
||||
.Xr zcat 1 ,
|
||||
.Xr fcntl 2 ,
|
||||
.Xr setbuf 3
|
||||
.Rs
|
||||
.%A Rob Pike
|
||||
@ -175,7 +186,7 @@ utility is compliant with the
|
||||
specification.
|
||||
.Pp
|
||||
The flags
|
||||
.Op Fl benstv
|
||||
.Op Fl belnstv
|
||||
are extensions to the specification.
|
||||
.Sh HISTORY
|
||||
A
|
||||
|
@ -64,7 +64,7 @@ __FBSDID("$FreeBSD$");
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
static int bflag, eflag, nflag, sflag, tflag, vflag;
|
||||
static int bflag, eflag, lflag, nflag, sflag, tflag, vflag;
|
||||
static int rval;
|
||||
static const char *filename;
|
||||
|
||||
@ -96,10 +96,11 @@ int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
int ch;
|
||||
struct flock stdout_lock;
|
||||
|
||||
setlocale(LC_CTYPE, "");
|
||||
|
||||
while ((ch = getopt(argc, argv, "benstuv")) != -1)
|
||||
while ((ch = getopt(argc, argv, "belnstuv")) != -1)
|
||||
switch (ch) {
|
||||
case 'b':
|
||||
bflag = nflag = 1; /* -b implies -n */
|
||||
@ -107,6 +108,9 @@ main(int argc, char *argv[])
|
||||
case 'e':
|
||||
eflag = vflag = 1; /* -e implies -v */
|
||||
break;
|
||||
case 'l':
|
||||
lflag = 1;
|
||||
break;
|
||||
case 'n':
|
||||
nflag = 1;
|
||||
break;
|
||||
@ -127,6 +131,15 @@ main(int argc, char *argv[])
|
||||
}
|
||||
argv += optind;
|
||||
|
||||
if (lflag) {
|
||||
stdout_lock.l_len = 0;
|
||||
stdout_lock.l_start = 0;
|
||||
stdout_lock.l_type = F_WRLCK;
|
||||
stdout_lock.l_whence = SEEK_SET;
|
||||
if (fcntl(STDOUT_FILENO, F_SETLKW, &stdout_lock) == -1)
|
||||
err(EXIT_FAILURE, "stdout");
|
||||
}
|
||||
|
||||
if (bflag || eflag || nflag || sflag || tflag || vflag)
|
||||
scanfiles(argv, 1);
|
||||
else
|
||||
@ -140,7 +153,7 @@ main(int argc, char *argv[])
|
||||
static void
|
||||
usage(void)
|
||||
{
|
||||
fprintf(stderr, "usage: cat [-benstuv] [file ...]\n");
|
||||
fprintf(stderr, "usage: cat [-belnstuv] [file ...]\n");
|
||||
exit(1);
|
||||
/* NOTREACHED */
|
||||
}
|
||||
|
12
bin/cp/cp.c
12
bin/cp/cp.c
@ -98,30 +98,28 @@ main(int argc, char *argv[])
|
||||
{
|
||||
struct stat to_stat, tmp_stat;
|
||||
enum op type;
|
||||
int Hflag, Lflag, Pflag, ch, fts_options, r, have_trailing_slash;
|
||||
int Hflag, Lflag, ch, fts_options, r, have_trailing_slash;
|
||||
char *target;
|
||||
|
||||
fts_options = FTS_NOCHDIR | FTS_PHYSICAL;
|
||||
Hflag = Lflag = Pflag = 0;
|
||||
Hflag = Lflag = 0;
|
||||
while ((ch = getopt(argc, argv, "HLPRafilnprvx")) != -1)
|
||||
switch (ch) {
|
||||
case 'H':
|
||||
Hflag = 1;
|
||||
Lflag = Pflag = 0;
|
||||
Lflag = 0;
|
||||
break;
|
||||
case 'L':
|
||||
Lflag = 1;
|
||||
Hflag = Pflag = 0;
|
||||
Hflag = 0;
|
||||
break;
|
||||
case 'P':
|
||||
Pflag = 1;
|
||||
Hflag = Lflag = 0;
|
||||
break;
|
||||
case 'R':
|
||||
Rflag = 1;
|
||||
break;
|
||||
case 'a':
|
||||
Pflag = 1;
|
||||
pflag = 1;
|
||||
Rflag = 1;
|
||||
Hflag = Lflag = 0;
|
||||
@ -146,7 +144,7 @@ main(int argc, char *argv[])
|
||||
break;
|
||||
case 'r':
|
||||
rflag = Lflag = 1;
|
||||
Hflag = Pflag = 0;
|
||||
Hflag = 0;
|
||||
break;
|
||||
case 'v':
|
||||
vflag = 1;
|
||||
|
@ -104,7 +104,7 @@ copy_file(const FTSENT *entp, int dne)
|
||||
if (vflag)
|
||||
printf("%s not overwritten\n", to.p_path);
|
||||
(void)close(from_fd);
|
||||
return (0);
|
||||
return (1);
|
||||
} else if (iflag) {
|
||||
(void)fprintf(stderr, "overwrite %s? %s",
|
||||
to.p_path, YESNO);
|
||||
@ -266,6 +266,11 @@ copy_link(const FTSENT *p, int exists)
|
||||
int len;
|
||||
char llink[PATH_MAX];
|
||||
|
||||
if (exists && nflag) {
|
||||
if (vflag)
|
||||
printf("%s not overwritten\n", to.p_path);
|
||||
return (1);
|
||||
}
|
||||
if ((len = readlink(p->fts_path, llink, sizeof(llink) - 1)) == -1) {
|
||||
warn("readlink: %s", p->fts_path);
|
||||
return (1);
|
||||
@ -285,6 +290,12 @@ copy_link(const FTSENT *p, int exists)
|
||||
int
|
||||
copy_fifo(struct stat *from_stat, int exists)
|
||||
{
|
||||
|
||||
if (exists && nflag) {
|
||||
if (vflag)
|
||||
printf("%s not overwritten\n", to.p_path);
|
||||
return (1);
|
||||
}
|
||||
if (exists && unlink(to.p_path)) {
|
||||
warn("unlink: %s", to.p_path);
|
||||
return (1);
|
||||
@ -299,6 +310,12 @@ copy_fifo(struct stat *from_stat, int exists)
|
||||
int
|
||||
copy_special(struct stat *from_stat, int exists)
|
||||
{
|
||||
|
||||
if (exists && nflag) {
|
||||
if (vflag)
|
||||
printf("%s not overwritten\n", to.p_path);
|
||||
return (1);
|
||||
}
|
||||
if (exists && unlink(to.p_path)) {
|
||||
warn("unlink: %s", to.p_path);
|
||||
return (1);
|
||||
|
@ -85,7 +85,7 @@ netsettime(time_t tval)
|
||||
dest.sin_addr.s_addr = htonl((u_long)INADDR_ANY);
|
||||
s = socket(AF_INET, SOCK_DGRAM, 0);
|
||||
if (s < 0) {
|
||||
if (errno != EPROTONOSUPPORT)
|
||||
if (errno != EAFNOSUPPORT)
|
||||
warn("timed");
|
||||
return (retval = 2);
|
||||
}
|
||||
|
112
bin/df/df.1
112
bin/df/df.1
@ -29,7 +29,7 @@
|
||||
.\" @(#)df.1 8.3 (Berkeley) 5/8/95
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd March 3, 2012
|
||||
.Dd January 24, 2013
|
||||
.Dt DF 1
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -39,6 +39,7 @@
|
||||
.Nm
|
||||
.Op Fl b | g | H | h | k | m | P
|
||||
.Op Fl acilnT
|
||||
.Op Fl \&,
|
||||
.Op Fl t Ar type
|
||||
.Op Ar file | filesystem ...
|
||||
.Sh DESCRIPTION
|
||||
@ -50,7 +51,8 @@ displays statistics about the amount of free disk space on the specified
|
||||
or on the file system of which
|
||||
.Ar file
|
||||
is a part.
|
||||
Values are displayed in 512-byte per block counts.
|
||||
By default block counts are displayed with an assumed block size of
|
||||
512 bytes.
|
||||
If neither a file or a file system operand is specified,
|
||||
statistics for all mounted file systems are displayed
|
||||
(subject to the
|
||||
@ -65,48 +67,54 @@ Show all mount points, including those that were mounted with the
|
||||
flag.
|
||||
This is implied for file systems specified on the command line.
|
||||
.It Fl b
|
||||
Use 512-byte blocks rather than the default.
|
||||
Note that
|
||||
this overrides the
|
||||
Explicitly use 512 byte blocks, overriding any
|
||||
.Ev BLOCKSIZE
|
||||
specification from the environment.
|
||||
This is the same as the
|
||||
.Fl P
|
||||
option.
|
||||
The
|
||||
.Fl k
|
||||
option overrides this option.
|
||||
.It Fl c
|
||||
Display a grand total.
|
||||
.It Fl g
|
||||
Use 1073741824-byte (1-Gbyte) blocks rather than the default.
|
||||
Note that
|
||||
this overrides the
|
||||
Use 1073741824 byte (1 Gibibyte) blocks rather than the default.
|
||||
This overrides any
|
||||
.Ev BLOCKSIZE
|
||||
specification from the environment.
|
||||
.It Fl H
|
||||
.Dq Human-readable
|
||||
output.
|
||||
Use unit suffixes: Byte, Kilobyte, Megabyte,
|
||||
Gigabyte, Terabyte and Petabyte in order to reduce the number of
|
||||
digits to four or fewer using base 10 for sizes.
|
||||
Use unit suffixes: Byte, Kibibyte, Mebibyte, Gibibyte, Tebibyte and
|
||||
Pebibyte (based on powers of 1024) in order to reduce the number of
|
||||
digits to four or fewer.
|
||||
.It Fl h
|
||||
.Dq Human-readable
|
||||
output.
|
||||
Use unit suffixes: Byte, Kilobyte, Megabyte,
|
||||
Gigabyte, Terabyte and Petabyte in order to reduce the number of
|
||||
digits to four or fewer using base 2 for sizes.
|
||||
Inodes statistics, if enabled with
|
||||
.Fl i ,
|
||||
are always printed in base 10.
|
||||
Gigabyte, Terabyte and Petabyte (based on powers of 1000) in order to
|
||||
reduce the number of
|
||||
digits to four or fewer.
|
||||
.It Fl i
|
||||
Include statistics on the number of free inodes.
|
||||
Include statistics on the number of free and used inodes.
|
||||
In conjunction with the
|
||||
.Fl h
|
||||
or
|
||||
.Fl H
|
||||
options, the number of inodes is scaled by powers of 1000.
|
||||
.It Fl k
|
||||
Use 1024-byte (1-Kbyte) blocks rather than the default.
|
||||
Note that
|
||||
this overrides the
|
||||
Use 1024 byte (1 Kibibyte) blocks rather than the default.
|
||||
This overrides the
|
||||
.Fl P
|
||||
option and any
|
||||
.Ev BLOCKSIZE
|
||||
specification from the environment.
|
||||
.It Fl l
|
||||
Only display information about locally-mounted file systems.
|
||||
.It Fl m
|
||||
Use 1048576-byte (1-Mbyte) blocks rather than the default.
|
||||
Note that
|
||||
this overrides the
|
||||
Use 1048576 byte (1 Mebibyte) blocks rather than the default.
|
||||
This overrides any
|
||||
.Ev BLOCKSIZE
|
||||
specification from the environment.
|
||||
.It Fl n
|
||||
@ -119,10 +127,15 @@ When this option is specified,
|
||||
will not request new statistics from the file systems, but will respond
|
||||
with the possibly stale statistics that were previously obtained.
|
||||
.It Fl P
|
||||
Use POSIX compliant output of 512-byte blocks rather than the default.
|
||||
Note that this overrides the
|
||||
Explicitly use 512 byte blocks, overriding any
|
||||
.Ev BLOCKSIZE
|
||||
specification from the environment.
|
||||
This is the same as the
|
||||
.Fl b
|
||||
option.
|
||||
The
|
||||
.Fl k
|
||||
option overrides this option.
|
||||
.It Fl t
|
||||
Only print out statistics for file systems of the specified types.
|
||||
More than one type may be specified in a comma separated list.
|
||||
@ -148,26 +161,53 @@ command can be used to find out the types of file systems
|
||||
that are available on the system.
|
||||
.It Fl T
|
||||
Include file system type.
|
||||
.It Fl ,
|
||||
(Comma) Print sizes grouped and separated by thousands using the
|
||||
non-monetary separator returned by
|
||||
.Xr localeconv 3 ,
|
||||
typically a comma or period.
|
||||
If no locale is set, or the locale does not have a non-monetary separator, this
|
||||
option has no effect.
|
||||
.El
|
||||
.Sh ENVIRONMENT
|
||||
.Bl -tag -width BLOCKSIZE
|
||||
.It Ev BLOCKSIZE
|
||||
If the environment variable
|
||||
.Ev BLOCKSIZE
|
||||
is set, the block counts will be displayed in units of that size block.
|
||||
Specifies the units in which to report block counts.
|
||||
This uses
|
||||
.Xr getbsize 3 ,
|
||||
which allows units of bytes or numbers scaled with the letters
|
||||
.Em k
|
||||
(for multiples of 1024 bytes),
|
||||
.Em m
|
||||
(for multiples of 1048576 bytes) or
|
||||
.Em g
|
||||
(for gibibytes).
|
||||
The allowed range is 512 bytes to 1 GB.
|
||||
If the value is outside, it will be set to the appropriate limit.
|
||||
.El
|
||||
.Sh SEE ALSO
|
||||
.Xr lsvfs 1 ,
|
||||
.Xr pstat 1 ,
|
||||
.Xr quota 1 ,
|
||||
.Xr swapinfo 1 ,
|
||||
.Xr fstatfs 2 ,
|
||||
.Xr getfsstat 2 ,
|
||||
.Xr statfs 2 ,
|
||||
.Xr getbsize 3 ,
|
||||
.Xr getmntinfo 3 ,
|
||||
.Xr localeconv 3 ,
|
||||
.Xr fstab 5 ,
|
||||
.Xr mount 8 ,
|
||||
.Xr quot 8
|
||||
.Xr quot 8 .
|
||||
.Sh STANDARDS
|
||||
With the exception of most options,
|
||||
the
|
||||
.Nm
|
||||
utility conforms to
|
||||
.St -p1003.1-2004 ,
|
||||
which defines only the
|
||||
.Fl k , P
|
||||
and
|
||||
.Fl t
|
||||
options.
|
||||
.Sh HISTORY
|
||||
A
|
||||
.Nm
|
||||
@ -180,3 +220,13 @@ flag is ignored if a file or file system is specified.
|
||||
Also, if a mount
|
||||
point is not accessible by the user, it is possible that the file system
|
||||
information could be stale.
|
||||
.Pp
|
||||
The
|
||||
.Fl b
|
||||
and
|
||||
.Fl P
|
||||
options are identical.
|
||||
The former comes from the BSD tradition, and the latter is required
|
||||
for
|
||||
.St -p1003.1-2004
|
||||
conformity.
|
||||
|
47
bin/df/df.c
47
bin/df/df.c
@ -53,6 +53,7 @@ __FBSDID("$FreeBSD$");
|
||||
#include <ufs/ufs/ufsmount.h>
|
||||
#include <err.h>
|
||||
#include <libutil.h>
|
||||
#include <locale.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
@ -95,6 +96,7 @@ imax(int a, int b)
|
||||
}
|
||||
|
||||
static int aflag = 0, cflag, hflag, iflag, kflag, lflag = 0, nflag, Tflag;
|
||||
static int thousands;
|
||||
static struct ufs_args mdev;
|
||||
|
||||
int
|
||||
@ -111,12 +113,12 @@ main(int argc, char *argv[])
|
||||
int ch, rv;
|
||||
|
||||
fstype = "ufs";
|
||||
|
||||
(void)setlocale(LC_ALL, "");
|
||||
memset(&totalbuf, 0, sizeof(totalbuf));
|
||||
totalbuf.f_bsize = DEV_BSIZE;
|
||||
strlcpy(totalbuf.f_mntfromname, "total", MNAMELEN);
|
||||
vfslist = NULL;
|
||||
while ((ch = getopt(argc, argv, "abcgHhiklmnPt:T")) != -1)
|
||||
while ((ch = getopt(argc, argv, "abcgHhiklmnPt:T,")) != -1)
|
||||
switch (ch) {
|
||||
case 'a':
|
||||
aflag = 1;
|
||||
@ -180,6 +182,9 @@ main(int argc, char *argv[])
|
||||
case 'T':
|
||||
Tflag = 1;
|
||||
break;
|
||||
case ',':
|
||||
thousands = 1;
|
||||
break;
|
||||
case '?':
|
||||
default:
|
||||
usage();
|
||||
@ -388,16 +393,11 @@ prthumanvalinode(int64_t bytes)
|
||||
|
||||
/*
|
||||
* Convert statfs returned file system size into BLOCKSIZE units.
|
||||
* Attempts to avoid overflow for large file systems.
|
||||
*/
|
||||
static intmax_t
|
||||
fsbtoblk(int64_t num, uint64_t fsbs, u_long bs)
|
||||
{
|
||||
|
||||
if (fsbs != 0 && fsbs < bs)
|
||||
return (num / (intmax_t)(bs / fsbs));
|
||||
else
|
||||
return (num * (intmax_t)(fsbs / bs));
|
||||
return (num * (intmax_t) fsbs / (int64_t) bs);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -410,10 +410,18 @@ prtstat(struct statfs *sfsp, struct maxwidths *mwp)
|
||||
static int headerlen, timesthrough = 0;
|
||||
static const char *header;
|
||||
int64_t used, availblks, inodes;
|
||||
const char *format;
|
||||
|
||||
if (++timesthrough == 1) {
|
||||
mwp->mntfrom = imax(mwp->mntfrom, (int)strlen("Filesystem"));
|
||||
mwp->fstype = imax(mwp->fstype, (int)strlen("Type"));
|
||||
if (thousands) { /* make space for commas */
|
||||
mwp->total += (mwp->total - 1) / 3;
|
||||
mwp->used += (mwp->used - 1) / 3;
|
||||
mwp->avail += (mwp->avail - 1) / 3;
|
||||
mwp->iused += (mwp->iused - 1) / 3;
|
||||
mwp->ifree += (mwp->ifree - 1) / 3;
|
||||
}
|
||||
if (hflag) {
|
||||
header = " Size";
|
||||
mwp->total = mwp->used = mwp->avail =
|
||||
@ -428,7 +436,7 @@ prtstat(struct statfs *sfsp, struct maxwidths *mwp)
|
||||
(void)printf("%-*s", mwp->mntfrom, "Filesystem");
|
||||
if (Tflag)
|
||||
(void)printf(" %-*s", mwp->fstype, "Type");
|
||||
(void)printf(" %-*s %*s %*s Capacity", mwp->total, header,
|
||||
(void)printf(" %*s %*s %*s Capacity", mwp->total, header,
|
||||
mwp->used, "Used", mwp->avail, "Avail");
|
||||
if (iflag) {
|
||||
mwp->iused = imax(hflag ? 0 : mwp->iused,
|
||||
@ -440,6 +448,12 @@ prtstat(struct statfs *sfsp, struct maxwidths *mwp)
|
||||
}
|
||||
(void)printf(" Mounted on\n");
|
||||
}
|
||||
/* Check for 0 block size. Can this happen? */
|
||||
if (sfsp->f_bsize == 0) {
|
||||
warnx ("File system %s does not have a block size, assuming 512.",
|
||||
sfsp->f_mntonname);
|
||||
sfsp->f_bsize = 512;
|
||||
}
|
||||
(void)printf("%-*s", mwp->mntfrom, sfsp->f_mntfromname);
|
||||
if (Tflag)
|
||||
(void)printf(" %-*s", mwp->fstype, sfsp->f_fstypename);
|
||||
@ -448,7 +462,11 @@ prtstat(struct statfs *sfsp, struct maxwidths *mwp)
|
||||
if (hflag) {
|
||||
prthuman(sfsp, used);
|
||||
} else {
|
||||
(void)printf(" %*jd %*jd %*jd",
|
||||
if (thousands)
|
||||
format = " %*j'd %*j'd %*j'd";
|
||||
else
|
||||
format = " %*jd %*jd %*jd";
|
||||
(void)printf(format,
|
||||
mwp->total, fsbtoblk(sfsp->f_blocks,
|
||||
sfsp->f_bsize, blocksize),
|
||||
mwp->used, fsbtoblk(used, sfsp->f_bsize, blocksize),
|
||||
@ -465,7 +483,11 @@ prtstat(struct statfs *sfsp, struct maxwidths *mwp)
|
||||
prthumanvalinode(used);
|
||||
prthumanvalinode(sfsp->f_ffree);
|
||||
} else {
|
||||
(void)printf(" %*jd %*jd", mwp->iused, (intmax_t)used,
|
||||
if (thousands)
|
||||
format = " %*j'd %*j'd";
|
||||
else
|
||||
format = " %*jd %*jd";
|
||||
(void)printf(format, mwp->iused, (intmax_t)used,
|
||||
mwp->ifree, (intmax_t)sfsp->f_ffree);
|
||||
}
|
||||
(void)printf(" %4.0f%% ", inodes == 0 ? 100.0 :
|
||||
@ -542,7 +564,8 @@ usage(void)
|
||||
{
|
||||
|
||||
(void)fprintf(stderr,
|
||||
"usage: df [-b | -g | -H | -h | -k | -m | -P] [-acilnT] [-t type] [file | filesystem ...]\n");
|
||||
"usage: df [-b | -g | -H | -h | -k | -m | -P] [-acilnT] [-t type] [-,]\n"
|
||||
" [file | filesystem ...]\n");
|
||||
exit(EX_USAGE);
|
||||
}
|
||||
|
||||
|
@ -291,7 +291,7 @@ implementations.
|
||||
.Pp
|
||||
The
|
||||
.Fl F
|
||||
option is
|
||||
option is a
|
||||
.Fx
|
||||
extension and should not be used in portable scripts.
|
||||
.Sh SEE ALSO
|
||||
|
20
bin/ls/cmp.c
20
bin/ls/cmp.c
@ -78,7 +78,10 @@ modcmp(const FTSENT *a, const FTSENT *b)
|
||||
if (b->fts_statp->st_mtim.tv_nsec <
|
||||
a->fts_statp->st_mtim.tv_nsec)
|
||||
return (-1);
|
||||
return (strcoll(a->fts_name, b->fts_name));
|
||||
if (f_samesort)
|
||||
return (strcoll(b->fts_name, a->fts_name));
|
||||
else
|
||||
return (strcoll(a->fts_name, b->fts_name));
|
||||
}
|
||||
|
||||
int
|
||||
@ -104,7 +107,10 @@ acccmp(const FTSENT *a, const FTSENT *b)
|
||||
if (b->fts_statp->st_atim.tv_nsec <
|
||||
a->fts_statp->st_atim.tv_nsec)
|
||||
return (-1);
|
||||
return (strcoll(a->fts_name, b->fts_name));
|
||||
if (f_samesort)
|
||||
return (strcoll(b->fts_name, a->fts_name));
|
||||
else
|
||||
return (strcoll(a->fts_name, b->fts_name));
|
||||
}
|
||||
|
||||
int
|
||||
@ -130,7 +136,10 @@ birthcmp(const FTSENT *a, const FTSENT *b)
|
||||
if (b->fts_statp->st_birthtim.tv_nsec <
|
||||
a->fts_statp->st_birthtim.tv_nsec)
|
||||
return (-1);
|
||||
return (strcoll(a->fts_name, b->fts_name));
|
||||
if (f_samesort)
|
||||
return (strcoll(b->fts_name, a->fts_name));
|
||||
else
|
||||
return (strcoll(a->fts_name, b->fts_name));
|
||||
}
|
||||
|
||||
int
|
||||
@ -156,7 +165,10 @@ statcmp(const FTSENT *a, const FTSENT *b)
|
||||
if (b->fts_statp->st_ctim.tv_nsec <
|
||||
a->fts_statp->st_ctim.tv_nsec)
|
||||
return (-1);
|
||||
return (strcoll(a->fts_name, b->fts_name));
|
||||
if (f_samesort)
|
||||
return (strcoll(b->fts_name, a->fts_name));
|
||||
else
|
||||
return (strcoll(a->fts_name, b->fts_name));
|
||||
}
|
||||
|
||||
int
|
||||
|
@ -55,12 +55,12 @@ int prn_octal(const char *);
|
||||
int prn_printable(const char *);
|
||||
#ifdef COLORLS
|
||||
void parsecolors(const char *cs);
|
||||
void colorquit(int);
|
||||
void colorquit(int);
|
||||
|
||||
extern char *ansi_fgcol;
|
||||
extern char *ansi_bgcol;
|
||||
extern char *ansi_coloff;
|
||||
extern char *attrs_off;
|
||||
extern char *enter_bold;
|
||||
extern char *ansi_fgcol;
|
||||
extern char *ansi_bgcol;
|
||||
extern char *ansi_coloff;
|
||||
extern char *attrs_off;
|
||||
extern char *enter_bold;
|
||||
#endif
|
||||
extern int termwidth;
|
||||
|
72
bin/ls/ls.1
72
bin/ls/ls.1
@ -32,7 +32,7 @@
|
||||
.\" @(#)ls.1 8.7 (Berkeley) 7/29/94
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd September 28, 2011
|
||||
.Dd November 8, 2012
|
||||
.Dt LS 1
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -40,7 +40,7 @@
|
||||
.Nd list directory contents
|
||||
.Sh SYNOPSIS
|
||||
.Nm
|
||||
.Op Fl ABCFGHILPRSTUWZabcdfghiklmnopqrstuwx1
|
||||
.Op Fl ABCFGHILPRSTUWZabcdfghiklmnopqrstuwxy1,
|
||||
.Op Fl D Ar format
|
||||
.Op Ar
|
||||
.Sh DESCRIPTION
|
||||
@ -130,6 +130,8 @@ This option is equivalent to defining
|
||||
.Ev CLICOLOR
|
||||
in the environment.
|
||||
(See below.)
|
||||
This functionality can be compiled out by removing the definition of
|
||||
.Ev COLORLS .
|
||||
.It Fl H
|
||||
Symbolic links on the command line are followed.
|
||||
This option is assumed if
|
||||
@ -249,12 +251,35 @@ subsection below, except (if the long format is not also requested)
|
||||
the directory totals are not output when the output is in a
|
||||
single column, even if multi-column output is requested.
|
||||
.It Fl t
|
||||
Sort by time modified (most recently modified
|
||||
first) before sorting the operands in lexicographical
|
||||
order.
|
||||
Sort by descending time modified (most recently modified first). If two files
|
||||
have the same modification timestamp, sort their names in ascending
|
||||
lexicographical order.
|
||||
The
|
||||
.Fl r
|
||||
option reverses both of these sort orders.
|
||||
.Pp
|
||||
Note that these sort orders are contradictory: the time sequence is in
|
||||
descending order, the lexicographical sort is in ascending order.
|
||||
This behavior is mandated by
|
||||
.St -p1003.2 .
|
||||
This feature can cause problems listing files stored with sequential names on
|
||||
FAT file systems, such as from digital cameras, where it is possible to have
|
||||
more than one image with the same timestamp.
|
||||
In such a case, the photos cannot be listed in the sequence in which
|
||||
they were taken.
|
||||
To ensure the same sort order for time and for lexicographical sorting, set the
|
||||
environment variable
|
||||
.Ev LS_SAMESORT
|
||||
or use the
|
||||
.Fl y
|
||||
option.
|
||||
This causes
|
||||
.Nm
|
||||
to reverse the lexicographal sort order when sorting files with the
|
||||
same modification timestamp.
|
||||
.It Fl u
|
||||
Use time of last access,
|
||||
instead of last modification
|
||||
instead of time of last modification
|
||||
of the file for sorting
|
||||
.Pq Fl t
|
||||
or printing
|
||||
@ -268,6 +293,15 @@ The same as
|
||||
.Fl C ,
|
||||
except that the multi-column output is produced with entries sorted
|
||||
across, rather than down, the columns.
|
||||
.It Fl y
|
||||
When the
|
||||
.Fl t
|
||||
option is set, sort the alphabetical output in the same order as the time output.
|
||||
This has the same effect as setting
|
||||
.Ev LS_SAMESORT .
|
||||
See the description of the
|
||||
.Fl t
|
||||
option for more details.
|
||||
.It Fl 1
|
||||
(The numeric digit
|
||||
.Dq one . )
|
||||
@ -275,6 +309,15 @@ Force output to be
|
||||
one entry per line.
|
||||
This is the default when
|
||||
output is not to a terminal.
|
||||
.It Fl ,
|
||||
(Comma) When the
|
||||
.Fl l
|
||||
option is set, print file sizes grouped and separated by thousands using the
|
||||
non-monetary separator returned by
|
||||
.Xr localeconv 3 ,
|
||||
typically a comma or period.
|
||||
If no locale is set, or the locale does not have a non-monetary separator, this
|
||||
option has no effect.
|
||||
.El
|
||||
.Pp
|
||||
The
|
||||
@ -529,7 +572,7 @@ variable is defined.
|
||||
.It Ev CLICOLOR_FORCE
|
||||
Color sequences are normally disabled if the output is not directed to
|
||||
a terminal.
|
||||
This can be overridden by setting this flag.
|
||||
This can be overridden by setting this variable.
|
||||
The
|
||||
.Ev TERM
|
||||
variable still needs to reference a color capable terminal however
|
||||
@ -655,6 +698,14 @@ Not all columns have changeable widths.
|
||||
The fields are,
|
||||
in order: inode, block count, number of links, user name,
|
||||
group name, flags, file size, file name.
|
||||
.It Ev LS_SAMESORT
|
||||
If this variable is set, the
|
||||
.Fl t
|
||||
option sorts the names of files with the same modification timestamp in the same
|
||||
sense as the time sort.
|
||||
See the description of the
|
||||
.Fl t
|
||||
option for more details.
|
||||
.It Ev TERM
|
||||
The
|
||||
.Ev CLICOLOR
|
||||
@ -678,6 +729,7 @@ specification.
|
||||
.Xr getfacl 1 ,
|
||||
.Xr sort 1 ,
|
||||
.Xr xterm 1 ,
|
||||
.Xr localeconv 3 ,
|
||||
.Xr strftime 3 ,
|
||||
.Xr strmode 3 ,
|
||||
.Xr termcap 5 ,
|
||||
@ -716,3 +768,9 @@ option description might be a feature that was
|
||||
based on the fact that single-column output
|
||||
usually goes to something other than a terminal.
|
||||
It is debatable whether this is a design bug.
|
||||
.Pp
|
||||
.St -p1003.2
|
||||
mandates opposite sort orders for files with the same timestamp when
|
||||
sorting with the
|
||||
.Fl t
|
||||
option.
|
||||
|
106
bin/ls/ls.c
106
bin/ls/ls.c
@ -109,10 +109,11 @@ int termwidth = 80; /* default terminal width */
|
||||
int f_humanval; /* show human-readable file sizes */
|
||||
int f_inode; /* print inode */
|
||||
static int f_kblocks; /* print size in kilobytes */
|
||||
int f_label; /* show MAC label */
|
||||
static int f_listdir; /* list actual directory, not contents */
|
||||
static int f_listdot; /* list files beginning with . */
|
||||
static int f_noautodot; /* do not automatically enable -A for root */
|
||||
int f_longform; /* long listing format */
|
||||
static int f_noautodot; /* do not automatically enable -A for root */
|
||||
static int f_nofollow; /* don't follow symbolic link arguments */
|
||||
int f_nonprint; /* show unprintables as ? */
|
||||
static int f_nosort; /* don't sort output */
|
||||
@ -122,19 +123,21 @@ static int f_numericonly; /* don't convert uid/gid to name */
|
||||
int f_octal_escape; /* like f_octal but use C escapes if possible */
|
||||
static int f_recursive; /* ls subdirectories also */
|
||||
static int f_reversesort; /* reverse whatever sort is used */
|
||||
int f_sectime; /* print the real time for all files */
|
||||
int f_samesort; /* sort time and name in same direction */
|
||||
int f_sectime; /* print full time information */
|
||||
static int f_singlecol; /* use single column output */
|
||||
int f_size; /* list size in short listing */
|
||||
static int f_sizesort;
|
||||
int f_slash; /* similar to f_type, but only for dirs */
|
||||
int f_sortacross; /* sort across rows, not down columns */
|
||||
int f_statustime; /* use time of last mode change */
|
||||
static int f_stream; /* stream the output, separate with commas */
|
||||
int f_thousands; /* show file sizes with thousands separators */
|
||||
char *f_timeformat; /* user-specified time format */
|
||||
static int f_timesort; /* sort by time vice name */
|
||||
char *f_timeformat; /* user-specified time format */
|
||||
static int f_sizesort;
|
||||
int f_type; /* add type character for non-regular files */
|
||||
static int f_whiteout; /* show whiteout entries */
|
||||
int f_label; /* show MAC label */
|
||||
|
||||
#ifdef COLORLS
|
||||
int f_color; /* add type in color for non-regular files */
|
||||
|
||||
@ -180,8 +183,10 @@ main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
fts_options = FTS_PHYSICAL;
|
||||
while ((ch = getopt(argc, argv,
|
||||
"1ABCD:FGHILPRSTUWZabcdfghiklmnopqrstuwx")) != -1) {
|
||||
if (getenv("LS_SAMESORT"))
|
||||
f_samesort = 1;
|
||||
while ((ch = getopt(argc, argv,
|
||||
"1ABCD:FGHILPRSTUWXZabcdfghiklmnopqrstuwxy,")) != -1) {
|
||||
switch (ch) {
|
||||
/*
|
||||
* The -1, -C, -x and -l options all override each other so
|
||||
@ -192,17 +197,9 @@ main(int argc, char *argv[])
|
||||
f_longform = 0;
|
||||
f_stream = 0;
|
||||
break;
|
||||
case 'B':
|
||||
f_nonprint = 0;
|
||||
f_octal = 1;
|
||||
f_octal_escape = 0;
|
||||
break;
|
||||
case 'C':
|
||||
f_sortacross = f_longform = f_singlecol = 0;
|
||||
break;
|
||||
case 'D':
|
||||
f_timeformat = optarg;
|
||||
break;
|
||||
case 'l':
|
||||
f_longform = 1;
|
||||
f_singlecol = 0;
|
||||
@ -229,16 +226,46 @@ main(int argc, char *argv[])
|
||||
f_accesstime = 0;
|
||||
f_statustime = 0;
|
||||
break;
|
||||
case 'a':
|
||||
fts_options |= FTS_SEEDOT;
|
||||
/* FALLTHROUGH */
|
||||
case 'A':
|
||||
f_listdot = 1;
|
||||
break;
|
||||
/* The -t and -S options override each other. */
|
||||
case 'S':
|
||||
f_sizesort = 1;
|
||||
f_timesort = 0;
|
||||
break;
|
||||
case 't':
|
||||
f_timesort = 1;
|
||||
f_sizesort = 0;
|
||||
break;
|
||||
/* Other flags. Please keep alphabetic. */
|
||||
case ',':
|
||||
f_thousands = 1;
|
||||
break;
|
||||
case 'B':
|
||||
f_nonprint = 0;
|
||||
f_octal = 1;
|
||||
f_octal_escape = 0;
|
||||
break;
|
||||
case 'D':
|
||||
f_timeformat = optarg;
|
||||
break;
|
||||
case 'F':
|
||||
f_type = 1;
|
||||
f_slash = 0;
|
||||
break;
|
||||
case 'G':
|
||||
setenv("CLICOLOR", "", 1);
|
||||
break;
|
||||
case 'H':
|
||||
fts_options |= FTS_COMFOLLOW;
|
||||
f_nofollow = 0;
|
||||
break;
|
||||
case 'G':
|
||||
setenv("CLICOLOR", "", 1);
|
||||
case 'I':
|
||||
f_noautodot = 1;
|
||||
break;
|
||||
case 'L':
|
||||
fts_options &= ~FTS_PHYSICAL;
|
||||
@ -254,14 +281,19 @@ main(int argc, char *argv[])
|
||||
case 'R':
|
||||
f_recursive = 1;
|
||||
break;
|
||||
case 'a':
|
||||
fts_options |= FTS_SEEDOT;
|
||||
/* FALLTHROUGH */
|
||||
case 'A':
|
||||
f_listdot = 1;
|
||||
case 'T':
|
||||
f_sectime = 1;
|
||||
break;
|
||||
case 'I':
|
||||
f_noautodot = 1;
|
||||
case 'W':
|
||||
f_whiteout = 1;
|
||||
break;
|
||||
case 'Z':
|
||||
f_label = 1;
|
||||
break;
|
||||
case 'b':
|
||||
f_nonprint = 0;
|
||||
f_octal = 0;
|
||||
f_octal_escape = 1;
|
||||
break;
|
||||
/* The -d option turns off the -R option. */
|
||||
case 'd':
|
||||
@ -309,33 +341,13 @@ main(int argc, char *argv[])
|
||||
case 's':
|
||||
f_size = 1;
|
||||
break;
|
||||
case 'T':
|
||||
f_sectime = 1;
|
||||
break;
|
||||
/* The -t and -S options override each other. */
|
||||
case 't':
|
||||
f_timesort = 1;
|
||||
f_sizesort = 0;
|
||||
break;
|
||||
case 'S':
|
||||
f_sizesort = 1;
|
||||
f_timesort = 0;
|
||||
break;
|
||||
case 'W':
|
||||
f_whiteout = 1;
|
||||
break;
|
||||
case 'b':
|
||||
f_nonprint = 0;
|
||||
f_octal = 0;
|
||||
f_octal_escape = 1;
|
||||
break;
|
||||
case 'w':
|
||||
f_nonprint = 0;
|
||||
f_octal = 0;
|
||||
f_octal_escape = 0;
|
||||
break;
|
||||
case 'Z':
|
||||
f_label = 1;
|
||||
case 'y':
|
||||
f_samesort = 1;
|
||||
break;
|
||||
default:
|
||||
case '?':
|
||||
@ -849,6 +861,8 @@ label_out:
|
||||
d.s_size = sizelen;
|
||||
d.s_user = maxuser;
|
||||
}
|
||||
if (f_thousands) /* make space for commas */
|
||||
d.s_size += (d.s_size - 1) / 3;
|
||||
printfcn(&d);
|
||||
output = 1;
|
||||
|
||||
|
@ -49,12 +49,14 @@ extern int f_longform; /* long listing format */
|
||||
extern int f_octal; /* print unprintables in octal */
|
||||
extern int f_octal_escape; /* like f_octal but use C escapes if possible */
|
||||
extern int f_nonprint; /* show unprintables as ? */
|
||||
extern int f_samesort; /* sort time and name in same direction */
|
||||
extern int f_sectime; /* print the real time for all files */
|
||||
extern int f_size; /* list size in short listing */
|
||||
extern int f_slash; /* append a '/' if the file is a directory */
|
||||
extern int f_sortacross; /* sort across rows, not down columns */
|
||||
extern int f_statustime; /* use time of last mode change */
|
||||
extern char *f_timeformat; /* user-specified time format */
|
||||
extern int f_thousands; /* show file sizes with thousands separators */
|
||||
extern char *f_timeformat; /* user-specified time format */
|
||||
extern int f_notabs; /* don't use tab-separated multi-col output */
|
||||
extern int f_type; /* add type character for non-regular files */
|
||||
#ifdef COLORLS
|
||||
|
@ -606,6 +606,10 @@ printsize(size_t width, off_t bytes)
|
||||
humanize_number(buf, sizeof(buf), (int64_t)bytes, "",
|
||||
HN_AUTOSCALE, HN_B | HN_NOSPACE | HN_DECIMAL);
|
||||
(void)printf("%*s ", (u_int)width, buf);
|
||||
} else if (f_thousands) { /* with commas */
|
||||
/* This format assignment needed to work round gcc bug. */
|
||||
const char *format = "%*j'd ";
|
||||
(void)printf(format, (u_int)width, bytes);
|
||||
} else
|
||||
(void)printf("%*jd ", (u_int)width, bytes);
|
||||
}
|
||||
|
@ -132,7 +132,7 @@ prn_printable(const char *s)
|
||||
* to fix this as an efficient fix would involve a lookup table. Same goes
|
||||
* for the rather inelegant code in prn_octal.
|
||||
*
|
||||
* DES 1998/04/23
|
||||
* DES 1998/04/23
|
||||
*/
|
||||
|
||||
size_t
|
||||
@ -175,7 +175,7 @@ prn_octal(const char *s)
|
||||
size_t clen;
|
||||
unsigned char ch;
|
||||
int goodchar, i, len, prtlen;
|
||||
|
||||
|
||||
memset(&mbs, 0, sizeof(mbs));
|
||||
len = 0;
|
||||
while ((clen = mbrtowc(&wc, s, MB_LEN_MAX, &mbs)) != 0) {
|
||||
@ -184,7 +184,10 @@ prn_octal(const char *s)
|
||||
for (i = 0; i < (int)clen; i++)
|
||||
putchar((unsigned char)s[i]);
|
||||
len += wcwidth(wc);
|
||||
} else if (goodchar && f_octal_escape && wc >= 0 &&
|
||||
} else if (goodchar && f_octal_escape &&
|
||||
#if WCHAR_MIN < 0
|
||||
wc >= 0 &&
|
||||
#endif
|
||||
wc <= (wchar_t)UCHAR_MAX &&
|
||||
(p = strchr(esc, (char)wc)) != NULL) {
|
||||
putchar('\\');
|
||||
@ -200,9 +203,9 @@ prn_octal(const char *s)
|
||||
for (i = 0; i < prtlen; i++) {
|
||||
ch = (unsigned char)s[i];
|
||||
putchar('\\');
|
||||
putchar('0' + (ch >> 6));
|
||||
putchar('0' + ((ch >> 3) & 7));
|
||||
putchar('0' + (ch & 7));
|
||||
putchar('0' + (ch >> 6));
|
||||
putchar('0' + ((ch >> 3) & 7));
|
||||
putchar('0' + (ch & 7));
|
||||
len += 4;
|
||||
}
|
||||
}
|
||||
@ -222,9 +225,9 @@ usage(void)
|
||||
{
|
||||
(void)fprintf(stderr,
|
||||
#ifdef COLORLS
|
||||
"usage: ls [-ABCFGHILPRSTUWZabcdfghiklmnopqrstuwx1] [-D format]"
|
||||
"usage: ls [-ABCFGHILPRSTUWZabcdfghiklmnopqrstuwxy1,] [-D format]"
|
||||
#else
|
||||
"usage: ls [-ABCFHILPRSTUWZabcdfghiklmnopqrstuwx1] [-D format]"
|
||||
"usage: ls [-ABCFHILPRSTUWZabcdfghiklmnopqrstuwxy1,] [-D format]"
|
||||
#endif
|
||||
" [file ...]\n");
|
||||
exit(1);
|
||||
|
@ -199,7 +199,7 @@ do_move(const char *from, const char *to)
|
||||
} else if (iflg) {
|
||||
(void)fprintf(stderr, "overwrite %s? %s", to, YESNO);
|
||||
ask = 1;
|
||||
} else if (access(to, W_OK) && !stat(to, &sb)) {
|
||||
} else if (access(to, W_OK) && !stat(to, &sb) && isatty(STDIN_FILENO)) {
|
||||
strmode(sb.st_mode, modep);
|
||||
(void)fprintf(stderr, "override %s%s%s/%s for %s? %s",
|
||||
modep + 1, modep[9] == ' ' ? "" : " ",
|
||||
|
@ -51,7 +51,7 @@ char *elapsed(KINFO *, VARENT *);
|
||||
char *elapseds(KINFO *, VARENT *);
|
||||
char *emulname(KINFO *, VARENT *);
|
||||
VARENT *find_varentry(VAR *);
|
||||
const char *fmt_argv(char **, char *, size_t);
|
||||
const char *fmt_argv(char **, char *, char *, size_t);
|
||||
double getpcpu(const KINFO *);
|
||||
char *kvar(KINFO *, VARENT *);
|
||||
char *label(KINFO *, VARENT *);
|
||||
|
13
bin/ps/fmt.c
13
bin/ps/fmt.c
@ -105,7 +105,7 @@ cmdpart(char *arg0)
|
||||
}
|
||||
|
||||
const char *
|
||||
fmt_argv(char **argv, char *cmd, size_t maxlen)
|
||||
fmt_argv(char **argv, char *cmd, char *thread, size_t maxlen)
|
||||
{
|
||||
size_t len;
|
||||
char *ap, *cp;
|
||||
@ -122,9 +122,14 @@ fmt_argv(char **argv, char *cmd, size_t maxlen)
|
||||
cp = malloc(len);
|
||||
if (cp == NULL)
|
||||
errx(1, "malloc failed");
|
||||
if (ap == NULL)
|
||||
sprintf(cp, "[%.*s]", (int)maxlen, cmd);
|
||||
else if (strncmp(cmdpart(argv[0]), cmd, maxlen) != 0)
|
||||
if (ap == NULL) {
|
||||
if (thread != NULL) {
|
||||
asprintf(&ap, "%s/%s", cmd, thread);
|
||||
sprintf(cp, "[%.*s]", (int)maxlen, ap);
|
||||
free(ap);
|
||||
} else
|
||||
sprintf(cp, "[%.*s]", (int)maxlen, cmd);
|
||||
} else if (strncmp(cmdpart(argv[0]), cmd, maxlen) != 0)
|
||||
sprintf(cp, "%s (%.*s)", ap, (int)maxlen, cmd);
|
||||
else
|
||||
strcpy(cp, ap);
|
||||
|
@ -29,7 +29,7 @@
|
||||
.\" @(#)ps.1 8.3 (Berkeley) 4/18/94
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd September 18, 2012
|
||||
.Dd February 7, 2013
|
||||
.Dt PS 1
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -323,6 +323,7 @@ the include file
|
||||
.It Dv "P_INMEM" Ta No "0x10000000" Ta "Loaded into memory"
|
||||
.It Dv "P_SWAPPINGOUT" Ta No "0x20000000" Ta "Process is being swapped out"
|
||||
.It Dv "P_SWAPPINGIN" Ta No "0x40000000" Ta "Process is being swapped in"
|
||||
.It Dv "P_PPTRACE" Ta No "0x80000000" Ta "Vforked child issued ptrace(PT_TRACEME)"
|
||||
.El
|
||||
.It Cm label
|
||||
The MAC label of the process.
|
||||
|
31
bin/ps/ps.c
31
bin/ps/ps.c
@ -109,6 +109,7 @@ static int needcomm; /* -o "command" */
|
||||
static int needenv; /* -e */
|
||||
static int needuser; /* -o "user" */
|
||||
static int optfatal; /* Fatal error parsing some list-option. */
|
||||
static int pid_max; /* kern.max_pid */
|
||||
|
||||
static enum sort { DEFAULT, SORTMEM, SORTCPU } sortby = DEFAULT;
|
||||
|
||||
@ -140,7 +141,7 @@ static void format_output(KINFO *);
|
||||
static void *expand_list(struct listinfo *);
|
||||
static const char *
|
||||
fmt(char **(*)(kvm_t *, const struct kinfo_proc *, int),
|
||||
KINFO *, char *, int);
|
||||
KINFO *, char *, char *, int);
|
||||
static void free_list(struct listinfo *);
|
||||
static void init_list(struct listinfo *, addelem_rtn, int, const char *);
|
||||
static char *kludge_oldps_options(const char *, char *, const char *);
|
||||
@ -148,6 +149,7 @@ static int pscomp(const void *, const void *);
|
||||
static void saveuser(KINFO *);
|
||||
static void scanvars(void);
|
||||
static void sizevars(void);
|
||||
static void pidmax_init(void);
|
||||
static void usage(void);
|
||||
|
||||
static char dfmt[] = "pid,tt,state,time,command";
|
||||
@ -200,6 +202,8 @@ main(int argc, char *argv[])
|
||||
if (argc > 1)
|
||||
argv[1] = kludge_oldps_options(PS_ARGS, argv[1], argv[2]);
|
||||
|
||||
pidmax_init();
|
||||
|
||||
all = descendancy = _fmt = nselectors = optfatal = 0;
|
||||
prtheader = showthreads = wflag = xkeep_implied = 0;
|
||||
xkeep = -1; /* Neither -x nor -X. */
|
||||
@ -722,7 +726,6 @@ addelem_gid(struct listinfo *inf, const char *elem)
|
||||
return (1);
|
||||
}
|
||||
|
||||
#define BSD_PID_MAX 99999 /* Copy of PID_MAX from sys/proc.h. */
|
||||
static int
|
||||
addelem_pid(struct listinfo *inf, const char *elem)
|
||||
{
|
||||
@ -740,7 +743,7 @@ addelem_pid(struct listinfo *inf, const char *elem)
|
||||
if (*endp != '\0' || tempid < 0 || elem == endp) {
|
||||
warnx("Invalid %s: %s", inf->lname, elem);
|
||||
errno = ERANGE;
|
||||
} else if (errno != 0 || tempid > BSD_PID_MAX) {
|
||||
} else if (errno != 0 || tempid > pid_max) {
|
||||
warnx("%s too large: %s", inf->lname, elem);
|
||||
errno = ERANGE;
|
||||
}
|
||||
@ -753,7 +756,6 @@ addelem_pid(struct listinfo *inf, const char *elem)
|
||||
inf->l.pids[(inf->count)++] = tempid;
|
||||
return (1);
|
||||
}
|
||||
#undef BSD_PID_MAX
|
||||
|
||||
/*-
|
||||
* The user can specify a device via one of three formats:
|
||||
@ -1161,11 +1163,12 @@ sizevars(void)
|
||||
|
||||
static const char *
|
||||
fmt(char **(*fn)(kvm_t *, const struct kinfo_proc *, int), KINFO *ki,
|
||||
char *comm, int maxlen)
|
||||
char *comm, char *thread, int maxlen)
|
||||
{
|
||||
const char *s;
|
||||
|
||||
s = fmt_argv((*fn)(kd, ki->ki_p, termwidth), comm, maxlen);
|
||||
s = fmt_argv((*fn)(kd, ki->ki_p, termwidth), comm,
|
||||
showthreads && ki->ki_p->ki_numthreads > 1 ? thread : NULL, maxlen);
|
||||
return (s);
|
||||
}
|
||||
|
||||
@ -1193,7 +1196,7 @@ saveuser(KINFO *ki)
|
||||
ki->ki_args = strdup("<defunct>");
|
||||
else if (UREADOK(ki) || (ki->ki_p->ki_args != NULL))
|
||||
ki->ki_args = strdup(fmt(kvm_getargv, ki,
|
||||
ki->ki_p->ki_comm, MAXCOMLEN));
|
||||
ki->ki_p->ki_comm, ki->ki_p->ki_tdname, MAXCOMLEN));
|
||||
else
|
||||
asprintf(&ki->ki_args, "(%s)", ki->ki_p->ki_comm);
|
||||
if (ki->ki_args == NULL)
|
||||
@ -1204,7 +1207,7 @@ saveuser(KINFO *ki)
|
||||
if (needenv) {
|
||||
if (UREADOK(ki))
|
||||
ki->ki_env = strdup(fmt(kvm_getenvv, ki,
|
||||
(char *)NULL, 0));
|
||||
(char *)NULL, (char *)NULL, 0));
|
||||
else
|
||||
ki->ki_env = strdup("()");
|
||||
if (ki->ki_env == NULL)
|
||||
@ -1351,6 +1354,18 @@ kludge_oldps_options(const char *optlist, char *origval, const char *nextarg)
|
||||
return (newopts);
|
||||
}
|
||||
|
||||
static void
|
||||
pidmax_init(void)
|
||||
{
|
||||
size_t intsize;
|
||||
|
||||
intsize = sizeof(pid_max);
|
||||
if (sysctlbyname("kern.pid_max", &pid_max, &intsize, NULL, 0) < 0) {
|
||||
warn("unable to read kern.pid_max");
|
||||
pid_max = 99999;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
usage(void)
|
||||
{
|
||||
|
@ -141,5 +141,5 @@ main(int argc, char *argv[])
|
||||
nleft -= n;
|
||||
}
|
||||
|
||||
return 0;
|
||||
exit(EX_OK);
|
||||
}
|
||||
|
@ -33,10 +33,6 @@ programs is:
|
||||
There are undoubtedly too many of these. Mkinit searches all the
|
||||
C source files for entries looking like:
|
||||
|
||||
INIT {
|
||||
x = 1; /* executed during initialization */
|
||||
}
|
||||
|
||||
RESET {
|
||||
x = 2; /* executed when the shell does a longjmp
|
||||
back to the main command loop */
|
||||
|
@ -68,7 +68,18 @@ setalias(const char *name, const char *val)
|
||||
if (equal(name, ap->name)) {
|
||||
INTOFF;
|
||||
ckfree(ap->val);
|
||||
/* See HACK below. */
|
||||
#ifdef notyet
|
||||
ap->val = savestr(val);
|
||||
#else
|
||||
{
|
||||
size_t len = strlen(val);
|
||||
ap->val = ckmalloc(len + 2);
|
||||
memcpy(ap->val, val, len);
|
||||
ap->val[len] = ' ';
|
||||
ap->val[len+1] = '\0';
|
||||
}
|
||||
#endif
|
||||
INTON;
|
||||
return;
|
||||
}
|
||||
|
@ -92,6 +92,7 @@ static void evalfor(union node *, int);
|
||||
static union node *evalcase(union node *);
|
||||
static void evalsubshell(union node *, int);
|
||||
static void evalredir(union node *, int);
|
||||
static void exphere(union node *, struct arglist *);
|
||||
static void expredir(union node *);
|
||||
static void evalpipe(union node *);
|
||||
static int is_valid_fast_cmdsubst(union node *n);
|
||||
@ -193,7 +194,9 @@ evaltree(union node *n, int flags)
|
||||
{
|
||||
int do_etest;
|
||||
union node *next;
|
||||
struct stackmark smark;
|
||||
|
||||
setstackmark(&smark);
|
||||
do_etest = 0;
|
||||
if (n == NULL) {
|
||||
TRACE(("evaltree(NULL) called\n"));
|
||||
@ -292,8 +295,10 @@ evaltree(union node *n, int flags)
|
||||
break;
|
||||
}
|
||||
n = next;
|
||||
popstackmark(&smark);
|
||||
} while (n != NULL);
|
||||
out:
|
||||
popstackmark(&smark);
|
||||
if (pendingsigs)
|
||||
dotrap();
|
||||
if (eflag && exitstatus != 0 && do_etest)
|
||||
@ -347,10 +352,8 @@ evalfor(union node *n, int flags)
|
||||
struct arglist arglist;
|
||||
union node *argp;
|
||||
struct strlist *sp;
|
||||
struct stackmark smark;
|
||||
int status;
|
||||
|
||||
setstackmark(&smark);
|
||||
arglist.lastp = &arglist.list;
|
||||
for (argp = n->nfor.args ; argp ; argp = argp->narg.next) {
|
||||
oexitstatus = exitstatus;
|
||||
@ -375,7 +378,6 @@ evalfor(union node *n, int flags)
|
||||
}
|
||||
}
|
||||
loopnest--;
|
||||
popstackmark(&smark);
|
||||
exitstatus = status;
|
||||
}
|
||||
|
||||
@ -392,16 +394,13 @@ evalcase(union node *n)
|
||||
union node *cp;
|
||||
union node *patp;
|
||||
struct arglist arglist;
|
||||
struct stackmark smark;
|
||||
|
||||
setstackmark(&smark);
|
||||
arglist.lastp = &arglist.list;
|
||||
oexitstatus = exitstatus;
|
||||
expandarg(n->ncase.expr, &arglist, EXP_TILDE);
|
||||
for (cp = n->ncase.cases ; cp ; cp = cp->nclist.next) {
|
||||
for (patp = cp->nclist.pattern ; patp ; patp = patp->narg.next) {
|
||||
if (casematch(patp, arglist.list->text)) {
|
||||
popstackmark(&smark);
|
||||
while (cp->nclist.next &&
|
||||
cp->type == NCLISTFALLTHRU &&
|
||||
cp->nclist.body == NULL)
|
||||
@ -415,7 +414,6 @@ evalcase(union node *n)
|
||||
}
|
||||
}
|
||||
}
|
||||
popstackmark(&smark);
|
||||
exitstatus = 0;
|
||||
return (NULL);
|
||||
}
|
||||
@ -491,6 +489,37 @@ evalredir(union node *n, int flags)
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
exphere(union node *redir, struct arglist *fn)
|
||||
{
|
||||
struct jmploc jmploc;
|
||||
struct jmploc *savehandler;
|
||||
struct localvar *savelocalvars;
|
||||
int need_longjmp = 0;
|
||||
|
||||
redir->nhere.expdoc = nullstr;
|
||||
savelocalvars = localvars;
|
||||
localvars = NULL;
|
||||
forcelocal++;
|
||||
savehandler = handler;
|
||||
if (setjmp(jmploc.loc))
|
||||
need_longjmp = exception != EXERROR && exception != EXEXEC;
|
||||
else {
|
||||
handler = &jmploc;
|
||||
expandarg(redir->nhere.doc, fn, 0);
|
||||
redir->nhere.expdoc = fn->list->text;
|
||||
INTOFF;
|
||||
}
|
||||
handler = savehandler;
|
||||
forcelocal--;
|
||||
poplocalvars();
|
||||
localvars = savelocalvars;
|
||||
if (need_longjmp)
|
||||
longjmp(handler->loc, 1);
|
||||
INTON;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Compute the names of the files in a redirection list.
|
||||
*/
|
||||
@ -519,6 +548,9 @@ expredir(union node *n)
|
||||
fixredir(redir, fn.list->text, 1);
|
||||
}
|
||||
break;
|
||||
case NXHERE:
|
||||
exphere(redir, &fn);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -610,7 +642,7 @@ evalbackcmd(union node *n, struct backcmd *result)
|
||||
{
|
||||
int pip[2];
|
||||
struct job *jp;
|
||||
struct stackmark smark; /* unnecessary */
|
||||
struct stackmark smark;
|
||||
struct jmploc jmploc;
|
||||
struct jmploc *savehandler;
|
||||
struct localvar *savelocalvars;
|
||||
@ -624,8 +656,8 @@ evalbackcmd(union node *n, struct backcmd *result)
|
||||
exitstatus = 0;
|
||||
goto out;
|
||||
}
|
||||
exitstatus = oexitstatus;
|
||||
if (is_valid_fast_cmdsubst(n)) {
|
||||
exitstatus = oexitstatus;
|
||||
savelocalvars = localvars;
|
||||
localvars = NULL;
|
||||
forcelocal++;
|
||||
@ -649,7 +681,6 @@ evalbackcmd(union node *n, struct backcmd *result)
|
||||
poplocalvars();
|
||||
localvars = savelocalvars;
|
||||
} else {
|
||||
exitstatus = 0;
|
||||
if (pipe(pip) < 0)
|
||||
error("Pipe call failed: %s", strerror(errno));
|
||||
jp = makejob(n, 1);
|
||||
@ -752,7 +783,6 @@ safe_builtin(int idx, int argc, char **argv)
|
||||
static void
|
||||
evalcommand(union node *cmd, int flags, struct backcmd *backcmd)
|
||||
{
|
||||
struct stackmark smark;
|
||||
union node *argp;
|
||||
struct arglist arglist;
|
||||
struct arglist varlist;
|
||||
@ -779,7 +809,6 @@ evalcommand(union node *cmd, int flags, struct backcmd *backcmd)
|
||||
|
||||
/* First expand the arguments. */
|
||||
TRACE(("evalcommand(%p, %d) called\n", (void *)cmd, flags));
|
||||
setstackmark(&smark);
|
||||
arglist.lastp = &arglist.list;
|
||||
varlist.lastp = &varlist.list;
|
||||
varflag = 1;
|
||||
@ -1070,6 +1099,7 @@ evalcommand(union node *cmd, int flags, struct backcmd *backcmd)
|
||||
}
|
||||
handler = &jmploc;
|
||||
redirect(cmd->ncmd.redirect, mode);
|
||||
outclearerror(out1);
|
||||
/*
|
||||
* If there is no command word, redirection errors should
|
||||
* not be fatal but assignment errors should.
|
||||
@ -1085,6 +1115,11 @@ evalcommand(union node *cmd, int flags, struct backcmd *backcmd)
|
||||
builtin_flags = flags;
|
||||
exitstatus = (*builtinfunc[cmdentry.u.index])(argc, argv);
|
||||
flushall();
|
||||
if (outiserror(out1)) {
|
||||
warning("write error on stdout");
|
||||
if (exitstatus == 0 || exitstatus == 1)
|
||||
exitstatus = 2;
|
||||
}
|
||||
cmddone:
|
||||
if (argc > 0)
|
||||
bltinunsetlocale();
|
||||
@ -1144,7 +1179,6 @@ out:
|
||||
setvar("_", lastarg, 0);
|
||||
if (do_clearcmdentry)
|
||||
clearcmdentry();
|
||||
popstackmark(&smark);
|
||||
}
|
||||
|
||||
|
||||
|
@ -78,7 +78,6 @@ __FBSDID("$FreeBSD$");
|
||||
|
||||
|
||||
#define CMDTABLESIZE 31 /* should be prime */
|
||||
#define ARB 1 /* actual size determined at run time */
|
||||
|
||||
|
||||
|
||||
@ -86,13 +85,13 @@ struct tblentry {
|
||||
struct tblentry *next; /* next entry in hash chain */
|
||||
union param param; /* definition of builtin function */
|
||||
int special; /* flag for special builtin commands */
|
||||
short cmdtype; /* index identifying command */
|
||||
char rehash; /* if set, cd done since entry created */
|
||||
char cmdname[ARB]; /* name of command */
|
||||
signed char cmdtype; /* index identifying command */
|
||||
char cmdname[]; /* name of command */
|
||||
};
|
||||
|
||||
|
||||
static struct tblentry *cmdtable[CMDTABLESIZE];
|
||||
static int cmdtable_cd = 0; /* cmdtable contains cd-dependent entries */
|
||||
int exerrno = 0; /* Last exec error */
|
||||
|
||||
|
||||
@ -306,8 +305,6 @@ printentry(struct tblentry *cmdp, int verbose)
|
||||
error("internal error: cmdtype %d", cmdp->cmdtype);
|
||||
#endif
|
||||
}
|
||||
if (cmdp->rehash)
|
||||
out1c('*');
|
||||
out1c('\n');
|
||||
}
|
||||
|
||||
@ -324,12 +321,12 @@ find_command(const char *name, struct cmdentry *entry, int act,
|
||||
{
|
||||
struct tblentry *cmdp, loc_cmd;
|
||||
int idx;
|
||||
int prev;
|
||||
char *fullname;
|
||||
struct stat statb;
|
||||
int e;
|
||||
int i;
|
||||
int spec;
|
||||
int cd;
|
||||
|
||||
/* If name contains a slash, don't use the hash table */
|
||||
if (strchr(name, '/') != NULL) {
|
||||
@ -338,8 +335,10 @@ find_command(const char *name, struct cmdentry *entry, int act,
|
||||
return;
|
||||
}
|
||||
|
||||
cd = 0;
|
||||
|
||||
/* If name is in the table, and not invalidated by cd, we're done */
|
||||
if ((cmdp = cmdlookup(name, 0)) != NULL && cmdp->rehash == 0) {
|
||||
if ((cmdp = cmdlookup(name, 0)) != NULL) {
|
||||
if (cmdp->cmdtype == CMDFUNCTION && act & DO_NOFUNC)
|
||||
cmdp = NULL;
|
||||
else
|
||||
@ -360,13 +359,6 @@ find_command(const char *name, struct cmdentry *entry, int act,
|
||||
}
|
||||
|
||||
/* We have to search path. */
|
||||
prev = -1; /* where to start */
|
||||
if (cmdp) { /* doing a rehash */
|
||||
if (cmdp->cmdtype == CMDBUILTIN)
|
||||
prev = -1;
|
||||
else
|
||||
prev = cmdp->param.index;
|
||||
}
|
||||
|
||||
e = ENOENT;
|
||||
idx = -1;
|
||||
@ -381,13 +373,8 @@ loop:
|
||||
goto loop; /* ignore unimplemented options */
|
||||
}
|
||||
}
|
||||
/* if rehash, don't redo absolute path names */
|
||||
if (fullname[0] == '/' && idx <= prev) {
|
||||
if (idx < prev)
|
||||
goto loop;
|
||||
TRACE(("searchexec \"%s\": no change\n", name));
|
||||
goto success;
|
||||
}
|
||||
if (fullname[0] != '/')
|
||||
cd = 1;
|
||||
if (stat(fullname, &statb) < 0) {
|
||||
if (errno != ENOENT && errno != ENOTDIR)
|
||||
e = errno;
|
||||
@ -427,9 +414,6 @@ loop:
|
||||
goto success;
|
||||
}
|
||||
|
||||
/* We failed. If there was an entry for this command, delete it */
|
||||
if (cmdp && cmdp->cmdtype != CMDFUNCTION)
|
||||
delete_cmd_entry();
|
||||
if (act & DO_ERR) {
|
||||
if (e == ENOENT || e == ENOTDIR)
|
||||
outfmt(out2, "%s: not found\n", name);
|
||||
@ -441,7 +425,8 @@ loop:
|
||||
return;
|
||||
|
||||
success:
|
||||
cmdp->rehash = 0;
|
||||
if (cd)
|
||||
cmdtable_cd = 1;
|
||||
entry->cmdtype = cmdp->cmdtype;
|
||||
entry->u = cmdp->param;
|
||||
entry->special = cmdp->special;
|
||||
@ -470,22 +455,15 @@ find_builtin(const char *name, int *special)
|
||||
|
||||
|
||||
/*
|
||||
* Called when a cd is done. Marks all commands so the next time they
|
||||
* are executed they will be rehashed.
|
||||
* Called when a cd is done. If any entry in cmdtable depends on the current
|
||||
* directory, simply clear cmdtable completely.
|
||||
*/
|
||||
|
||||
void
|
||||
hashcd(void)
|
||||
{
|
||||
struct tblentry **pp;
|
||||
struct tblentry *cmdp;
|
||||
|
||||
for (pp = cmdtable ; pp < &cmdtable[CMDTABLESIZE] ; pp++) {
|
||||
for (cmdp = *pp ; cmdp ; cmdp = cmdp->next) {
|
||||
if (cmdp->cmdtype == CMDNORMAL)
|
||||
cmdp->rehash = 1;
|
||||
}
|
||||
}
|
||||
if (cmdtable_cd)
|
||||
clearcmdentry();
|
||||
}
|
||||
|
||||
|
||||
@ -527,6 +505,7 @@ clearcmdentry(void)
|
||||
}
|
||||
}
|
||||
}
|
||||
cmdtable_cd = 0;
|
||||
INTON;
|
||||
}
|
||||
|
||||
@ -563,11 +542,10 @@ cmdlookup(const char *name, int add)
|
||||
}
|
||||
if (add && cmdp == NULL) {
|
||||
INTOFF;
|
||||
cmdp = *pp = ckmalloc(sizeof (struct tblentry) - ARB
|
||||
cmdp = *pp = ckmalloc(sizeof (struct tblentry)
|
||||
+ strlen(name) + 1);
|
||||
cmdp->next = NULL;
|
||||
cmdp->cmdtype = CMDUNKNOWN;
|
||||
cmdp->rehash = 0;
|
||||
strcpy(cmdp->cmdname, name);
|
||||
INTON;
|
||||
}
|
||||
|
@ -127,19 +127,6 @@ collate_range_cmp(wchar_t c1, wchar_t c2)
|
||||
return (wcscoll(s1, s2));
|
||||
}
|
||||
|
||||
/*
|
||||
* Expand shell variables and backquotes inside a here document.
|
||||
* union node *arg the document
|
||||
* int fd; where to write the expanded version
|
||||
*/
|
||||
|
||||
void
|
||||
expandhere(union node *arg, int fd)
|
||||
{
|
||||
expandarg(arg, (struct arglist *)NULL, 0);
|
||||
xwrite(fd, stackblock(), expdest - stackblock());
|
||||
}
|
||||
|
||||
static char *
|
||||
stputs_quotes(const char *data, const char *syntax, char *p)
|
||||
{
|
||||
|
@ -57,7 +57,6 @@ struct arglist {
|
||||
|
||||
|
||||
union node;
|
||||
void expandhere(union node *, int);
|
||||
void expandarg(union node *, struct arglist *, int);
|
||||
void expari(int);
|
||||
void rmescapes(char *);
|
||||
|
@ -33,5 +33,4 @@
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
void init(void);
|
||||
void reset(void);
|
||||
|
@ -64,7 +64,6 @@ __FBSDID("$FreeBSD$");
|
||||
|
||||
#define EOF_NLEFT -99 /* value of parsenleft when EOF pushed back */
|
||||
|
||||
MKINIT
|
||||
struct strpush {
|
||||
struct strpush *prev; /* preceding string on stack */
|
||||
char *prevstring;
|
||||
@ -78,7 +77,6 @@ struct strpush {
|
||||
* contains information about the current file being read.
|
||||
*/
|
||||
|
||||
MKINIT
|
||||
struct parsefile {
|
||||
struct parsefile *prev; /* preceding file on stack */
|
||||
int linno; /* current line */
|
||||
@ -96,10 +94,12 @@ int plinno = 1; /* input line number */
|
||||
int parsenleft; /* copy of parsefile->nleft */
|
||||
MKINIT int parselleft; /* copy of parsefile->lleft */
|
||||
char *parsenextc; /* copy of parsefile->nextc */
|
||||
MKINIT struct parsefile basepf; /* top level input file */
|
||||
char basebuf[BUFSIZ + 1]; /* buffer for top level input file */
|
||||
static char basebuf[BUFSIZ + 1];/* buffer for top level input file */
|
||||
static struct parsefile basepf = { /* top level input file */
|
||||
.nextc = basebuf,
|
||||
.buf = basebuf
|
||||
};
|
||||
static struct parsefile *parsefile = &basepf; /* current input file */
|
||||
int init_editline = 0; /* editline library initialized? */
|
||||
int whichprompt; /* 1 == PS1, 2 == PS2 */
|
||||
|
||||
EditLine *el; /* cookie for editline package */
|
||||
@ -112,12 +112,6 @@ static void popstring(void);
|
||||
INCLUDE "input.h"
|
||||
INCLUDE "error.h"
|
||||
|
||||
MKINIT char basebuf[];
|
||||
|
||||
INIT {
|
||||
basepf.nextc = basepf.buf = basebuf;
|
||||
}
|
||||
|
||||
RESET {
|
||||
popallfiles();
|
||||
parselleft = parsenleft = 0; /* clear input buffer */
|
||||
@ -350,7 +344,7 @@ pungetc(void)
|
||||
* We handle aliases this way.
|
||||
*/
|
||||
void
|
||||
pushstring(char *s, int len, void *ap)
|
||||
pushstring(char *s, int len, struct alias *ap)
|
||||
{
|
||||
struct strpush *sp;
|
||||
|
||||
@ -365,9 +359,9 @@ pushstring(char *s, int len, void *ap)
|
||||
sp->prevstring = parsenextc;
|
||||
sp->prevnleft = parsenleft;
|
||||
sp->prevlleft = parselleft;
|
||||
sp->ap = (struct alias *)ap;
|
||||
sp->ap = ap;
|
||||
if (ap)
|
||||
((struct alias *)ap)->flag |= ALIASINUSE;
|
||||
ap->flag |= ALIASINUSE;
|
||||
parsenextc = s;
|
||||
parsenleft = len;
|
||||
INTON;
|
||||
|
@ -43,8 +43,8 @@
|
||||
extern int plinno;
|
||||
extern int parsenleft; /* number of characters left in input buffer */
|
||||
extern char *parsenextc; /* next character in input buffer */
|
||||
extern int init_editline; /* 0 == not setup, 1 == OK, -1 == failed */
|
||||
|
||||
struct alias;
|
||||
struct parsefile;
|
||||
|
||||
char *pfgets(char *, int);
|
||||
@ -52,7 +52,7 @@ int pgetc(void);
|
||||
int preadbuffer(void);
|
||||
int preadateof(void);
|
||||
void pungetc(void);
|
||||
void pushstring(char *, int, void *);
|
||||
void pushstring(char *, int, struct alias *);
|
||||
void setinputfile(const char *, int);
|
||||
void setinputfd(int, int);
|
||||
void setinputstring(char *, int);
|
||||
|
@ -298,6 +298,7 @@ showjob(struct job *jp, int mode)
|
||||
{
|
||||
char s[64];
|
||||
char statestr[64];
|
||||
const char *sigstr;
|
||||
struct procstat *ps;
|
||||
struct job *j;
|
||||
int col, curr, i, jobno, prev, procno;
|
||||
@ -324,8 +325,9 @@ showjob(struct job *jp, int mode)
|
||||
i = WSTOPSIG(ps->status);
|
||||
else
|
||||
i = -1;
|
||||
if (i > 0 && i < sys_nsig && sys_siglist[i])
|
||||
strcpy(statestr, sys_siglist[i]);
|
||||
sigstr = strsignal(i);
|
||||
if (sigstr != NULL)
|
||||
strcpy(statestr, sigstr);
|
||||
else
|
||||
strcpy(statestr, "Suspended");
|
||||
#endif
|
||||
@ -337,10 +339,11 @@ showjob(struct job *jp, int mode)
|
||||
WEXITSTATUS(ps->status));
|
||||
} else {
|
||||
i = WTERMSIG(ps->status);
|
||||
if (i > 0 && i < sys_nsig && sys_siglist[i])
|
||||
strcpy(statestr, sys_siglist[i]);
|
||||
sigstr = strsignal(i);
|
||||
if (sigstr != NULL)
|
||||
strcpy(statestr, sigstr);
|
||||
else
|
||||
fmtstr(statestr, 64, "Signal %d", i);
|
||||
strcpy(statestr, "Unknown signal");
|
||||
if (WCOREDUMP(ps->status))
|
||||
strcat(statestr, " (core dumped)");
|
||||
}
|
||||
@ -1019,6 +1022,7 @@ dowait(int mode, struct job *job)
|
||||
struct procstat *sp;
|
||||
struct job *jp;
|
||||
struct job *thisjob;
|
||||
const char *sigstr;
|
||||
int done;
|
||||
int stopped;
|
||||
int sig;
|
||||
@ -1026,7 +1030,7 @@ dowait(int mode, struct job *job)
|
||||
int wflags;
|
||||
int restore_sigchld;
|
||||
|
||||
TRACE(("dowait(%d) called\n", block));
|
||||
TRACE(("dowait(%d, %p) called\n", mode, job));
|
||||
restore_sigchld = 0;
|
||||
if ((mode & DOWAIT_SIG) != 0) {
|
||||
sigfillset(&mask);
|
||||
@ -1129,10 +1133,11 @@ dowait(int mode, struct job *job)
|
||||
coredump = WCOREDUMP(sp->status);
|
||||
}
|
||||
if (sig > 0 && sig != SIGINT && sig != SIGPIPE) {
|
||||
if (sig < sys_nsig && sys_siglist[sig])
|
||||
out2str(sys_siglist[sig]);
|
||||
sigstr = strsignal(sig);
|
||||
if (sigstr != NULL)
|
||||
out2str(sigstr);
|
||||
else
|
||||
outfmt(out2, "Signal %d", sig);
|
||||
out2str("Unknown signal");
|
||||
if (coredump)
|
||||
out2str(" (core dumped)");
|
||||
out2c('\n');
|
||||
@ -1293,6 +1298,10 @@ until:
|
||||
cmdputs(n->narg.text);
|
||||
cmdputs("() ...");
|
||||
break;
|
||||
case NNOT:
|
||||
cmdputs("! ");
|
||||
cmdtxt(n->nnot.com);
|
||||
break;
|
||||
case NCMD:
|
||||
for (np = n->ncmd.args ; np ; np = np->narg.next) {
|
||||
cmdtxt(np);
|
||||
|
@ -139,7 +139,7 @@ main(int argc, char *argv[])
|
||||
#endif
|
||||
rootpid = getpid();
|
||||
rootshell = 1;
|
||||
init();
|
||||
initvar();
|
||||
setstackmark(&smark);
|
||||
setstackmark(&smark2);
|
||||
procargs(argc, argv);
|
||||
|
@ -47,7 +47,6 @@ __FBSDID("$FreeBSD$");
|
||||
#include <sys/time.h>
|
||||
#include <sys/resource.h>
|
||||
#include <unistd.h>
|
||||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
@ -60,6 +59,7 @@ __FBSDID("$FreeBSD$");
|
||||
#include "memalloc.h"
|
||||
#include "error.h"
|
||||
#include "mystring.h"
|
||||
#include "syntax.h"
|
||||
|
||||
#undef eflag
|
||||
|
||||
@ -307,7 +307,7 @@ umaskcmd(int argc __unused, char **argv __unused)
|
||||
out1fmt("%.4o\n", mask);
|
||||
}
|
||||
} else {
|
||||
if (isdigit(*ap)) {
|
||||
if (is_digit(*ap)) {
|
||||
mask = 0;
|
||||
do {
|
||||
if (*ap >= '8' || *ap < '0')
|
||||
|
@ -101,7 +101,7 @@ struct block {
|
||||
*/
|
||||
|
||||
struct event {
|
||||
const char *name; /* name of event (e.g. INIT) */
|
||||
const char *name; /* name of event (e.g. RESET) */
|
||||
const char *routine; /* name of routine called on event */
|
||||
const char *comment; /* comment describing routine */
|
||||
struct text code; /* code for handling event */
|
||||
@ -114,11 +114,6 @@ char writer[] = "\
|
||||
*/\n\
|
||||
\n";
|
||||
|
||||
char init[] = "\
|
||||
/*\n\
|
||||
* Initialization code.\n\
|
||||
*/\n";
|
||||
|
||||
char reset[] = "\
|
||||
/*\n\
|
||||
* This routine is called when an error or an interrupt occurs in an\n\
|
||||
@ -127,7 +122,6 @@ char reset[] = "\
|
||||
|
||||
|
||||
struct event event[] = {
|
||||
{ "INIT", "init", init, { NULL, 0, NULL, NULL } },
|
||||
{ "RESET", "reset", reset, { NULL, 0, NULL, NULL } },
|
||||
{ NULL, NULL, NULL, { NULL, 0, NULL, NULL } }
|
||||
};
|
||||
|
@ -103,29 +103,19 @@ static char writer[] = "\
|
||||
|
||||
static FILE *cfile;
|
||||
static FILE *hfile;
|
||||
static const char *syntax[513];
|
||||
static int base;
|
||||
static int size; /* number of values which a char variable can have */
|
||||
static int nbits; /* number of bits in a character */
|
||||
static int digit_contig;/* true if digits are contiguous */
|
||||
|
||||
static void filltable(const char *);
|
||||
static void init(void);
|
||||
static void add_default(void);
|
||||
static void finish(void);
|
||||
static void init(const char *);
|
||||
static void add(const char *, const char *);
|
||||
static void print(const char *);
|
||||
static void output_type_macros(void);
|
||||
static void digit_convert(void);
|
||||
|
||||
int
|
||||
main(int argc __unused, char **argv __unused)
|
||||
{
|
||||
char c;
|
||||
char d;
|
||||
int sign;
|
||||
int i;
|
||||
char buf[80];
|
||||
int pos;
|
||||
static char digit[] = "0123456789";
|
||||
|
||||
/* Create output files */
|
||||
if ((cfile = fopen("syntax.c", "w")) == NULL) {
|
||||
@ -139,33 +129,8 @@ main(int argc __unused, char **argv __unused)
|
||||
fputs(writer, hfile);
|
||||
fputs(writer, cfile);
|
||||
|
||||
/* Determine the characteristics of chars. */
|
||||
c = -1;
|
||||
sign = (c > 0) ? 0 : 1;
|
||||
for (nbits = 1 ; ; nbits++) {
|
||||
d = (1 << nbits) - 1;
|
||||
if (d == c)
|
||||
break;
|
||||
}
|
||||
#if 0
|
||||
printf("%s %d bit chars\n", sign? "signed" : "unsigned", nbits);
|
||||
#endif
|
||||
if (nbits > 9) {
|
||||
fputs("Characters can't have more than 9 bits\n", stderr);
|
||||
exit(2);
|
||||
}
|
||||
size = (1 << nbits) + 1;
|
||||
base = 1;
|
||||
if (sign)
|
||||
base += 1 << (nbits - 1);
|
||||
digit_contig = 1;
|
||||
for (i = 0 ; i < 10 ; i++) {
|
||||
if (digit[i] != '0' + i)
|
||||
digit_contig = 0;
|
||||
}
|
||||
|
||||
fputs("#include <sys/cdefs.h>\n", hfile);
|
||||
fputs("#include <ctype.h>\n", hfile);
|
||||
fputs("#include <limits.h>\n\n", hfile);
|
||||
|
||||
/* Generate the #define statements in the header file */
|
||||
fputs("/* Syntax classes */\n", hfile);
|
||||
@ -186,8 +151,8 @@ main(int argc __unused, char **argv __unused)
|
||||
fprintf(hfile, "/* %s */\n", is_entry[i].comment);
|
||||
}
|
||||
putc('\n', hfile);
|
||||
fprintf(hfile, "#define SYNBASE %d\n", base);
|
||||
fprintf(hfile, "#define PEOF %d\n\n", -base);
|
||||
fputs("#define SYNBASE (1 - CHAR_MIN)\n", hfile);
|
||||
fputs("#define PEOF -SYNBASE\n\n", hfile);
|
||||
putc('\n', hfile);
|
||||
fputs("#define BASESYNTAX (basesyntax + SYNBASE)\n", hfile);
|
||||
fputs("#define DQSYNTAX (dqsyntax + SYNBASE)\n", hfile);
|
||||
@ -198,10 +163,13 @@ main(int argc __unused, char **argv __unused)
|
||||
putc('\n', hfile);
|
||||
|
||||
/* Generate the syntax tables. */
|
||||
fputs("#include \"parser.h\"\n", cfile);
|
||||
fputs("#include \"shell.h\"\n", cfile);
|
||||
fputs("#include \"syntax.h\"\n\n", cfile);
|
||||
init();
|
||||
|
||||
fputs("/* syntax table used when not in quotes */\n", cfile);
|
||||
init("basesyntax");
|
||||
add_default();
|
||||
add("\n", "CNL");
|
||||
add("\\", "CBACK");
|
||||
add("'", "CSQUOTE");
|
||||
@ -210,9 +178,11 @@ main(int argc __unused, char **argv __unused)
|
||||
add("$", "CVAR");
|
||||
add("}", "CENDVAR");
|
||||
add("<>();&| \t", "CSPCL");
|
||||
print("basesyntax");
|
||||
init();
|
||||
finish();
|
||||
|
||||
fputs("\n/* syntax table used when in double quotes */\n", cfile);
|
||||
init("dqsyntax");
|
||||
add_default();
|
||||
add("\n", "CNL");
|
||||
add("\\", "CBACK");
|
||||
add("\"", "CENDQUOTE");
|
||||
@ -221,17 +191,21 @@ main(int argc __unused, char **argv __unused)
|
||||
add("}", "CENDVAR");
|
||||
/* ':/' for tilde expansion, '-^]' for [a\-x] pattern ranges */
|
||||
add("!*?[]=~:/-^", "CCTL");
|
||||
print("dqsyntax");
|
||||
init();
|
||||
finish();
|
||||
|
||||
fputs("\n/* syntax table used when in single quotes */\n", cfile);
|
||||
init("sqsyntax");
|
||||
add_default();
|
||||
add("\n", "CNL");
|
||||
add("\\", "CSBACK");
|
||||
add("'", "CENDQUOTE");
|
||||
/* ':/' for tilde expansion, '-^]' for [a\-x] pattern ranges */
|
||||
add("!*?[]=~:/-^", "CCTL");
|
||||
print("sqsyntax");
|
||||
init();
|
||||
finish();
|
||||
|
||||
fputs("\n/* syntax table used when in arithmetic */\n", cfile);
|
||||
init("arisyntax");
|
||||
add_default();
|
||||
add("\n", "CNL");
|
||||
add("\\", "CBACK");
|
||||
add("`", "CBQUOTE");
|
||||
@ -240,54 +214,68 @@ main(int argc __unused, char **argv __unused)
|
||||
add("}", "CENDVAR");
|
||||
add("(", "CLP");
|
||||
add(")", "CRP");
|
||||
print("arisyntax");
|
||||
filltable("0");
|
||||
finish();
|
||||
|
||||
fputs("\n/* character classification table */\n", cfile);
|
||||
init("is_type");
|
||||
add("0123456789", "ISDIGIT");
|
||||
add("abcdefghijklmnopqrstuvwxyz", "ISLOWER");
|
||||
add("ABCDEFGHIJKLMNOPQRSTUVWXYZ", "ISUPPER");
|
||||
add("_", "ISUNDER");
|
||||
add("#?$!-*@", "ISSPECL");
|
||||
print("is_type");
|
||||
if (! digit_contig)
|
||||
digit_convert();
|
||||
finish();
|
||||
|
||||
exit(0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Clear the syntax table.
|
||||
* Output the header and declaration of a syntax table.
|
||||
*/
|
||||
|
||||
static void
|
||||
filltable(const char *dftval)
|
||||
init(const char *name)
|
||||
{
|
||||
int i;
|
||||
fprintf(hfile, "extern const char %s[];\n", name);
|
||||
fprintf(cfile, "const char %s[SYNBASE + CHAR_MAX + 1] = {\n", name);
|
||||
}
|
||||
|
||||
for (i = 0 ; i < size ; i++)
|
||||
syntax[i] = dftval;
|
||||
|
||||
static void
|
||||
add_one(const char *key, const char *type)
|
||||
{
|
||||
fprintf(cfile, "\t[SYNBASE + %s] = %s,\n", key, type);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Initialize the syntax table with default values.
|
||||
* Add default values to the syntax table.
|
||||
*/
|
||||
|
||||
static void
|
||||
init(void)
|
||||
add_default(void)
|
||||
{
|
||||
filltable("CWORD");
|
||||
syntax[0] = "CEOF";
|
||||
syntax[base + CTLESC] = "CCTL";
|
||||
syntax[base + CTLVAR] = "CCTL";
|
||||
syntax[base + CTLENDVAR] = "CCTL";
|
||||
syntax[base + CTLBACKQ] = "CCTL";
|
||||
syntax[base + CTLBACKQ + CTLQUOTE] = "CCTL";
|
||||
syntax[base + CTLARI] = "CCTL";
|
||||
syntax[base + CTLENDARI] = "CCTL";
|
||||
syntax[base + CTLQUOTEMARK] = "CCTL";
|
||||
syntax[base + CTLQUOTEEND] = "CCTL";
|
||||
add_one("PEOF", "CEOF");
|
||||
add_one("CTLESC", "CCTL");
|
||||
add_one("CTLVAR", "CCTL");
|
||||
add_one("CTLENDVAR", "CCTL");
|
||||
add_one("CTLBACKQ", "CCTL");
|
||||
add_one("CTLBACKQ + CTLQUOTE", "CCTL");
|
||||
add_one("CTLARI", "CCTL");
|
||||
add_one("CTLENDARI", "CCTL");
|
||||
add_one("CTLQUOTEMARK", "CCTL");
|
||||
add_one("CTLQUOTEEND", "CCTL");
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Output the footer of a syntax table.
|
||||
*/
|
||||
|
||||
static void
|
||||
finish(void)
|
||||
{
|
||||
fputs("};\n", cfile);
|
||||
}
|
||||
|
||||
|
||||
@ -298,56 +286,36 @@ init(void)
|
||||
static void
|
||||
add(const char *p, const char *type)
|
||||
{
|
||||
while (*p)
|
||||
syntax[*p++ + base] = type;
|
||||
}
|
||||
for (; *p; ++p) {
|
||||
char c = *p;
|
||||
switch (c) {
|
||||
case '\t': c = 't'; break;
|
||||
case '\n': c = 'n'; break;
|
||||
case '\'': c = '\''; break;
|
||||
case '\\': c = '\\'; break;
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Output the syntax table.
|
||||
*/
|
||||
|
||||
static void
|
||||
print(const char *name)
|
||||
{
|
||||
int i;
|
||||
int col;
|
||||
|
||||
fprintf(hfile, "extern const char %s[];\n", name);
|
||||
fprintf(cfile, "const char %s[%d] = {\n", name, size);
|
||||
col = 0;
|
||||
for (i = 0 ; i < size ; i++) {
|
||||
if (i == 0) {
|
||||
fputs(" ", cfile);
|
||||
} else if ((i & 03) == 0) {
|
||||
fputs(",\n ", cfile);
|
||||
col = 0;
|
||||
} else {
|
||||
putc(',', cfile);
|
||||
while (++col < 9 * (i & 03))
|
||||
putc(' ', cfile);
|
||||
default:
|
||||
fprintf(cfile, "\t[SYNBASE + '%c'] = %s,\n", c, type);
|
||||
continue;
|
||||
}
|
||||
fputs(syntax[i], cfile);
|
||||
col += strlen(syntax[i]);
|
||||
fprintf(cfile, "\t[SYNBASE + '\\%c'] = %s,\n", c, type);
|
||||
}
|
||||
fputs("\n};\n", cfile);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Output character classification macros (e.g. is_digit). If digits are
|
||||
* contiguous, we can test for them quickly.
|
||||
*/
|
||||
|
||||
static const char *macro[] = {
|
||||
"#define is_digit(c)\t((is_type+SYNBASE)[(int)c] & ISDIGIT)",
|
||||
"#define is_digit(c)\t((unsigned int)((c) - '0') <= 9)",
|
||||
"#define is_eof(c)\t((c) == PEOF)",
|
||||
"#define is_alpha(c)\t((is_type+SYNBASE)[(int)c] & (ISUPPER|ISLOWER))",
|
||||
"#define is_name(c)\t((is_type+SYNBASE)[(int)c] & (ISUPPER|ISLOWER|ISUNDER))",
|
||||
"#define is_in_name(c)\t((is_type+SYNBASE)[(int)c] & (ISUPPER|ISLOWER|ISUNDER|ISDIGIT))",
|
||||
"#define is_special(c)\t((is_type+SYNBASE)[(int)c] & (ISSPECL|ISDIGIT))",
|
||||
"#define digit_val(c)\t((c) - '0')",
|
||||
NULL
|
||||
};
|
||||
|
||||
@ -356,41 +324,6 @@ output_type_macros(void)
|
||||
{
|
||||
const char **pp;
|
||||
|
||||
if (digit_contig)
|
||||
macro[0] = "#define is_digit(c)\t((unsigned int)((c) - '0') <= 9)";
|
||||
for (pp = macro ; *pp ; pp++)
|
||||
fprintf(hfile, "%s\n", *pp);
|
||||
if (digit_contig)
|
||||
fputs("#define digit_val(c)\t((c) - '0')\n", hfile);
|
||||
else
|
||||
fputs("#define digit_val(c)\t(digit_value[c])\n", hfile);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Output digit conversion table (if digits are not contiguous).
|
||||
*/
|
||||
|
||||
static void
|
||||
digit_convert(void)
|
||||
{
|
||||
int maxdigit;
|
||||
static char digit[] = "0123456789";
|
||||
char *p;
|
||||
int i;
|
||||
|
||||
maxdigit = 0;
|
||||
for (p = digit ; *p ; p++)
|
||||
if (*p > maxdigit)
|
||||
maxdigit = *p;
|
||||
fputs("extern const char digit_value[];\n", hfile);
|
||||
fputs("\n\nconst char digit_value[] = {\n", cfile);
|
||||
for (i = 0 ; i <= maxdigit ; i++) {
|
||||
for (p = digit ; *p && *p != i ; p++);
|
||||
if (*p == '\0')
|
||||
p = digit;
|
||||
fprintf(cfile, " %d,\n", (int)(p - digit));
|
||||
}
|
||||
fputs("};\n", cfile);
|
||||
}
|
||||
|
@ -138,6 +138,7 @@ NXHERE nhere # fd<<!
|
||||
next nodeptr # next redirection in list
|
||||
fd int # file descriptor being redirected
|
||||
doc nodeptr # input to command (NARG node)
|
||||
expdoc temp char *expdoc # actual document (for NXHERE)
|
||||
|
||||
NNOT nnot # ! command (actually pipeline)
|
||||
type int
|
||||
|
@ -239,6 +239,20 @@ freestdout(void)
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
outiserror(struct output *file)
|
||||
{
|
||||
return (file->flags & OUTPUT_ERR);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
outclearerror(struct output *file)
|
||||
{
|
||||
file->flags &= ~OUTPUT_ERR;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
outfmt(struct output *file, const char *fmt, ...)
|
||||
{
|
||||
|
@ -66,6 +66,8 @@ void emptyoutbuf(struct output *);
|
||||
void flushall(void);
|
||||
void flushout(struct output *);
|
||||
void freestdout(void);
|
||||
int outiserror(struct output *);
|
||||
void outclearerror(struct output *);
|
||||
void outfmt(struct output *, const char *, ...) __printflike(2, 3);
|
||||
void out1fmt(const char *, ...) __printflike(1, 2);
|
||||
void out2fmt_flush(const char *, ...) __printflike(1, 2);
|
||||
|
@ -240,9 +240,9 @@ list(int nlflag, int erflag)
|
||||
n2 = andor();
|
||||
tok = readtoken();
|
||||
if (tok == TBACKGND) {
|
||||
if (n2->type == NPIPE) {
|
||||
if (n2 != NULL && n2->type == NPIPE) {
|
||||
n2->npipe.backgnd = 1;
|
||||
} else if (n2->type == NREDIR) {
|
||||
} else if (n2 != NULL && n2->type == NREDIR) {
|
||||
n2->type = NBACKGND;
|
||||
} else {
|
||||
n3 = (union node *)stalloc(sizeof (struct nredir));
|
||||
@ -286,7 +286,8 @@ list(int nlflag, int erflag)
|
||||
tokpushback++;
|
||||
}
|
||||
checkkwd = CHKNL | CHKKWD | CHKALIAS;
|
||||
if (!nlflag && !erflag && tokendlist[peektoken()])
|
||||
if (!nlflag && (erflag ? peektoken() == TEOF :
|
||||
tokendlist[peektoken()]))
|
||||
return ntop;
|
||||
break;
|
||||
case TEOF:
|
||||
|
@ -39,7 +39,7 @@
|
||||
#define CTLENDVAR '\371'
|
||||
#define CTLBACKQ '\372'
|
||||
#define CTLQUOTE 01 /* ored with CTLBACKQ code if in quotes */
|
||||
/* CTLBACKQ | CTLQUOTE == '\205' */
|
||||
/* CTLBACKQ | CTLQUOTE == '\373' */
|
||||
#define CTLARI '\374'
|
||||
#define CTLENDARI '\375'
|
||||
#define CTLQUOTEMARK '\376'
|
||||
|
@ -251,18 +251,23 @@ movefd:
|
||||
static int
|
||||
openhere(union node *redir)
|
||||
{
|
||||
char *p;
|
||||
int pip[2];
|
||||
int len = 0;
|
||||
|
||||
if (pipe(pip) < 0)
|
||||
error("Pipe call failed: %s", strerror(errno));
|
||||
if (redir->type == NHERE) {
|
||||
len = strlen(redir->nhere.doc->narg.text);
|
||||
if (len <= PIPESIZE) {
|
||||
xwrite(pip[1], redir->nhere.doc->narg.text, len);
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (redir->type == NXHERE)
|
||||
p = redir->nhere.expdoc;
|
||||
else
|
||||
p = redir->nhere.doc->narg.text;
|
||||
len = strlen(p);
|
||||
if (len <= PIPESIZE) {
|
||||
xwrite(pip[1], p, len);
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (forkshell((struct job *)NULL, (union node *)NULL, FORK_NOJOB) == 0) {
|
||||
close(pip[0]);
|
||||
signal(SIGINT, SIG_IGN);
|
||||
@ -270,10 +275,7 @@ openhere(union node *redir)
|
||||
signal(SIGHUP, SIG_IGN);
|
||||
signal(SIGTSTP, SIG_IGN);
|
||||
signal(SIGPIPE, SIG_DFL);
|
||||
if (redir->type == NHERE)
|
||||
xwrite(pip[1], redir->nhere.doc->narg.text, len);
|
||||
else
|
||||
expandhere(redir->nhere.doc, pip[1]);
|
||||
xwrite(pip[1], p, len);
|
||||
_exit(0);
|
||||
}
|
||||
out:
|
||||
|
24
bin/sh/sh.1
24
bin/sh/sh.1
@ -32,7 +32,7 @@
|
||||
.\" from: @(#)sh.1 8.6 (Berkeley) 5/4/95
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd July 15, 2012
|
||||
.Dd January 22, 2013
|
||||
.Dt SH 1
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -138,10 +138,10 @@ variable to some file by placing the following line in the file
|
||||
.Pa .profile
|
||||
in the home directory,
|
||||
substituting for
|
||||
.Pa .shinit
|
||||
.Pa .shrc
|
||||
the filename desired:
|
||||
.Pp
|
||||
.Dl "ENV=$HOME/.shinit; export ENV"
|
||||
.Dl "ENV=$HOME/.shrc; export ENV"
|
||||
.Pp
|
||||
The first non-option argument specified on the command line
|
||||
will be treated as the
|
||||
@ -2219,10 +2219,6 @@ The shell maintains a hash table which remembers the locations of commands.
|
||||
With no arguments whatsoever, the
|
||||
.Ic hash
|
||||
command prints out the contents of this table.
|
||||
Entries which have not been looked at since the last
|
||||
.Ic cd
|
||||
command are marked with an asterisk;
|
||||
it is possible for these entries to be invalid.
|
||||
.Pp
|
||||
With arguments, the
|
||||
.Ic hash
|
||||
@ -2678,6 +2674,17 @@ Additionally, all environment variables are turned into shell variables
|
||||
at startup,
|
||||
which may affect the shell as described under
|
||||
.Sx Special Variables .
|
||||
.Sh FILES
|
||||
.Bl -tag -width "/etc/suid_profileXX" -compact
|
||||
.It Pa ~/.profile
|
||||
User's login profile.
|
||||
.It Pa /etc/profile
|
||||
System login profile.
|
||||
.It Pa /etc/shells
|
||||
Shell database.
|
||||
.It Pa /etc/suid_profile
|
||||
Privileged shell profile.
|
||||
.El
|
||||
.Sh EXIT STATUS
|
||||
Errors that are detected by the shell, such as a syntax error, will
|
||||
cause the shell to exit with a non-zero exit status.
|
||||
@ -2703,7 +2710,8 @@ will return the argument.
|
||||
.Xr getrlimit 2 ,
|
||||
.Xr umask 2 ,
|
||||
.Xr wctype 3 ,
|
||||
.Xr editrc 5
|
||||
.Xr editrc 5 ,
|
||||
.Xr shells 5
|
||||
.Sh HISTORY
|
||||
A
|
||||
.Nm
|
||||
|
32
bin/sh/var.c
32
bin/sh/var.c
@ -146,29 +146,11 @@ static int varequal(const char *, const char *);
|
||||
static struct var *find_var(const char *, struct var ***, int *);
|
||||
static int localevar(const char *);
|
||||
|
||||
/*
|
||||
* Initialize the variable symbol tables and import the environment.
|
||||
*/
|
||||
|
||||
#ifdef mkinit
|
||||
INCLUDE "var.h"
|
||||
MKINIT char **environ;
|
||||
INIT {
|
||||
char **envp;
|
||||
|
||||
initvar();
|
||||
for (envp = environ ; *envp ; envp++) {
|
||||
if (strchr(*envp, '=')) {
|
||||
setvareq(*envp, VEXPORT|VTEXTFIXED);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
extern char **environ;
|
||||
|
||||
/*
|
||||
* This routine initializes the builtin variables. It is called when the
|
||||
* shell is initialized.
|
||||
* This routine initializes the builtin variables and imports the environment.
|
||||
* It is called when the shell is initialized.
|
||||
*/
|
||||
|
||||
void
|
||||
@ -178,6 +160,7 @@ initvar(void)
|
||||
const struct varinit *ip;
|
||||
struct var *vp;
|
||||
struct var **vpp;
|
||||
char **envp;
|
||||
|
||||
for (ip = varinit ; (vp = ip->var) != NULL ; ip++) {
|
||||
if (find_var(ip->text, &vpp, &vp->name_len) != NULL)
|
||||
@ -201,6 +184,11 @@ initvar(void)
|
||||
fmtstr(ppid, sizeof(ppid), "%d", (int)getppid());
|
||||
setvarsafe("PPID", ppid, 0);
|
||||
}
|
||||
for (envp = environ ; *envp ; envp++) {
|
||||
if (strchr(*envp, '=')) {
|
||||
setvareq(*envp, VEXPORT|VTEXTFIXED);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@ -356,7 +344,7 @@ setvareq(char *s, int flags)
|
||||
* a regular variable function callback, but why bother?
|
||||
*
|
||||
* Note: this assumes iflag is not set to 1 initially.
|
||||
* As part of init(), this is called before arguments
|
||||
* As part of initvar(), this is called before arguments
|
||||
* are looked at.
|
||||
*/
|
||||
if ((vp == &vmpath || (vp == &vmail && ! mpathset())) &&
|
||||
|
@ -32,7 +32,7 @@
|
||||
.\" @(#)test.1 8.1 (Berkeley) 5/31/93
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd September 10, 2010
|
||||
.Dd December 27, 2012
|
||||
.Dt TEST 1
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -331,6 +331,13 @@ missing.
|
||||
.It >1
|
||||
An error occurred.
|
||||
.El
|
||||
.Sh COMPATIBILITY
|
||||
For compatibility with some other implementations,
|
||||
the
|
||||
.Cm =
|
||||
primary can be substituted with
|
||||
.Cm ==
|
||||
with the same meaning.
|
||||
.Sh SEE ALSO
|
||||
.Xr builtin 1 ,
|
||||
.Xr expr 1 ,
|
||||
|
@ -61,14 +61,16 @@
|
||||
#undef verify
|
||||
#include <libzfs.h>
|
||||
|
||||
#define ZDB_COMPRESS_NAME(idx) ((idx) < ZIO_COMPRESS_FUNCTIONS ? \
|
||||
zio_compress_table[(idx)].ci_name : "UNKNOWN")
|
||||
#define ZDB_CHECKSUM_NAME(idx) ((idx) < ZIO_CHECKSUM_FUNCTIONS ? \
|
||||
zio_checksum_table[(idx)].ci_name : "UNKNOWN")
|
||||
#define ZDB_OT_NAME(idx) ((idx) < DMU_OT_NUMTYPES ? \
|
||||
dmu_ot[(idx)].ot_name : DMU_OT_IS_VALID(idx) ? \
|
||||
dmu_ot_byteswap[DMU_OT_BYTESWAP(idx)].ob_name : "UNKNOWN")
|
||||
#define ZDB_OT_TYPE(idx) ((idx) < DMU_OT_NUMTYPES ? (idx) : DMU_OT_NUMTYPES)
|
||||
#define ZDB_COMPRESS_NAME(idx) ((idx) < ZIO_COMPRESS_FUNCTIONS ? \
|
||||
zio_compress_table[(idx)].ci_name : "UNKNOWN")
|
||||
#define ZDB_CHECKSUM_NAME(idx) ((idx) < ZIO_CHECKSUM_FUNCTIONS ? \
|
||||
zio_checksum_table[(idx)].ci_name : "UNKNOWN")
|
||||
#define ZDB_OT_NAME(idx) ((idx) < DMU_OT_NUMTYPES ? \
|
||||
dmu_ot[(idx)].ot_name : DMU_OT_IS_VALID(idx) ? \
|
||||
dmu_ot_byteswap[DMU_OT_BYTESWAP(idx)].ob_name : "UNKNOWN")
|
||||
#define ZDB_OT_TYPE(idx) ((idx) < DMU_OT_NUMTYPES ? (idx) : \
|
||||
(((idx) == DMU_OTN_ZAP_DATA || (idx) == DMU_OTN_ZAP_METADATA) ? \
|
||||
DMU_OT_ZAP_OTHER : DMU_OT_NUMTYPES))
|
||||
|
||||
#ifndef lint
|
||||
extern int zfs_recover;
|
||||
@ -702,7 +704,9 @@ dump_ddt(ddt_t *ddt, enum ddt_type type, enum ddt_class class)
|
||||
return;
|
||||
ASSERT(error == 0);
|
||||
|
||||
if ((count = ddt_object_count(ddt, type, class)) == 0)
|
||||
error = ddt_object_count(ddt, type, class, &count);
|
||||
ASSERT(error == 0);
|
||||
if (count == 0)
|
||||
return;
|
||||
|
||||
dspace = doi.doi_physical_blocks_512 << 9;
|
||||
@ -3194,7 +3198,13 @@ main(int argc, char **argv)
|
||||
argv[i], strerror(errno));
|
||||
}
|
||||
}
|
||||
(os != NULL) ? dump_dir(os) : dump_zpool(spa);
|
||||
if (os != NULL) {
|
||||
dump_dir(os);
|
||||
} else if (zopt_objects > 0 && !dump_opt['m']) {
|
||||
dump_dir(spa->spa_meta_objset);
|
||||
} else {
|
||||
dump_zpool(spa);
|
||||
}
|
||||
} else {
|
||||
flagbits['b'] = ZDB_FLAG_PRINT_BLKPTR;
|
||||
flagbits['c'] = ZDB_FLAG_CHECKSUM;
|
||||
|
@ -27,7 +27,7 @@
|
||||
.\"
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd September 5, 2012
|
||||
.Dd November 26, 2012
|
||||
.Dt ZFS 8
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -760,7 +760,7 @@ If no inheritable
|
||||
.Tn ACE Ns s
|
||||
exist that affect the mode, then the mode is set in accordance to the requested
|
||||
mode from the application.
|
||||
.It Sy aclmode Ns = Ns Cm discard | groupmask | passthrough
|
||||
.It Sy aclmode Ns = Ns Cm discard | groupmask | passthrough | restricted
|
||||
Controls how an
|
||||
.Tn ACL
|
||||
is modified during
|
||||
@ -790,6 +790,32 @@ indicates that no changes are made to the
|
||||
other than creating or updating the necessary
|
||||
.Tn ACL
|
||||
entries to represent the new mode of the file or directory.
|
||||
An
|
||||
.Sy aclmode
|
||||
property of
|
||||
.Cm restricted
|
||||
will cause the
|
||||
.Xr chmod 2
|
||||
operation to return an error when used on any file or directory which has
|
||||
a non-trivial
|
||||
.Tn ACL
|
||||
whose entries can not be represented by a mode.
|
||||
.Xr chmod 2
|
||||
is required to change the set user ID, set group ID, or sticky bits on a file
|
||||
or directory, as they do not have equivalent
|
||||
.Tn ACL
|
||||
entries.
|
||||
In order to use
|
||||
.Xr chmod 2
|
||||
on a file or directory with a non-trivial
|
||||
.Tn ACL
|
||||
when
|
||||
.Sy aclmode
|
||||
is set to
|
||||
.Cm restricted ,
|
||||
you must first remove all
|
||||
.Tn ACL
|
||||
entries which do not represent the current mode.
|
||||
.It Sy atime Ns = Ns Cm on | off
|
||||
Controls whether the access time for files is updated when they are read.
|
||||
Turning this property off avoids producing write traffic when reading files and
|
||||
@ -830,7 +856,7 @@ command or unmounted by the
|
||||
command.
|
||||
.Pp
|
||||
This property is not inherited.
|
||||
.It Sy checksum Ns = Ns Cm on | off | fletcher2 | fletcher4
|
||||
.It Sy checksum Ns = Ns Cm on | off | fletcher2 | fletcher4 | sha256
|
||||
Controls the checksum used to verify data integrity. The default value is
|
||||
.Cm on ,
|
||||
which automatically selects an appropriate algorithm (currently,
|
||||
|
@ -22,7 +22,7 @@
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd Aug 28, 2012
|
||||
.Dt ZPOOL-FEATURES 8
|
||||
.Dt ZPOOL-FEATURES 7
|
||||
.Os
|
||||
.Sh NAME
|
||||
.Nm zpool-features
|
@ -25,7 +25,7 @@
|
||||
.\"
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd November 28, 2011
|
||||
.Dd November 15, 2012
|
||||
.Dt ZPOOL 8
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -567,7 +567,7 @@ Total size of the storage pool.
|
||||
.It Sy unsupported@ Ns Ar feature_guid
|
||||
Information about unsupported features that are enabled on the pool.
|
||||
See
|
||||
.Xr zpool-features 5
|
||||
.Xr zpool-features 7
|
||||
for details.
|
||||
.It Sy used
|
||||
Amount of storage space used within the pool.
|
||||
@ -717,7 +717,7 @@ which moves
|
||||
.Ar feature_name
|
||||
to the enabled state.
|
||||
See
|
||||
.Xr zpool-features 5
|
||||
.Xr zpool-features 7
|
||||
for details on feature states.
|
||||
.It Sy listsnaps Ns = Ns Cm on No | Cm off
|
||||
Controls whether information about snapshots associated with this pool is
|
||||
@ -915,7 +915,7 @@ with the
|
||||
.Fl o
|
||||
option.
|
||||
See
|
||||
.Xr zpool-features 5
|
||||
.Xr zpool-features 7
|
||||
for details about feature properties.
|
||||
.It Xo
|
||||
.Fl o Ar property Ns = Ns Ar value
|
||||
@ -1651,7 +1651,7 @@ Displays legacy
|
||||
.Tn ZFS
|
||||
versions supported by the current software.
|
||||
See
|
||||
.Xr zpool-features.5
|
||||
.Xr zpool-features 7
|
||||
for a description of feature flags features supported by the current software.
|
||||
.El
|
||||
.It Xo
|
||||
@ -1665,7 +1665,7 @@ Enables all supported features on the given pool.
|
||||
Once this is done, the pool will no longer be accessible on systems that do
|
||||
not support feature flags.
|
||||
See
|
||||
.Xr zpool-features.5
|
||||
.Xr zpool-features 7
|
||||
for details on compatability with system sthat support feature flags, but do
|
||||
not support all features enabled on the pool.
|
||||
.Bl -tag -width indent
|
||||
@ -1927,8 +1927,8 @@ Discarded approximately 29 seconds of transactions.
|
||||
.Ed
|
||||
.El
|
||||
.Sh SEE ALSO
|
||||
.Xr zpool-features 7 ,
|
||||
.Xr zfs 8
|
||||
.Xr zpool-features 5
|
||||
.Sh AUTHORS
|
||||
This manual page is a
|
||||
.Xr mdoc 7
|
||||
|
@ -345,7 +345,7 @@ usage(boolean_t requested)
|
||||
(void) fprintf(fp, "YES disabled | enabled | active\n");
|
||||
|
||||
(void) fprintf(fp, gettext("\nThe feature@ properties must be "
|
||||
"appended with a feature name.\nSee zpool-features(5).\n"));
|
||||
"appended with a feature name.\nSee zpool-features(7).\n"));
|
||||
}
|
||||
|
||||
/*
|
||||
@ -906,10 +906,11 @@ zpool_do_create(int argc, char **argv)
|
||||
/*
|
||||
* Check the validity of the mountpoint and direct the user to use the
|
||||
* '-m' mountpoint option if it looks like its in use.
|
||||
* Ignore the checks if the '-f' option is given.
|
||||
*/
|
||||
if (mountpoint == NULL ||
|
||||
if (!force && (mountpoint == NULL ||
|
||||
(strcmp(mountpoint, ZFS_MOUNTPOINT_LEGACY) != 0 &&
|
||||
strcmp(mountpoint, ZFS_MOUNTPOINT_NONE) != 0)) {
|
||||
strcmp(mountpoint, ZFS_MOUNTPOINT_NONE) != 0))) {
|
||||
char buf[MAXPATHLEN];
|
||||
DIR *dirp;
|
||||
|
||||
@ -4170,7 +4171,7 @@ status_callback(zpool_handle_t *zhp, void *data)
|
||||
(void) printf(gettext("action: Enable all features using "
|
||||
"'zpool upgrade'. Once this is done,\n\tthe pool may no "
|
||||
"longer be accessible by software that does not support\n\t"
|
||||
"the features. See zpool-features(5) for details.\n"));
|
||||
"the features. See zpool-features(7) for details.\n"));
|
||||
break;
|
||||
|
||||
case ZPOOL_STATUS_UNSUP_FEAT_READ:
|
||||
@ -4630,7 +4631,7 @@ upgrade_list_disabled_cb(zpool_handle_t *zhp, void *arg)
|
||||
"pool may become incompatible with "
|
||||
"software\nthat does not support "
|
||||
"the feature. See "
|
||||
"zpool-features(5) for "
|
||||
"zpool-features(7) for "
|
||||
"details.\n\n"));
|
||||
(void) printf(gettext("POOL "
|
||||
"FEATURE\n"));
|
||||
|
@ -121,8 +121,8 @@
|
||||
#include <sys/fs/zfs.h>
|
||||
#include <libnvpair.h>
|
||||
|
||||
#define ZTEST_FD_DATA 3
|
||||
#define ZTEST_FD_RAND 4
|
||||
static int ztest_fd_data = -1;
|
||||
static int ztest_fd_rand = -1;
|
||||
|
||||
typedef struct ztest_shared_hdr {
|
||||
uint64_t zh_hdr_size;
|
||||
@ -204,6 +204,7 @@ enum ztest_io_type {
|
||||
ZTEST_IO_WRITE_ZEROES,
|
||||
ZTEST_IO_TRUNCATE,
|
||||
ZTEST_IO_SETATTR,
|
||||
ZTEST_IO_REWRITE,
|
||||
ZTEST_IO_TYPES
|
||||
};
|
||||
|
||||
@ -330,6 +331,7 @@ ztest_func_t ztest_vdev_add_remove;
|
||||
ztest_func_t ztest_vdev_aux_add_remove;
|
||||
ztest_func_t ztest_split_pool;
|
||||
ztest_func_t ztest_reguid;
|
||||
ztest_func_t ztest_spa_upgrade;
|
||||
|
||||
uint64_t zopt_always = 0ULL * NANOSEC; /* all the time */
|
||||
uint64_t zopt_incessant = 1ULL * NANOSEC / 10; /* every 1/10 second */
|
||||
@ -363,6 +365,7 @@ ztest_info_t ztest_info[] = {
|
||||
{ ztest_reguid, 1, &zopt_sometimes },
|
||||
{ ztest_spa_rename, 1, &zopt_rarely },
|
||||
{ ztest_scrub, 1, &zopt_rarely },
|
||||
{ ztest_spa_upgrade, 1, &zopt_rarely },
|
||||
{ ztest_dsl_dataset_promote_busy, 1, &zopt_rarely },
|
||||
{ ztest_vdev_attach_detach, 1, &zopt_rarely },
|
||||
{ ztest_vdev_LUN_growth, 1, &zopt_rarely },
|
||||
@ -710,14 +713,17 @@ process_options(int argc, char **argv)
|
||||
UINT64_MAX >> 2);
|
||||
|
||||
if (strlen(altdir) > 0) {
|
||||
char cmd[MAXNAMELEN];
|
||||
char realaltdir[MAXNAMELEN];
|
||||
char *cmd;
|
||||
char *realaltdir;
|
||||
char *bin;
|
||||
char *ztest;
|
||||
char *isa;
|
||||
int isalen;
|
||||
|
||||
(void) realpath(getexecname(), cmd);
|
||||
cmd = umem_alloc(MAXPATHLEN, UMEM_NOFAIL);
|
||||
realaltdir = umem_alloc(MAXPATHLEN, UMEM_NOFAIL);
|
||||
|
||||
VERIFY(NULL != realpath(getexecname(), cmd));
|
||||
if (0 != access(altdir, F_OK)) {
|
||||
ztest_dump_core = B_FALSE;
|
||||
fatal(B_TRUE, "invalid alternate ztest path: %s",
|
||||
@ -748,6 +754,9 @@ process_options(int argc, char **argv)
|
||||
fatal(B_TRUE, "invalid alternate lib directory %s",
|
||||
zo->zo_alt_libpath);
|
||||
}
|
||||
|
||||
umem_free(cmd, MAXPATHLEN);
|
||||
umem_free(realaltdir, MAXPATHLEN);
|
||||
}
|
||||
}
|
||||
|
||||
@ -764,10 +773,12 @@ ztest_random(uint64_t range)
|
||||
{
|
||||
uint64_t r;
|
||||
|
||||
ASSERT3S(ztest_fd_rand, >=, 0);
|
||||
|
||||
if (range == 0)
|
||||
return (0);
|
||||
|
||||
if (read(ZTEST_FD_RAND, &r, sizeof (r)) != sizeof (r))
|
||||
if (read(ztest_fd_rand, &r, sizeof (r)) != sizeof (r))
|
||||
fatal(1, "short read from /dev/urandom");
|
||||
|
||||
return (r % range);
|
||||
@ -789,7 +800,7 @@ ztest_get_ashift(void)
|
||||
}
|
||||
|
||||
static nvlist_t *
|
||||
make_vdev_file(char *path, char *aux, size_t size, uint64_t ashift)
|
||||
make_vdev_file(char *path, char *aux, char *pool, size_t size, uint64_t ashift)
|
||||
{
|
||||
char pathbuf[MAXPATHLEN];
|
||||
uint64_t vdev;
|
||||
@ -805,12 +816,13 @@ make_vdev_file(char *path, char *aux, size_t size, uint64_t ashift)
|
||||
vdev = ztest_shared->zs_vdev_aux;
|
||||
(void) snprintf(path, sizeof (pathbuf),
|
||||
ztest_aux_template, ztest_opts.zo_dir,
|
||||
ztest_opts.zo_pool, aux, vdev);
|
||||
pool == NULL ? ztest_opts.zo_pool : pool,
|
||||
aux, vdev);
|
||||
} else {
|
||||
vdev = ztest_shared->zs_vdev_next_leaf++;
|
||||
(void) snprintf(path, sizeof (pathbuf),
|
||||
ztest_dev_template, ztest_opts.zo_dir,
|
||||
ztest_opts.zo_pool, vdev);
|
||||
pool == NULL ? ztest_opts.zo_pool : pool, vdev);
|
||||
}
|
||||
}
|
||||
|
||||
@ -832,17 +844,18 @@ make_vdev_file(char *path, char *aux, size_t size, uint64_t ashift)
|
||||
}
|
||||
|
||||
static nvlist_t *
|
||||
make_vdev_raidz(char *path, char *aux, size_t size, uint64_t ashift, int r)
|
||||
make_vdev_raidz(char *path, char *aux, char *pool, size_t size,
|
||||
uint64_t ashift, int r)
|
||||
{
|
||||
nvlist_t *raidz, **child;
|
||||
int c;
|
||||
|
||||
if (r < 2)
|
||||
return (make_vdev_file(path, aux, size, ashift));
|
||||
return (make_vdev_file(path, aux, pool, size, ashift));
|
||||
child = umem_alloc(r * sizeof (nvlist_t *), UMEM_NOFAIL);
|
||||
|
||||
for (c = 0; c < r; c++)
|
||||
child[c] = make_vdev_file(path, aux, size, ashift);
|
||||
child[c] = make_vdev_file(path, aux, pool, size, ashift);
|
||||
|
||||
VERIFY(nvlist_alloc(&raidz, NV_UNIQUE_NAME, 0) == 0);
|
||||
VERIFY(nvlist_add_string(raidz, ZPOOL_CONFIG_TYPE,
|
||||
@ -861,19 +874,19 @@ make_vdev_raidz(char *path, char *aux, size_t size, uint64_t ashift, int r)
|
||||
}
|
||||
|
||||
static nvlist_t *
|
||||
make_vdev_mirror(char *path, char *aux, size_t size, uint64_t ashift,
|
||||
int r, int m)
|
||||
make_vdev_mirror(char *path, char *aux, char *pool, size_t size,
|
||||
uint64_t ashift, int r, int m)
|
||||
{
|
||||
nvlist_t *mirror, **child;
|
||||
int c;
|
||||
|
||||
if (m < 1)
|
||||
return (make_vdev_raidz(path, aux, size, ashift, r));
|
||||
return (make_vdev_raidz(path, aux, pool, size, ashift, r));
|
||||
|
||||
child = umem_alloc(m * sizeof (nvlist_t *), UMEM_NOFAIL);
|
||||
|
||||
for (c = 0; c < m; c++)
|
||||
child[c] = make_vdev_raidz(path, aux, size, ashift, r);
|
||||
child[c] = make_vdev_raidz(path, aux, pool, size, ashift, r);
|
||||
|
||||
VERIFY(nvlist_alloc(&mirror, NV_UNIQUE_NAME, 0) == 0);
|
||||
VERIFY(nvlist_add_string(mirror, ZPOOL_CONFIG_TYPE,
|
||||
@ -890,8 +903,8 @@ make_vdev_mirror(char *path, char *aux, size_t size, uint64_t ashift,
|
||||
}
|
||||
|
||||
static nvlist_t *
|
||||
make_vdev_root(char *path, char *aux, size_t size, uint64_t ashift,
|
||||
int log, int r, int m, int t)
|
||||
make_vdev_root(char *path, char *aux, char *pool, size_t size, uint64_t ashift,
|
||||
int log, int r, int m, int t)
|
||||
{
|
||||
nvlist_t *root, **child;
|
||||
int c;
|
||||
@ -901,7 +914,8 @@ make_vdev_root(char *path, char *aux, size_t size, uint64_t ashift,
|
||||
child = umem_alloc(t * sizeof (nvlist_t *), UMEM_NOFAIL);
|
||||
|
||||
for (c = 0; c < t; c++) {
|
||||
child[c] = make_vdev_mirror(path, aux, size, ashift, r, m);
|
||||
child[c] = make_vdev_mirror(path, aux, pool, size, ashift,
|
||||
r, m);
|
||||
VERIFY(nvlist_add_uint64(child[c], ZPOOL_CONFIG_IS_LOG,
|
||||
log) == 0);
|
||||
}
|
||||
@ -919,6 +933,27 @@ make_vdev_root(char *path, char *aux, size_t size, uint64_t ashift,
|
||||
return (root);
|
||||
}
|
||||
|
||||
/*
|
||||
* Find a random spa version. Returns back a random spa version in the
|
||||
* range [initial_version, SPA_VERSION_FEATURES].
|
||||
*/
|
||||
static uint64_t
|
||||
ztest_random_spa_version(uint64_t initial_version)
|
||||
{
|
||||
uint64_t version = initial_version;
|
||||
|
||||
if (version <= SPA_VERSION_BEFORE_FEATURES) {
|
||||
version = version +
|
||||
ztest_random(SPA_VERSION_BEFORE_FEATURES - version + 1);
|
||||
}
|
||||
|
||||
if (version > SPA_VERSION_BEFORE_FEATURES)
|
||||
version = SPA_VERSION_FEATURES;
|
||||
|
||||
ASSERT(SPA_VERSION_IS_SUPPORTED(version));
|
||||
return (version);
|
||||
}
|
||||
|
||||
static int
|
||||
ztest_random_blocksize(void)
|
||||
{
|
||||
@ -1833,6 +1868,12 @@ ztest_get_data(void *arg, lr_write_t *lr, char *buf, zio_t *zio)
|
||||
DMU_READ_NO_PREFETCH);
|
||||
|
||||
if (error == 0) {
|
||||
blkptr_t *obp = dmu_buf_get_blkptr(db);
|
||||
if (obp) {
|
||||
ASSERT(BP_IS_HOLE(bp));
|
||||
*bp = *obp;
|
||||
}
|
||||
|
||||
zgd->zgd_db = db;
|
||||
zgd->zgd_bp = bp;
|
||||
|
||||
@ -1978,6 +2019,9 @@ ztest_remove(ztest_ds_t *zd, ztest_od_t *od, int count)
|
||||
continue;
|
||||
}
|
||||
|
||||
/*
|
||||
* No object was found.
|
||||
*/
|
||||
if (od->od_object == 0)
|
||||
continue;
|
||||
|
||||
@ -2093,6 +2137,7 @@ ztest_prealloc(ztest_ds_t *zd, uint64_t object, uint64_t offset, uint64_t size)
|
||||
static void
|
||||
ztest_io(ztest_ds_t *zd, uint64_t object, uint64_t offset)
|
||||
{
|
||||
int err;
|
||||
ztest_block_tag_t wbt;
|
||||
dmu_object_info_t doi;
|
||||
enum ztest_io_type io_type;
|
||||
@ -2145,6 +2190,25 @@ ztest_io(ztest_ds_t *zd, uint64_t object, uint64_t offset)
|
||||
case ZTEST_IO_SETATTR:
|
||||
(void) ztest_setattr(zd, object);
|
||||
break;
|
||||
|
||||
case ZTEST_IO_REWRITE:
|
||||
(void) rw_rdlock(&ztest_name_lock);
|
||||
err = ztest_dsl_prop_set_uint64(zd->zd_name,
|
||||
ZFS_PROP_CHECKSUM, spa_dedup_checksum(ztest_spa),
|
||||
B_FALSE);
|
||||
VERIFY(err == 0 || err == ENOSPC);
|
||||
err = ztest_dsl_prop_set_uint64(zd->zd_name,
|
||||
ZFS_PROP_COMPRESSION,
|
||||
ztest_random_dsl_prop(ZFS_PROP_COMPRESSION),
|
||||
B_FALSE);
|
||||
VERIFY(err == 0 || err == ENOSPC);
|
||||
(void) rw_unlock(&ztest_name_lock);
|
||||
|
||||
VERIFY0(dmu_read(zd->zd_os, object, offset, blocksize, data,
|
||||
DMU_READ_NO_PREFETCH));
|
||||
|
||||
(void) ztest_write(zd, object, offset, blocksize, data);
|
||||
break;
|
||||
}
|
||||
|
||||
(void) rw_unlock(&zd->zd_zilog_lock);
|
||||
@ -2232,7 +2296,12 @@ ztest_zil_remount(ztest_ds_t *zd, uint64_t id)
|
||||
{
|
||||
objset_t *os = zd->zd_os;
|
||||
|
||||
VERIFY(mutex_lock(&zd->zd_dirobj_lock) == 0);
|
||||
/*
|
||||
* We grab the zd_dirobj_lock to ensure that no other thread is
|
||||
* updating the zil (i.e. adding in-memory log records) and the
|
||||
* zd_zilog_lock to block any I/O.
|
||||
*/
|
||||
VERIFY0(mutex_lock(&zd->zd_dirobj_lock));
|
||||
(void) rw_wrlock(&zd->zd_zilog_lock);
|
||||
|
||||
/* zfsvfs_teardown() */
|
||||
@ -2261,7 +2330,7 @@ ztest_spa_create_destroy(ztest_ds_t *zd, uint64_t id)
|
||||
/*
|
||||
* Attempt to create using a bad file.
|
||||
*/
|
||||
nvroot = make_vdev_root("/dev/bogus", NULL, 0, 0, 0, 0, 0, 1);
|
||||
nvroot = make_vdev_root("/dev/bogus", NULL, NULL, 0, 0, 0, 0, 0, 1);
|
||||
VERIFY3U(ENOENT, ==,
|
||||
spa_create("ztest_bad_file", nvroot, NULL, NULL, NULL));
|
||||
nvlist_free(nvroot);
|
||||
@ -2269,7 +2338,7 @@ ztest_spa_create_destroy(ztest_ds_t *zd, uint64_t id)
|
||||
/*
|
||||
* Attempt to create using a bad mirror.
|
||||
*/
|
||||
nvroot = make_vdev_root("/dev/bogus", NULL, 0, 0, 0, 0, 2, 1);
|
||||
nvroot = make_vdev_root("/dev/bogus", NULL, NULL, 0, 0, 0, 0, 2, 1);
|
||||
VERIFY3U(ENOENT, ==,
|
||||
spa_create("ztest_bad_mirror", nvroot, NULL, NULL, NULL));
|
||||
nvlist_free(nvroot);
|
||||
@ -2279,7 +2348,7 @@ ztest_spa_create_destroy(ztest_ds_t *zd, uint64_t id)
|
||||
* what's in the nvroot; we should fail with EEXIST.
|
||||
*/
|
||||
(void) rw_rdlock(&ztest_name_lock);
|
||||
nvroot = make_vdev_root("/dev/bogus", NULL, 0, 0, 0, 0, 0, 1);
|
||||
nvroot = make_vdev_root("/dev/bogus", NULL, NULL, 0, 0, 0, 0, 0, 1);
|
||||
VERIFY3U(EEXIST, ==, spa_create(zo->zo_pool, nvroot, NULL, NULL, NULL));
|
||||
nvlist_free(nvroot);
|
||||
VERIFY3U(0, ==, spa_open(zo->zo_pool, &spa, FTAG));
|
||||
@ -2289,6 +2358,78 @@ ztest_spa_create_destroy(ztest_ds_t *zd, uint64_t id)
|
||||
(void) rw_unlock(&ztest_name_lock);
|
||||
}
|
||||
|
||||
/* ARGSUSED */
|
||||
void
|
||||
ztest_spa_upgrade(ztest_ds_t *zd, uint64_t id)
|
||||
{
|
||||
spa_t *spa;
|
||||
uint64_t initial_version = SPA_VERSION_INITIAL;
|
||||
uint64_t version, newversion;
|
||||
nvlist_t *nvroot, *props;
|
||||
char *name;
|
||||
|
||||
VERIFY0(mutex_lock(&ztest_vdev_lock));
|
||||
name = kmem_asprintf("%s_upgrade", ztest_opts.zo_pool);
|
||||
|
||||
/*
|
||||
* Clean up from previous runs.
|
||||
*/
|
||||
(void) spa_destroy(name);
|
||||
|
||||
nvroot = make_vdev_root(NULL, NULL, name, ztest_opts.zo_vdev_size, 0,
|
||||
0, ztest_opts.zo_raidz, ztest_opts.zo_mirrors, 1);
|
||||
|
||||
/*
|
||||
* If we're configuring a RAIDZ device then make sure that the
|
||||
* the initial version is capable of supporting that feature.
|
||||
*/
|
||||
switch (ztest_opts.zo_raidz_parity) {
|
||||
case 0:
|
||||
case 1:
|
||||
initial_version = SPA_VERSION_INITIAL;
|
||||
break;
|
||||
case 2:
|
||||
initial_version = SPA_VERSION_RAIDZ2;
|
||||
break;
|
||||
case 3:
|
||||
initial_version = SPA_VERSION_RAIDZ3;
|
||||
break;
|
||||
}
|
||||
|
||||
/*
|
||||
* Create a pool with a spa version that can be upgraded. Pick
|
||||
* a value between initial_version and SPA_VERSION_BEFORE_FEATURES.
|
||||
*/
|
||||
do {
|
||||
version = ztest_random_spa_version(initial_version);
|
||||
} while (version > SPA_VERSION_BEFORE_FEATURES);
|
||||
|
||||
props = fnvlist_alloc();
|
||||
fnvlist_add_uint64(props,
|
||||
zpool_prop_to_name(ZPOOL_PROP_VERSION), version);
|
||||
VERIFY0(spa_create(name, nvroot, props, NULL, NULL));
|
||||
fnvlist_free(nvroot);
|
||||
fnvlist_free(props);
|
||||
|
||||
VERIFY0(spa_open(name, &spa, FTAG));
|
||||
VERIFY3U(spa_version(spa), ==, version);
|
||||
newversion = ztest_random_spa_version(version + 1);
|
||||
|
||||
if (ztest_opts.zo_verbose >= 4) {
|
||||
(void) printf("upgrading spa version from %llu to %llu\n",
|
||||
(u_longlong_t)version, (u_longlong_t)newversion);
|
||||
}
|
||||
|
||||
spa_upgrade(spa, newversion);
|
||||
VERIFY3U(spa_version(spa), >, version);
|
||||
VERIFY3U(spa_version(spa), ==, fnvlist_lookup_uint64(spa->spa_config,
|
||||
zpool_prop_to_name(ZPOOL_PROP_VERSION)));
|
||||
spa_close(spa, FTAG);
|
||||
|
||||
strfree(name);
|
||||
VERIFY0(mutex_unlock(&ztest_vdev_lock));
|
||||
}
|
||||
|
||||
static vdev_t *
|
||||
vdev_lookup_by_path(vdev_t *vd, const char *path)
|
||||
{
|
||||
@ -2378,7 +2519,7 @@ ztest_vdev_add_remove(ztest_ds_t *zd, uint64_t id)
|
||||
/*
|
||||
* Make 1/4 of the devices be log devices.
|
||||
*/
|
||||
nvroot = make_vdev_root(NULL, NULL,
|
||||
nvroot = make_vdev_root(NULL, NULL, NULL,
|
||||
ztest_opts.zo_vdev_size, 0,
|
||||
ztest_random(4) == 0, ztest_opts.zo_raidz,
|
||||
zs->zs_mirrors, 1);
|
||||
@ -2455,7 +2596,7 @@ ztest_vdev_aux_add_remove(ztest_ds_t *zd, uint64_t id)
|
||||
/*
|
||||
* Add a new device.
|
||||
*/
|
||||
nvlist_t *nvroot = make_vdev_root(NULL, aux,
|
||||
nvlist_t *nvroot = make_vdev_root(NULL, aux, NULL,
|
||||
(ztest_opts.zo_vdev_size * 5) / 4, 0, 0, 0, 0, 1);
|
||||
error = spa_vdev_add(spa, nvroot);
|
||||
if (error != 0)
|
||||
@ -2724,7 +2865,7 @@ ztest_vdev_attach_detach(ztest_ds_t *zd, uint64_t id)
|
||||
/*
|
||||
* Build the nvlist describing newpath.
|
||||
*/
|
||||
root = make_vdev_root(newpath, NULL, newvd == NULL ? newsize : 0,
|
||||
root = make_vdev_root(newpath, NULL, NULL, newvd == NULL ? newsize : 0,
|
||||
ashift, 0, 0, 0, 1);
|
||||
|
||||
error = spa_vdev_attach(spa, oldguid, root, replacing);
|
||||
@ -4703,7 +4844,18 @@ ztest_fault_inject(ztest_ds_t *zd, uint64_t id)
|
||||
if (islog)
|
||||
(void) rw_unlock(&ztest_name_lock);
|
||||
} else {
|
||||
/*
|
||||
* Ideally we would like to be able to randomly
|
||||
* call vdev_[on|off]line without holding locks
|
||||
* to force unpredictable failures but the side
|
||||
* effects of vdev_[on|off]line prevent us from
|
||||
* doing so. We grab the ztest_vdev_lock here to
|
||||
* prevent a race between injection testing and
|
||||
* aux_vdev removal.
|
||||
*/
|
||||
VERIFY(mutex_lock(&ztest_vdev_lock) == 0);
|
||||
(void) vdev_online(spa, guid0, 0, NULL);
|
||||
VERIFY(mutex_unlock(&ztest_vdev_lock) == 0);
|
||||
}
|
||||
}
|
||||
|
||||
@ -4808,8 +4960,8 @@ ztest_ddt_repair(ztest_ds_t *zd, uint64_t id)
|
||||
*/
|
||||
for (int i = 0; i < copies; i++) {
|
||||
uint64_t offset = i * blocksize;
|
||||
VERIFY(dmu_buf_hold(os, object, offset, FTAG, &db,
|
||||
DMU_READ_NO_PREFETCH) == 0);
|
||||
VERIFY0(dmu_buf_hold(os, object, offset, FTAG, &db,
|
||||
DMU_READ_NO_PREFETCH));
|
||||
ASSERT(db->db_offset == offset);
|
||||
ASSERT(db->db_size == blocksize);
|
||||
ASSERT(ztest_pattern_match(db->db_data, db->db_size, pattern) ||
|
||||
@ -4825,8 +4977,8 @@ ztest_ddt_repair(ztest_ds_t *zd, uint64_t id)
|
||||
/*
|
||||
* Find out what block we got.
|
||||
*/
|
||||
VERIFY(dmu_buf_hold(os, object, 0, FTAG, &db,
|
||||
DMU_READ_NO_PREFETCH) == 0);
|
||||
VERIFY0(dmu_buf_hold(os, object, 0, FTAG, &db,
|
||||
DMU_READ_NO_PREFETCH));
|
||||
blk = *((dmu_buf_impl_t *)db)->db_blkptr;
|
||||
dmu_buf_rele(db, FTAG);
|
||||
|
||||
@ -4881,7 +5033,7 @@ ztest_reguid(ztest_ds_t *zd, uint64_t id)
|
||||
if (error != 0)
|
||||
return;
|
||||
|
||||
if (ztest_opts.zo_verbose >= 3) {
|
||||
if (ztest_opts.zo_verbose >= 4) {
|
||||
(void) printf("Changed guid old %llu -> %llu\n",
|
||||
(u_longlong_t)orig, (u_longlong_t)spa_guid(spa));
|
||||
}
|
||||
@ -5504,6 +5656,8 @@ ztest_freeze(void)
|
||||
kernel_init(FREAD | FWRITE);
|
||||
VERIFY3U(0, ==, spa_open(ztest_opts.zo_pool, &spa, FTAG));
|
||||
VERIFY3U(0, ==, ztest_dataset_open(0));
|
||||
spa->spa_debug = B_TRUE;
|
||||
ztest_spa = spa;
|
||||
|
||||
/*
|
||||
* Force the first log block to be transactionally allocated.
|
||||
@ -5628,7 +5782,7 @@ ztest_init(ztest_shared_t *zs)
|
||||
ztest_shared->zs_vdev_next_leaf = 0;
|
||||
zs->zs_splits = 0;
|
||||
zs->zs_mirrors = ztest_opts.zo_mirrors;
|
||||
nvroot = make_vdev_root(NULL, NULL, ztest_opts.zo_vdev_size, 0,
|
||||
nvroot = make_vdev_root(NULL, NULL, NULL, ztest_opts.zo_vdev_size, 0,
|
||||
0, ztest_opts.zo_raidz, zs->zs_mirrors, 1);
|
||||
props = make_random_props();
|
||||
for (int i = 0; i < SPA_FEATURES; i++) {
|
||||
@ -5660,29 +5814,16 @@ ztest_init(ztest_shared_t *zs)
|
||||
}
|
||||
|
||||
static void
|
||||
setup_fds(void)
|
||||
setup_data_fd(void)
|
||||
{
|
||||
int fd;
|
||||
#ifdef illumos
|
||||
static char ztest_name_data[] = "/tmp/ztest.data.XXXXXX";
|
||||
|
||||
char *tmp = tempnam(NULL, NULL);
|
||||
fd = open(tmp, O_RDWR | O_CREAT, 0700);
|
||||
ASSERT3U(fd, ==, ZTEST_FD_DATA);
|
||||
(void) unlink(tmp);
|
||||
free(tmp);
|
||||
#else
|
||||
char tmp[MAXPATHLEN];
|
||||
|
||||
strlcpy(tmp, ztest_opts.zo_dir, MAXPATHLEN);
|
||||
strlcat(tmp, "/ztest.XXXXXX", MAXPATHLEN);
|
||||
fd = mkstemp(tmp);
|
||||
ASSERT3U(fd, ==, ZTEST_FD_DATA);
|
||||
#endif
|
||||
|
||||
fd = open("/dev/urandom", O_RDONLY);
|
||||
ASSERT3U(fd, ==, ZTEST_FD_RAND);
|
||||
ztest_fd_data = mkstemp(ztest_name_data);
|
||||
ASSERT3S(ztest_fd_data, >=, 0);
|
||||
(void) unlink(ztest_name_data);
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
shared_data_size(ztest_shared_hdr_t *hdr)
|
||||
{
|
||||
@ -5703,15 +5844,11 @@ setup_hdr(void)
|
||||
int size;
|
||||
ztest_shared_hdr_t *hdr;
|
||||
|
||||
#ifndef illumos
|
||||
pwrite(ZTEST_FD_DATA, "", 1, 0);
|
||||
#endif
|
||||
|
||||
hdr = (void *)mmap(0, P2ROUNDUP(sizeof (*hdr), getpagesize()),
|
||||
PROT_READ | PROT_WRITE, MAP_SHARED, ZTEST_FD_DATA, 0);
|
||||
PROT_READ | PROT_WRITE, MAP_SHARED, ztest_fd_data, 0);
|
||||
ASSERT(hdr != MAP_FAILED);
|
||||
|
||||
VERIFY3U(0, ==, ftruncate(ZTEST_FD_DATA, sizeof (ztest_shared_hdr_t)));
|
||||
VERIFY3U(0, ==, ftruncate(ztest_fd_data, sizeof (ztest_shared_hdr_t)));
|
||||
|
||||
hdr->zh_hdr_size = sizeof (ztest_shared_hdr_t);
|
||||
hdr->zh_opts_size = sizeof (ztest_shared_opts_t);
|
||||
@ -5722,7 +5859,7 @@ setup_hdr(void)
|
||||
hdr->zh_ds_count = ztest_opts.zo_datasets;
|
||||
|
||||
size = shared_data_size(hdr);
|
||||
VERIFY3U(0, ==, ftruncate(ZTEST_FD_DATA, size));
|
||||
VERIFY3U(0, ==, ftruncate(ztest_fd_data, size));
|
||||
|
||||
(void) munmap((caddr_t)hdr, P2ROUNDUP(sizeof (*hdr), getpagesize()));
|
||||
}
|
||||
@ -5735,14 +5872,14 @@ setup_data(void)
|
||||
uint8_t *buf;
|
||||
|
||||
hdr = (void *)mmap(0, P2ROUNDUP(sizeof (*hdr), getpagesize()),
|
||||
PROT_READ, MAP_SHARED, ZTEST_FD_DATA, 0);
|
||||
PROT_READ, MAP_SHARED, ztest_fd_data, 0);
|
||||
ASSERT(hdr != MAP_FAILED);
|
||||
|
||||
size = shared_data_size(hdr);
|
||||
|
||||
(void) munmap((caddr_t)hdr, P2ROUNDUP(sizeof (*hdr), getpagesize()));
|
||||
hdr = ztest_shared_hdr = (void *)mmap(0, P2ROUNDUP(size, getpagesize()),
|
||||
PROT_READ | PROT_WRITE, MAP_SHARED, ZTEST_FD_DATA, 0);
|
||||
PROT_READ | PROT_WRITE, MAP_SHARED, ztest_fd_data, 0);
|
||||
ASSERT(hdr != MAP_FAILED);
|
||||
buf = (uint8_t *)hdr;
|
||||
|
||||
@ -5761,12 +5898,13 @@ exec_child(char *cmd, char *libpath, boolean_t ignorekill, int *statusp)
|
||||
{
|
||||
pid_t pid;
|
||||
int status;
|
||||
char cmdbuf[MAXPATHLEN];
|
||||
char *cmdbuf = NULL;
|
||||
|
||||
pid = fork();
|
||||
|
||||
if (cmd == NULL) {
|
||||
(void) strlcpy(cmdbuf, getexecname(), sizeof (cmdbuf));
|
||||
cmdbuf = umem_alloc(MAXPATHLEN, UMEM_NOFAIL);
|
||||
(void) strlcpy(cmdbuf, getexecname(), MAXPATHLEN);
|
||||
cmd = cmdbuf;
|
||||
}
|
||||
|
||||
@ -5775,9 +5913,16 @@ exec_child(char *cmd, char *libpath, boolean_t ignorekill, int *statusp)
|
||||
|
||||
if (pid == 0) { /* child */
|
||||
char *emptyargv[2] = { cmd, NULL };
|
||||
char fd_data_str[12];
|
||||
|
||||
struct rlimit rl = { 1024, 1024 };
|
||||
(void) setrlimit(RLIMIT_NOFILE, &rl);
|
||||
|
||||
(void) close(ztest_fd_rand);
|
||||
VERIFY3U(11, >=,
|
||||
snprintf(fd_data_str, 12, "%d", ztest_fd_data));
|
||||
VERIFY0(setenv("ZTEST_FD_DATA", fd_data_str, 1));
|
||||
|
||||
(void) enable_extended_FILE_stdio(-1, -1);
|
||||
if (libpath != NULL)
|
||||
VERIFY(0 == setenv("LD_LIBRARY_PATH", libpath, 1));
|
||||
@ -5790,6 +5935,11 @@ exec_child(char *cmd, char *libpath, boolean_t ignorekill, int *statusp)
|
||||
fatal(B_TRUE, "exec failed: %s", cmd);
|
||||
}
|
||||
|
||||
if (cmdbuf != NULL) {
|
||||
umem_free(cmdbuf, MAXPATHLEN);
|
||||
cmd = NULL;
|
||||
}
|
||||
|
||||
while (waitpid(pid, &status, 0) != pid)
|
||||
continue;
|
||||
if (statusp != NULL)
|
||||
@ -5854,39 +6004,41 @@ main(int argc, char **argv)
|
||||
char timebuf[100];
|
||||
char numbuf[6];
|
||||
spa_t *spa;
|
||||
char cmd[MAXNAMELEN];
|
||||
char *cmd;
|
||||
boolean_t hasalt;
|
||||
|
||||
boolean_t ischild = (0 == lseek(ZTEST_FD_DATA, 0, SEEK_CUR));
|
||||
ASSERT(ischild || errno == EBADF);
|
||||
char *fd_data_str = getenv("ZTEST_FD_DATA");
|
||||
|
||||
(void) setvbuf(stdout, NULL, _IOLBF, 0);
|
||||
|
||||
dprintf_setup(&argc, argv);
|
||||
|
||||
if (!ischild) {
|
||||
ztest_fd_rand = open("/dev/urandom", O_RDONLY);
|
||||
ASSERT3S(ztest_fd_rand, >=, 0);
|
||||
|
||||
if (!fd_data_str) {
|
||||
process_options(argc, argv);
|
||||
|
||||
setup_fds();
|
||||
setup_data_fd();
|
||||
setup_hdr();
|
||||
setup_data();
|
||||
bcopy(&ztest_opts, ztest_shared_opts,
|
||||
sizeof (*ztest_shared_opts));
|
||||
} else {
|
||||
ztest_fd_data = atoi(fd_data_str);
|
||||
setup_data();
|
||||
bcopy(ztest_shared_opts, &ztest_opts, sizeof (ztest_opts));
|
||||
}
|
||||
ASSERT3U(ztest_opts.zo_datasets, ==, ztest_shared_hdr->zh_ds_count);
|
||||
|
||||
/* Override location of zpool.cache */
|
||||
(void) asprintf((char **)&spa_config_path, "%s/zpool.cache",
|
||||
ztest_opts.zo_dir);
|
||||
VERIFY3U(asprintf((char **)&spa_config_path, "%s/zpool.cache",
|
||||
ztest_opts.zo_dir), !=, -1);
|
||||
|
||||
ztest_ds = umem_alloc(ztest_opts.zo_datasets * sizeof (ztest_ds_t),
|
||||
UMEM_NOFAIL);
|
||||
zs = ztest_shared;
|
||||
|
||||
if (ischild) {
|
||||
if (fd_data_str) {
|
||||
metaslab_gang_bang = ztest_opts.zo_metaslab_gang_bang;
|
||||
metaslab_df_alloc_threshold =
|
||||
zs->zs_metaslab_df_alloc_threshold;
|
||||
@ -5909,7 +6061,8 @@ main(int argc, char **argv)
|
||||
(u_longlong_t)ztest_opts.zo_time);
|
||||
}
|
||||
|
||||
(void) strlcpy(cmd, getexecname(), sizeof (cmd));
|
||||
cmd = umem_alloc(MAXNAMELEN, UMEM_NOFAIL);
|
||||
(void) strlcpy(cmd, getexecname(), MAXNAMELEN);
|
||||
|
||||
zs->zs_do_init = B_TRUE;
|
||||
if (strlen(ztest_opts.zo_alt_ztest) != 0) {
|
||||
@ -6050,5 +6203,7 @@ main(int argc, char **argv)
|
||||
kills, iters - kills, (100.0 * kills) / MAX(1, iters));
|
||||
}
|
||||
|
||||
umem_free(cmd, MAXNAMELEN);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
75
cddl/contrib/opensolaris/lib/libdtrace/powerpc/dt_isadep.c
Normal file
75
cddl/contrib/opensolaris/lib/libdtrace/powerpc/dt_isadep.c
Normal file
@ -0,0 +1,75 @@
|
||||
/*
|
||||
* CDDL HEADER START
|
||||
*
|
||||
* The contents of this file are subject to the terms of the
|
||||
* Common Development and Distribution License, Version 1.0 only
|
||||
* (the "License"). You may not use this file except in compliance
|
||||
* with the License.
|
||||
*
|
||||
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||
* or http://www.opensolaris.org/os/licensing.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
*
|
||||
* When distributing Covered Code, include this CDDL HEADER in each
|
||||
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||
* If applicable, add the following below this CDDL HEADER, with the
|
||||
* fields enclosed by brackets "[]" replaced with your own identifying
|
||||
* information: Portions Copyright [yyyy] [name of copyright owner]
|
||||
*
|
||||
* CDDL HEADER END
|
||||
*/
|
||||
/*
|
||||
* Copyright 2005 Sun Microsystems, Inc. All rights reserved.
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
|
||||
#pragma ident "%Z%%M% %I% %E% SMI"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <assert.h>
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
#include <libgen.h>
|
||||
|
||||
#include <dt_impl.h>
|
||||
#include <dt_pid.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)
|
||||
{
|
||||
|
||||
dt_dprintf("%s: unimplemented\n", __func__);
|
||||
return (DT_PROC_ERR);
|
||||
}
|
||||
|
||||
int
|
||||
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);
|
||||
}
|
||||
|
||||
/*ARGSUSED*/
|
||||
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)
|
||||
{
|
||||
|
||||
dt_dprintf("%s: unimplemented\n", __func__);
|
||||
return (DT_PROC_ERR);
|
||||
}
|
||||
|
||||
/*ARGSUSED*/
|
||||
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)
|
||||
{
|
||||
|
||||
dt_dprintf("%s: unimplemented\n", __func__);
|
||||
return (DT_PROC_ERR);
|
||||
}
|
@ -727,7 +727,7 @@ send_iterate_fs(zfs_handle_t *zhp, void *arg)
|
||||
sd->parent_fromsnap_guid = 0;
|
||||
VERIFY(0 == nvlist_alloc(&sd->parent_snaps, NV_UNIQUE_NAME, 0));
|
||||
VERIFY(0 == nvlist_alloc(&sd->snapprops, NV_UNIQUE_NAME, 0));
|
||||
(void) zfs_iter_snapshots(zhp, B_FALSE, send_iterate_snap, sd);
|
||||
(void) zfs_iter_snapshots_sorted(zhp, send_iterate_snap, sd);
|
||||
VERIFY(0 == nvlist_add_nvlist(nvfs, "snaps", sd->parent_snaps));
|
||||
VERIFY(0 == nvlist_add_nvlist(nvfs, "snapprops", sd->snapprops));
|
||||
nvlist_free(sd->parent_snaps);
|
||||
@ -1945,11 +1945,12 @@ recv_incremental_replication(libzfs_handle_t *hdl, const char *tofs,
|
||||
recvflags_t *flags, nvlist_t *stream_nv, avl_tree_t *stream_avl,
|
||||
nvlist_t *renamed)
|
||||
{
|
||||
nvlist_t *local_nv;
|
||||
nvlist_t *local_nv, *deleted = NULL;
|
||||
avl_tree_t *local_avl;
|
||||
nvpair_t *fselem, *nextfselem;
|
||||
char *fromsnap;
|
||||
char newname[ZFS_MAXNAMELEN];
|
||||
char guidname[32];
|
||||
int error;
|
||||
boolean_t needagain, progress, recursive;
|
||||
char *s1, *s2;
|
||||
@ -1965,6 +1966,8 @@ recv_incremental_replication(libzfs_handle_t *hdl, const char *tofs,
|
||||
again:
|
||||
needagain = progress = B_FALSE;
|
||||
|
||||
VERIFY(0 == nvlist_alloc(&deleted, NV_UNIQUE_NAME, 0));
|
||||
|
||||
if ((error = gather_nvlist(hdl, tofs, fromsnap, NULL,
|
||||
recursive, &local_nv, &local_avl)) != 0)
|
||||
return (error);
|
||||
@ -2079,6 +2082,8 @@ again:
|
||||
needagain = B_TRUE;
|
||||
else
|
||||
progress = B_TRUE;
|
||||
sprintf(guidname, "%lu", thisguid);
|
||||
nvlist_add_boolean(deleted, guidname);
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -2134,6 +2139,8 @@ again:
|
||||
needagain = B_TRUE;
|
||||
else
|
||||
progress = B_TRUE;
|
||||
sprintf(guidname, "%lu", parent_fromsnap_guid);
|
||||
nvlist_add_boolean(deleted, guidname);
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -2155,6 +2162,24 @@ again:
|
||||
s1 = strrchr(fsname, '/');
|
||||
s2 = strrchr(stream_fsname, '/');
|
||||
|
||||
/*
|
||||
* Check if we're going to rename based on parent guid change
|
||||
* and the current parent guid was also deleted. If it was then
|
||||
* rename will fail and is likely unneeded, so avoid this and
|
||||
* force an early retry to determine the new
|
||||
* parent_fromsnap_guid.
|
||||
*/
|
||||
if (stream_parent_fromsnap_guid != 0 &&
|
||||
parent_fromsnap_guid != 0 &&
|
||||
stream_parent_fromsnap_guid != parent_fromsnap_guid) {
|
||||
sprintf(guidname, "%lu", parent_fromsnap_guid);
|
||||
if (nvlist_exists(deleted, guidname)) {
|
||||
progress = B_TRUE;
|
||||
needagain = B_TRUE;
|
||||
goto doagain;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Check for rename. If the exact receive path is specified, it
|
||||
* does not count as a rename, but we still need to check the
|
||||
@ -2209,8 +2234,10 @@ again:
|
||||
}
|
||||
}
|
||||
|
||||
doagain:
|
||||
fsavl_destroy(local_avl);
|
||||
nvlist_free(local_nv);
|
||||
nvlist_free(deleted);
|
||||
|
||||
if (needagain && progress) {
|
||||
/* do another pass to fix up temporary names */
|
||||
|
@ -150,6 +150,16 @@ find_vdev_problem(nvlist_t *vdev, int (*func)(uint64_t, uint64_t, uint64_t))
|
||||
return (B_TRUE);
|
||||
}
|
||||
|
||||
/*
|
||||
* Check any L2 cache devs
|
||||
*/
|
||||
if (nvlist_lookup_nvlist_array(vdev, ZPOOL_CONFIG_L2CACHE, &child,
|
||||
&children) == 0) {
|
||||
for (c = 0; c < children; c++)
|
||||
if (find_vdev_problem(child[c], func))
|
||||
return (B_TRUE);
|
||||
}
|
||||
|
||||
return (B_FALSE);
|
||||
}
|
||||
|
||||
|
@ -19,7 +19,8 @@ _libzpool= libzpool
|
||||
.endif
|
||||
.endif
|
||||
|
||||
.if ${MACHINE_ARCH} == "amd64" || ${MACHINE_ARCH} == "i386" || ${MACHINE_CPUARCH} == "mips"
|
||||
.if ${MACHINE_ARCH} == "amd64" || ${MACHINE_ARCH} == "i386" || \
|
||||
${MACHINE_CPUARCH} == "mips" || ${MACHINE_CPUARCH} == "powerpc"
|
||||
_drti= drti
|
||||
_libdtrace= libdtrace
|
||||
.endif
|
||||
|
@ -74,6 +74,10 @@ CFLAGS+= -I${OPENSOLARIS_SYS_DISTDIR}/uts/sparc
|
||||
CFLAGS+= -I${OPENSOLARIS_SYS_DISTDIR}/uts/mips
|
||||
.PATH: ${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libdtrace/mips
|
||||
.PATH: ${.CURDIR}/../../../sys/cddl/dev/dtrace/mips
|
||||
.elif ${MACHINE_CPUARCH} == "powerpc"
|
||||
CFLAGS+= -I${OPENSOLARIS_SYS_DISTDIR}/uts/powerpc
|
||||
.PATH: ${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libdtrace/powerpc
|
||||
.PATH: ${.CURDIR}/../../../sys/cddl/dev/dtrace/powerpc
|
||||
.else
|
||||
# temporary hack
|
||||
CFLAGS+= -I${OPENSOLARIS_SYS_DISTDIR}/uts/intel
|
||||
@ -99,7 +103,7 @@ dt_names.c:
|
||||
beforedepend: dt_errtags.c dt_names.c
|
||||
|
||||
beforeinstall:
|
||||
.if exists(${DESTDIR}/usr/lib/dtrace)
|
||||
.if !defined(LIBRARIES_ONLY) && exists(${DESTDIR}/usr/lib/dtrace)
|
||||
.for file in ${DSRCS}
|
||||
${INSTALL} -o ${BINOWN} -g ${BINGRP} -m ${NOBINMODE} ${.CURDIR}/${file} ${DESTDIR}/usr/lib/dtrace
|
||||
.endfor
|
||||
|
@ -5,7 +5,7 @@
|
||||
.PATH: ${.CURDIR}/../../../sys/cddl/contrib/opensolaris/common/zfs
|
||||
|
||||
PROG= zpool
|
||||
MAN= zpool.8 zpool-features.5
|
||||
MAN= zpool.8 zpool-features.7
|
||||
SRCS= zpool_main.c zpool_vdev.c zpool_iter.c zpool_util.c zfs_comutil.c
|
||||
SRCS+= timestamp.c
|
||||
|
||||
|
@ -25,4 +25,10 @@ _lockstat= lockstat
|
||||
_dtrace= dtrace
|
||||
.endif
|
||||
|
||||
.if ${MACHINE_CPUARCH} == "powerpc"
|
||||
_dtrace= dtrace
|
||||
_dtruss= dtruss
|
||||
_lockstat= lockstat
|
||||
.endif
|
||||
|
||||
.include <bsd.subdir.mk>
|
||||
|
8
contrib/atf/FREEBSD-Xlist
Normal file
8
contrib/atf/FREEBSD-Xlist
Normal file
@ -0,0 +1,8 @@
|
||||
bootstrap/
|
||||
config.log
|
||||
config.status
|
||||
libtool
|
||||
Makefile
|
||||
stamp-h1
|
||||
*/*/.deps/
|
||||
*/.deps/
|
28
contrib/atf/FREEBSD-upgrade
Normal file
28
contrib/atf/FREEBSD-upgrade
Normal file
@ -0,0 +1,28 @@
|
||||
$FreeBSD$
|
||||
|
||||
atf
|
||||
|
||||
The source code is hosted on GoogleCode 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:
|
||||
|
||||
./configure --prefix=/ --exec-prefix=/usr --datarootdir=/usr/share
|
||||
|
||||
For the contrib directory, files and directories were pruned by:
|
||||
|
||||
sh -c 'for F in `cat FREEBSD-Xlist`; do rm -rf ./$F ; done'
|
||||
|
||||
You may check if there are any new files that we don't need.
|
||||
|
||||
The instructions for importing new release and merging to HEAD can be found
|
||||
at FreeBSD wiki:
|
||||
|
||||
http://wiki.freebsd.org/SubversionPrimer/VendorImports
|
||||
|
||||
To make local changes to atf, simply patch and commit to the trunk
|
||||
branch (aka HEAD). Never make local changes on the vendor branch.
|
||||
|
||||
gcooper@FreeBSD.org
|
||||
5-August-2012
|
@ -30,6 +30,8 @@
|
||||
#if !defined(ATF_C_MACROS_H)
|
||||
#define ATF_C_MACROS_H
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include <atf-c/defs.h>
|
||||
#include <atf-c/error.h>
|
||||
#include <atf-c/tc.h>
|
||||
|
@ -239,7 +239,8 @@ ATF_TEST_CASE_WITHOUT_HEAD(require_memory_not_enough);
|
||||
ATF_TEST_CASE_BODY(require_memory_not_enough) {
|
||||
atf::tests::vars_map metadata;
|
||||
metadata["require.memory"] = "128t";
|
||||
#if defined(__APPLE__) || defined(__NetBSD__)
|
||||
#if defined(__APPLE__) || defined(__DragonFly__) || \
|
||||
defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
|
||||
do_check("Not enough memory; needed 140737488355328, available [0-9]*",
|
||||
metadata);
|
||||
#else
|
||||
|
@ -54,7 +54,7 @@ atf_test_case expout_mismatch
|
||||
expout_mismatch_head()
|
||||
{
|
||||
atf_set "descr" "Verifies that atf_check prints a diff of the" \
|
||||
"stdout and the expected stdout if the two do no" \
|
||||
"stdout and the expected stdout of the two do not" \
|
||||
"match"
|
||||
}
|
||||
expout_mismatch_body()
|
||||
@ -79,7 +79,7 @@ atf_test_case experr_mismatch
|
||||
experr_mismatch_head()
|
||||
{
|
||||
atf_set "descr" "Verifies that atf_check prints a diff of the" \
|
||||
"stderr and the expected stderr if the two do no" \
|
||||
"stderr and the expected stderr of the two do not" \
|
||||
"match"
|
||||
}
|
||||
experr_mismatch_body()
|
||||
|
@ -61,7 +61,7 @@ failures.
|
||||
This body is only executed if the abstract conditions specified by the
|
||||
header are met.
|
||||
The
|
||||
.Em cleanup routine
|
||||
.Em cleanup
|
||||
routine is a piece of code always executed after the body, regardless of
|
||||
the exit status of the test case.
|
||||
It can be used to undo side-effects of the test case.
|
||||
|
@ -1,15 +1,81 @@
|
||||
--- 9.8.3-P4 released ---
|
||||
--- 9.8.4-P1 released ---
|
||||
|
||||
3407. [security] Named could die on specific queries with dns64 enabled.
|
||||
[Addressed in change #3388 for BIND 9.8.5 and 9.9.3.]
|
||||
|
||||
--- 9.8.4 released ---
|
||||
|
||||
3383. [security] A certain combination of records in the RBT could
|
||||
cause named to hang while populating the additional
|
||||
section of a response. [RT #31090]
|
||||
|
||||
--- 9.8.3-P3 released ---
|
||||
3373. [bug] win32: open raw files in binary mode. [RT #30944]
|
||||
|
||||
3364. [security] Named could die on specially crafted record.
|
||||
[RT #30416]
|
||||
|
||||
--- 9.8.3-P2 released ---
|
||||
--- 9.8.4rc1 released ---
|
||||
|
||||
3369. [bug] nsupdate terminated unexpectedly in interactive mode
|
||||
if built with readline support. [RT #29550]
|
||||
|
||||
3368. [bug] <dns/iptable.h> and <dns/zone.h> were not C++ safe.
|
||||
|
||||
3367. [bug] dns_dnsseckey_create() result was not being checked.
|
||||
[RT #30685]
|
||||
|
||||
3366. [bug] Fixed Read-After-Write dependency violation for IA64
|
||||
atomic operations. [RT #25181]
|
||||
|
||||
3365. [bug] Removed spurious newlines from log messages in
|
||||
zone.c [RT #30675]
|
||||
|
||||
3363. [bug] Need to allow "forward" and "fowarders" options
|
||||
in static-stub zones; this had been overlooked.
|
||||
[RT #30482]
|
||||
|
||||
3362. [bug] Setting some option values to 0 in named.conf
|
||||
could trigger an assertion failure on startup.
|
||||
[RT #27730]
|
||||
|
||||
3360. [bug] 'host -w' could die. [RT #18723]
|
||||
|
||||
3359. [bug] An improperly-formed TSIG secret could cause a
|
||||
memory leak. [RT #30607]
|
||||
|
||||
3357. [port] Add support for libxml2-2.8.x [RT #30440]
|
||||
|
||||
3356. [bug] Cap the TTL of signed RRsets when RRSIGs are
|
||||
approaching their expiry, so they don't remain
|
||||
in caches after expiry. [RT #26429]
|
||||
|
||||
--- 9.8.4b1 released ---
|
||||
|
||||
3354. [func] Improve OpenSSL error logging. [RT #29932]
|
||||
|
||||
3353. [bug] Use a single task for task exclusive operations.
|
||||
[RT #29872]
|
||||
|
||||
3352. [bug] Ensure that learned server attributes timeout of the
|
||||
adb cache. [RT #29856]
|
||||
|
||||
3351. [bug] isc_mem_put and isc_mem_putanddetach didn't report
|
||||
caller if either ISC_MEM_DEBUGSIZE or ISC_MEM_DEBUGCTX
|
||||
memory debugging flags are set. [RT #30243]
|
||||
|
||||
3350. [bug] Memory read overrun in isc___mem_reallocate if
|
||||
ISC_MEM_DEBUGCTX memory debugging flag is set.
|
||||
[RT #30240]
|
||||
|
||||
3348. [bug] Prevent RRSIG data from being cached if a negative
|
||||
record matching the covering type exists at a higher
|
||||
trust level. Such data already can't be retrieved from
|
||||
the cache since change 3218 -- this prevents it
|
||||
being inserted into the cache as well. [RT #26809]
|
||||
|
||||
3347. [bug] dnssec-settime: Issue a warning when writing a new
|
||||
private key file would cause a change in the
|
||||
permissions of the existing file. [RT #27724]
|
||||
|
||||
3346. [security] Bad-cache data could be used before it was
|
||||
initialized, causing an assert. [RT #30025]
|
||||
@ -18,11 +84,47 @@
|
||||
resulting in excessive cpu usage in some cases.
|
||||
[RT #29952]
|
||||
|
||||
--- 9.8.3-P1 released ---
|
||||
3337. [bug] Change #3294 broke support for the multiple keys
|
||||
in controls. [RT #29694]
|
||||
|
||||
3335. [func] nslookup: return a nonzero exit code when unable
|
||||
to get an answer. [RT #29492]
|
||||
|
||||
3333. [bug] Setting resolver-query-timeout too low can cause
|
||||
named to not recover if it loses connectivity.
|
||||
[RT #29623]
|
||||
|
||||
3332. [bug] Re-use cached DS rrsets if possible. [RT #29446]
|
||||
|
||||
3331. [security] dns_rdataslab_fromrdataset could produce bad
|
||||
rdataslabs. [RT #29644]
|
||||
|
||||
|
||||
3330. [func] Fix missing signatures on NOERROR results despite
|
||||
RPZ rewriting. Also
|
||||
- add optional "recursive-only yes|no" to the
|
||||
response-policy statement
|
||||
- add optional "max-policy-ttl" to the response-policy
|
||||
statement to limit the false data that
|
||||
"recursive-only no" can introduce into
|
||||
resolvers' caches
|
||||
- add a RPZ performance test to bin/tests/system/rpz
|
||||
when queryperf is available.
|
||||
- the encoding of PASSTHRU action to "rpz-passthru".
|
||||
(The old encoding is still accepted.)
|
||||
[RT #26172]
|
||||
|
||||
|
||||
3329. [bug] Handle RRSIG signer-name case consistently: We
|
||||
generate RRSIG records with the signer-name in
|
||||
lower case. We accept them with any case, but if
|
||||
they fail to validate, we try again in lower case.
|
||||
[RT #27451]
|
||||
|
||||
3328. [bug] Fixed inconsistent data checking in dst_parse.c.
|
||||
[RT #29401]
|
||||
|
||||
3317. [func] Add ECDSA support (RFC 6605). [RT #21918]
|
||||
|
||||
--- 9.8.3 released ---
|
||||
|
||||
3318. [tuning] Reduce the amount of work performed while holding a
|
||||
|
@ -1,4 +1,4 @@
|
||||
# Copyright (C) 2004-2009, 2011 Internet Systems Consortium, Inc. ("ISC")
|
||||
# Copyright (C) 2004-2009, 2011, 2012 Internet Systems Consortium, Inc. ("ISC")
|
||||
# Copyright (C) 1998-2002 Internet Software Consortium.
|
||||
#
|
||||
# Permission to use, copy, modify, and/or distribute this software for any
|
||||
|
@ -51,6 +51,11 @@ BIND 9
|
||||
For up-to-date release notes and errata, see
|
||||
http://www.isc.org/software/bind9/releasenotes
|
||||
|
||||
BIND 9.8.4
|
||||
|
||||
BIND 9.8.4 includes several bug fixes and patches security
|
||||
flaws described in CVE-2012-1667, CVE-2012-3817 and CVE-2012-4244.
|
||||
|
||||
BIND 9.8.3
|
||||
|
||||
BIND 9.8.3 is a maintenance release.
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2004, 2005, 2007, 2008 Internet Systems Consortium, Inc. ("ISC")
|
||||
* Copyright (C) 2004, 2005, 2007, 2008, 2012 Internet Systems Consortium, Inc. ("ISC")
|
||||
* Copyright (C) 1999-2003 Internet Software Consortium.
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for any
|
||||
@ -138,6 +138,9 @@ int sigwait(const unsigned int *set, int *sig);
|
||||
/* Define if OpenSSL includes DSA support */
|
||||
#undef HAVE_OPENSSL_DSA
|
||||
|
||||
/* Define if OpenSSL includes ECDSA support */
|
||||
#undef HAVE_OPENSSL_ECDSA
|
||||
|
||||
/* Define to the length type used by the socket API (socklen_t, size_t, int). */
|
||||
#undef ISC_SOCKADDR_LEN_T
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
# Copyright (C) 2004, 2007, 2009 Internet Systems Consortium, Inc. ("ISC")
|
||||
# Copyright (C) 2004, 2007, 2009, 2012 Internet Systems Consortium, Inc. ("ISC")
|
||||
# Copyright (C) 1998-2001 Internet Software Consortium.
|
||||
#
|
||||
# Permission to use, copy, modify, and/or distribute this software for any
|
||||
|
@ -1,4 +1,4 @@
|
||||
# Copyright (C) 2004-2007, 2009 Internet Systems Consortium, Inc. ("ISC")
|
||||
# Copyright (C) 2004-2007, 2009, 2012 Internet Systems Consortium, Inc. ("ISC")
|
||||
# Copyright (C) 2000-2003 Internet Software Consortium.
|
||||
#
|
||||
# Permission to use, copy, modify, and/or distribute this software for any
|
||||
|
@ -639,6 +639,9 @@ dump_zone(const char *zonename, dns_zone_t *zone, const char *filename,
|
||||
{
|
||||
isc_result_t result;
|
||||
FILE *output = stdout;
|
||||
const char *flags;
|
||||
|
||||
flags = (fileformat == dns_masterformat_text) ? "w+" : "wb+";
|
||||
|
||||
if (debug) {
|
||||
if (filename != NULL && strcmp(filename, "-") != 0)
|
||||
@ -649,7 +652,7 @@ dump_zone(const char *zonename, dns_zone_t *zone, const char *filename,
|
||||
}
|
||||
|
||||
if (filename != NULL && strcmp(filename, "-") != 0) {
|
||||
result = isc_stdio_open(filename, "w+", &output);
|
||||
result = isc_stdio_open(filename, flags, &output);
|
||||
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
fprintf(stderr, "could not open output "
|
||||
|
@ -1,4 +1,4 @@
|
||||
# Copyright (C) 2009 Internet Systems Consortium, Inc. ("ISC")
|
||||
# Copyright (C) 2009, 2012 Internet Systems Consortium, Inc. ("ISC")
|
||||
#
|
||||
# Permission to use, copy, modify, and/or distribute this software for any
|
||||
# purpose with or without fee is hereby granted, provided that the above
|
||||
|
@ -1,4 +1,4 @@
|
||||
# Copyright (C) 2009 Internet Systems Consortium, Inc. ("ISC")
|
||||
# Copyright (C) 2009, 2012 Internet Systems Consortium, Inc. ("ISC")
|
||||
#
|
||||
# Permission to use, copy, modify, and/or distribute this software for any
|
||||
# purpose with or without fee is hereby granted, provided that the above
|
||||
|
@ -1,4 +1,4 @@
|
||||
# Copyright (C) 2004, 2005, 2007, 2009 Internet Systems Consortium, Inc. ("ISC")
|
||||
# Copyright (C) 2004, 2005, 2007, 2009, 2012 Internet Systems Consortium, Inc. ("ISC")
|
||||
# Copyright (C) 2000-2002 Internet Software Consortium.
|
||||
#
|
||||
# Permission to use, copy, modify, and/or distribute this software for any
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2011 Internet Systems Consortium, Inc. ("ISC")
|
||||
* Copyright (C) 2004-2012 Internet Systems Consortium, Inc. ("ISC")
|
||||
* Copyright (C) 2000-2003 Internet Software Consortium.
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for any
|
||||
@ -57,6 +57,7 @@ static isc_boolean_t in_use = ISC_FALSE;
|
||||
static char defclass[MXRD] = "IN";
|
||||
static char deftype[MXRD] = "A";
|
||||
static isc_event_t *global_event = NULL;
|
||||
static int query_error = 1, print_error = 0;
|
||||
|
||||
static char domainopt[DNS_NAME_MAXTEXT];
|
||||
|
||||
@ -406,6 +407,9 @@ isc_result_t
|
||||
printmessage(dig_query_t *query, dns_message_t *msg, isc_boolean_t headers) {
|
||||
char servtext[ISC_SOCKADDR_FORMATSIZE];
|
||||
|
||||
/* I've we've gotten this far, we've reached a server. */
|
||||
query_error = 0;
|
||||
|
||||
debug("printmessage()");
|
||||
|
||||
isc_sockaddr_format(&query->sockaddr, servtext, sizeof(servtext));
|
||||
@ -433,6 +437,9 @@ printmessage(dig_query_t *query, dns_message_t *msg, isc_boolean_t headers) {
|
||||
(msg->rcode != dns_rcode_nxdomain) ? nametext :
|
||||
query->lookup->textname, rcode_totext(msg->rcode));
|
||||
debug("returning with rcode == 0");
|
||||
|
||||
/* the lookup failed */
|
||||
print_error |= 1;
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
@ -887,5 +894,5 @@ main(int argc, char **argv) {
|
||||
destroy_libs();
|
||||
isc_app_finish();
|
||||
|
||||
return (0);
|
||||
return (query_error | print_error);
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
# Copyright (C) 2004, 2005, 2007-2009 Internet Systems Consortium, Inc. ("ISC")
|
||||
# Copyright (C) 2004, 2005, 2007-2009, 2012 Internet Systems Consortium, Inc. ("ISC")
|
||||
# Copyright (C) 2000-2002 Internet Software Consortium.
|
||||
#
|
||||
# Permission to use, copy, modify, and/or distribute this software for any
|
||||
|
@ -1,4 +1,4 @@
|
||||
.\" Copyright (C) 2008-2010 Internet Systems Consortium, Inc. ("ISC")
|
||||
.\" Copyright (C) 2008-2010, 2012 Internet Systems Consortium, Inc. ("ISC")
|
||||
.\"
|
||||
.\" Permission to use, copy, modify, and/or distribute this software for any
|
||||
.\" purpose with or without fee is hereby granted, provided that the above
|
||||
@ -55,7 +55,7 @@ Use SHA\-256 as the digest algorithm.
|
||||
.RS 4
|
||||
Select the digest algorithm. The value of
|
||||
\fBalgorithm\fR
|
||||
must be one of SHA\-1 (SHA1), SHA\-256 (SHA256) or GOST. These values are case insensitive.
|
||||
must be one of SHA\-1 (SHA1), SHA\-256 (SHA256), GOST or SHA\-384 (SHA384). These values are case insensitive.
|
||||
.RE
|
||||
.PP
|
||||
\-K \fIdirectory\fR
|
||||
@ -139,5 +139,5 @@ RFC 4509.
|
||||
.PP
|
||||
Internet Systems Consortium
|
||||
.SH "COPYRIGHT"
|
||||
Copyright \(co 2008\-2010 Internet Systems Consortium, Inc. ("ISC")
|
||||
Copyright \(co 2008\-2010, 2012 Internet Systems Consortium, Inc. ("ISC")
|
||||
.br
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2008-2011 Internet Systems Consortium, Inc. ("ISC")
|
||||
* Copyright (C) 2008-2012 Internet Systems Consortium, Inc. ("ISC")
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
@ -296,7 +296,7 @@ usage(void) {
|
||||
fprintf(stderr, " -K <directory>: directory in which to find "
|
||||
"key file or keyset file\n");
|
||||
fprintf(stderr, " -a algorithm: digest algorithm "
|
||||
"(SHA-1, SHA-256 or GOST)\n");
|
||||
"(SHA-1, SHA-256, GOST or SHA-384)\n");
|
||||
fprintf(stderr, " -1: use SHA-1\n");
|
||||
fprintf(stderr, " -2: use SHA-256\n");
|
||||
fprintf(stderr, " -l: add lookaside zone and print DLV records\n");
|
||||
@ -415,6 +415,9 @@ main(int argc, char **argv) {
|
||||
else if (strcasecmp(algname, "GOST") == 0)
|
||||
dtype = DNS_DSDIGEST_GOST;
|
||||
#endif
|
||||
else if (strcasecmp(algname, "SHA384") == 0 ||
|
||||
strcasecmp(algname, "SHA-384") == 0)
|
||||
dtype = DNS_DSDIGEST_SHA384;
|
||||
else
|
||||
fatal("unknown algorithm %s", algname);
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"
|
||||
[<!ENTITY mdash "—">]>
|
||||
<!--
|
||||
- Copyright (C) 2008-2010 Internet Systems Consortium, Inc. ("ISC")
|
||||
- Copyright (C) 2008-2010, 2012 Internet Systems Consortium, Inc. ("ISC")
|
||||
-
|
||||
- Permission to use, copy, modify, and/or distribute this software for any
|
||||
- purpose with or without fee is hereby granted, provided that the above
|
||||
@ -39,6 +39,7 @@
|
||||
<year>2008</year>
|
||||
<year>2009</year>
|
||||
<year>2010</year>
|
||||
<year>2012</year>
|
||||
<holder>Internet Systems Consortium, Inc. ("ISC")</holder>
|
||||
</copyright>
|
||||
</docinfo>
|
||||
@ -107,7 +108,8 @@
|
||||
<para>
|
||||
Select the digest algorithm. The value of
|
||||
<option>algorithm</option> must be one of SHA-1 (SHA1),
|
||||
SHA-256 (SHA256) or GOST. These values are case insensitive.
|
||||
SHA-256 (SHA256), GOST or SHA-384 (SHA384).
|
||||
These values are case insensitive.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
@ -1,5 +1,5 @@
|
||||
<!--
|
||||
- Copyright (C) 2008-2010 Internet Systems Consortium, Inc. ("ISC")
|
||||
- Copyright (C) 2008-2010, 2012 Internet Systems Consortium, Inc. ("ISC")
|
||||
-
|
||||
- Permission to use, copy, modify, and/or distribute this software for any
|
||||
- purpose with or without fee is hereby granted, provided that the above
|
||||
@ -32,14 +32,14 @@
|
||||
<div class="cmdsynopsis"><p><code class="command">dnssec-dsfromkey</code> {-s} [<code class="option">-1</code>] [<code class="option">-2</code>] [<code class="option">-a <em class="replaceable"><code>alg</code></em></code>] [<code class="option">-K <em class="replaceable"><code>directory</code></em></code>] [<code class="option">-l <em class="replaceable"><code>domain</code></em></code>] [<code class="option">-s</code>] [<code class="option">-c <em class="replaceable"><code>class</code></em></code>] [<code class="option">-f <em class="replaceable"><code>file</code></em></code>] [<code class="option">-A</code>] [<code class="option">-v <em class="replaceable"><code>level</code></em></code>] {dnsname}</p></div>
|
||||
</div>
|
||||
<div class="refsect1" lang="en">
|
||||
<a name="id2543465"></a><h2>DESCRIPTION</h2>
|
||||
<a name="id2543468"></a><h2>DESCRIPTION</h2>
|
||||
<p><span><strong class="command">dnssec-dsfromkey</strong></span>
|
||||
outputs the Delegation Signer (DS) resource record (RR), as defined in
|
||||
RFC 3658 and RFC 4509, for the given key(s).
|
||||
</p>
|
||||
</div>
|
||||
<div class="refsect1" lang="en">
|
||||
<a name="id2543477"></a><h2>OPTIONS</h2>
|
||||
<a name="id2543480"></a><h2>OPTIONS</h2>
|
||||
<div class="variablelist"><dl>
|
||||
<dt><span class="term">-1</span></dt>
|
||||
<dd><p>
|
||||
@ -54,7 +54,8 @@
|
||||
<dd><p>
|
||||
Select the digest algorithm. The value of
|
||||
<code class="option">algorithm</code> must be one of SHA-1 (SHA1),
|
||||
SHA-256 (SHA256) or GOST. These values are case insensitive.
|
||||
SHA-256 (SHA256), GOST or SHA-384 (SHA384).
|
||||
These values are case insensitive.
|
||||
</p></dd>
|
||||
<dt><span class="term">-K <em class="replaceable"><code>directory</code></em></span></dt>
|
||||
<dd><p>
|
||||
@ -100,7 +101,7 @@
|
||||
</dl></div>
|
||||
</div>
|
||||
<div class="refsect1" lang="en">
|
||||
<a name="id2543664"></a><h2>EXAMPLE</h2>
|
||||
<a name="id2543667"></a><h2>EXAMPLE</h2>
|
||||
<p>
|
||||
To build the SHA-256 DS RR from the
|
||||
<strong class="userinput"><code>Kexample.com.+003+26160</code></strong>
|
||||
@ -115,7 +116,7 @@
|
||||
</p>
|
||||
</div>
|
||||
<div class="refsect1" lang="en">
|
||||
<a name="id2543693"></a><h2>FILES</h2>
|
||||
<a name="id2543697"></a><h2>FILES</h2>
|
||||
<p>
|
||||
The keyfile can be designed by the key identification
|
||||
<code class="filename">Knnnn.+aaa+iiiii</code> or the full file name
|
||||
@ -129,13 +130,13 @@
|
||||
</p>
|
||||
</div>
|
||||
<div class="refsect1" lang="en">
|
||||
<a name="id2543729"></a><h2>CAVEAT</h2>
|
||||
<a name="id2543732"></a><h2>CAVEAT</h2>
|
||||
<p>
|
||||
A keyfile error can give a "file not found" even if the file exists.
|
||||
</p>
|
||||
</div>
|
||||
<div class="refsect1" lang="en">
|
||||
<a name="id2543738"></a><h2>SEE ALSO</h2>
|
||||
<a name="id2543741"></a><h2>SEE ALSO</h2>
|
||||
<p><span class="citerefentry"><span class="refentrytitle">dnssec-keygen</span>(8)</span>,
|
||||
<span class="citerefentry"><span class="refentrytitle">dnssec-signzone</span>(8)</span>,
|
||||
<em class="citetitle">BIND 9 Administrator Reference Manual</em>,
|
||||
@ -145,7 +146,7 @@
|
||||
</p>
|
||||
</div>
|
||||
<div class="refsect1" lang="en">
|
||||
<a name="id2543778"></a><h2>AUTHOR</h2>
|
||||
<a name="id2543781"></a><h2>AUTHOR</h2>
|
||||
<p><span class="corpauthor">Internet Systems Consortium</span>
|
||||
</p>
|
||||
</div>
|
||||
|
@ -1,4 +1,4 @@
|
||||
.\" Copyright (C) 2008-2011 Internet Systems Consortium, Inc. ("ISC")
|
||||
.\" Copyright (C) 2008-2012 Internet Systems Consortium, Inc. ("ISC")
|
||||
.\"
|
||||
.\" Permission to use, copy, modify, and/or distribute this software for any
|
||||
.\" purpose with or without fee is hereby granted, provided that the above
|
||||
@ -47,7 +47,7 @@ of the key is specified on the command line. This must match the name of the zon
|
||||
.RS 4
|
||||
Selects the cryptographic algorithm. The value of
|
||||
\fBalgorithm\fR
|
||||
must be one of RSAMD5, RSASHA1, DSA, NSEC3RSASHA1, NSEC3DSA, RSASHA256, RSASHA512 or ECCGOST. These values are case insensitive.
|
||||
must be one of RSAMD5, RSASHA1, DSA, NSEC3RSASHA1, NSEC3DSA, RSASHA256, RSASHA512, ECCGOST, ECDSAP256SHA256 or ECDSAP384SHA384. These values are case insensitive.
|
||||
.sp
|
||||
If no algorithm is specified, then RSASHA1 will be used by default, unless the
|
||||
\fB\-3\fR
|
||||
@ -215,5 +215,5 @@ RFC 4034.
|
||||
.PP
|
||||
Internet Systems Consortium
|
||||
.SH "COPYRIGHT"
|
||||
Copyright \(co 2008\-2011 Internet Systems Consortium, Inc. ("ISC")
|
||||
Copyright \(co 2008\-2012 Internet Systems Consortium, Inc. ("ISC")
|
||||
.br
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2007-2011 Internet Systems Consortium, Inc. ("ISC")
|
||||
* Copyright (C) 2007-2012 Internet Systems Consortium, Inc. ("ISC")
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
@ -55,7 +55,8 @@ int verbose;
|
||||
|
||||
static const char *algs = "RSA | RSAMD5 | DH | DSA | RSASHA1 |"
|
||||
" NSEC3DSA | NSEC3RSASHA1 |"
|
||||
" RSASHA256 | RSASHA512 | ECCGOST";
|
||||
" RSASHA256 | RSASHA512 | ECCGOST |"
|
||||
" ECDSAP256SHA256 | ECDSAP384SHA384";
|
||||
|
||||
ISC_PLATFORM_NORETURN_PRE static void
|
||||
usage(void) ISC_PLATFORM_NORETURN_POST;
|
||||
@ -369,7 +370,8 @@ main(int argc, char **argv) {
|
||||
if (use_nsec3 &&
|
||||
alg != DST_ALG_NSEC3DSA && alg != DST_ALG_NSEC3RSASHA1 &&
|
||||
alg != DST_ALG_RSASHA256 && alg != DST_ALG_RSASHA512 &&
|
||||
alg != DST_ALG_ECCGOST) {
|
||||
alg != DST_ALG_ECCGOST &&
|
||||
alg != DST_ALG_ECDSA256 && alg != DST_ALG_ECDSA384) {
|
||||
fatal("%s is incompatible with NSEC3; "
|
||||
"do not use the -3 option", algname);
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"
|
||||
[<!ENTITY mdash "—">]>
|
||||
<!--
|
||||
- Copyright (C) 2008-2011 Internet Systems Consortium, Inc. ("ISC")
|
||||
- Copyright (C) 2008-2012 Internet Systems Consortium, Inc. ("ISC")
|
||||
-
|
||||
- Permission to use, copy, modify, and/or distribute this software for any
|
||||
- purpose with or without fee is hereby granted, provided that the above
|
||||
@ -40,6 +40,7 @@
|
||||
<year>2009</year>
|
||||
<year>2010</year>
|
||||
<year>2011</year>
|
||||
<year>2012</year>
|
||||
<holder>Internet Systems Consortium, Inc. ("ISC")</holder>
|
||||
</copyright>
|
||||
</docinfo>
|
||||
@ -94,7 +95,8 @@
|
||||
<para>
|
||||
Selects the cryptographic algorithm. The value of
|
||||
<option>algorithm</option> must be one of RSAMD5, RSASHA1,
|
||||
DSA, NSEC3RSASHA1, NSEC3DSA, RSASHA256, RSASHA512 or ECCGOST.
|
||||
DSA, NSEC3RSASHA1, NSEC3DSA, RSASHA256, RSASHA512, ECCGOST,
|
||||
ECDSAP256SHA256 or ECDSAP384SHA384.
|
||||
These values are case insensitive.
|
||||
</para>
|
||||
<para>
|
||||
|
@ -1,5 +1,5 @@
|
||||
<!--
|
||||
- Copyright (C) 2008-2011 Internet Systems Consortium, Inc. ("ISC")
|
||||
- Copyright (C) 2008-2012 Internet Systems Consortium, Inc. ("ISC")
|
||||
-
|
||||
- Permission to use, copy, modify, and/or distribute this software for any
|
||||
- purpose with or without fee is hereby granted, provided that the above
|
||||
@ -31,7 +31,7 @@
|
||||
<div class="cmdsynopsis"><p><code class="command">dnssec-keyfromlabel</code> {-l <em class="replaceable"><code>label</code></em>} [<code class="option">-3</code>] [<code class="option">-a <em class="replaceable"><code>algorithm</code></em></code>] [<code class="option">-A <em class="replaceable"><code>date/offset</code></em></code>] [<code class="option">-c <em class="replaceable"><code>class</code></em></code>] [<code class="option">-D <em class="replaceable"><code>date/offset</code></em></code>] [<code class="option">-E <em class="replaceable"><code>engine</code></em></code>] [<code class="option">-f <em class="replaceable"><code>flag</code></em></code>] [<code class="option">-G</code>] [<code class="option">-I <em class="replaceable"><code>date/offset</code></em></code>] [<code class="option">-k</code>] [<code class="option">-K <em class="replaceable"><code>directory</code></em></code>] [<code class="option">-n <em class="replaceable"><code>nametype</code></em></code>] [<code class="option">-P <em class="replaceable"><code>date/offset</code></em></code>] [<code class="option">-p <em class="replaceable"><code>protocol</code></em></code>] [<code class="option">-R <em class="replaceable"><code>date/offset</code></em></code>] [<code class="option">-t <em class="replaceable"><code>type</code></em></code>] [<code class="option">-v <em class="replaceable"><code>level</code></em></code>] [<code class="option">-y</code>] {name}</p></div>
|
||||
</div>
|
||||
<div class="refsect1" lang="en">
|
||||
<a name="id2543495"></a><h2>DESCRIPTION</h2>
|
||||
<a name="id2543498"></a><h2>DESCRIPTION</h2>
|
||||
<p><span><strong class="command">dnssec-keyfromlabel</strong></span>
|
||||
gets keys with the given label from a crypto hardware and builds
|
||||
key files for DNSSEC (Secure DNS), as defined in RFC 2535
|
||||
@ -44,14 +44,15 @@
|
||||
</p>
|
||||
</div>
|
||||
<div class="refsect1" lang="en">
|
||||
<a name="id2543513"></a><h2>OPTIONS</h2>
|
||||
<a name="id2543516"></a><h2>OPTIONS</h2>
|
||||
<div class="variablelist"><dl>
|
||||
<dt><span class="term">-a <em class="replaceable"><code>algorithm</code></em></span></dt>
|
||||
<dd>
|
||||
<p>
|
||||
Selects the cryptographic algorithm. The value of
|
||||
<code class="option">algorithm</code> must be one of RSAMD5, RSASHA1,
|
||||
DSA, NSEC3RSASHA1, NSEC3DSA, RSASHA256, RSASHA512 or ECCGOST.
|
||||
DSA, NSEC3RSASHA1, NSEC3DSA, RSASHA256, RSASHA512, ECCGOST,
|
||||
ECDSAP256SHA256 or ECDSAP384SHA384.
|
||||
These values are case insensitive.
|
||||
</p>
|
||||
<p>
|
||||
@ -163,7 +164,7 @@
|
||||
</dl></div>
|
||||
</div>
|
||||
<div class="refsect1" lang="en">
|
||||
<a name="id2543877"></a><h2>TIMING OPTIONS</h2>
|
||||
<a name="id2543880"></a><h2>TIMING OPTIONS</h2>
|
||||
<p>
|
||||
Dates can be expressed in the format YYYYMMDD or YYYYMMDDHHMMSS.
|
||||
If the argument begins with a '+' or '-', it is interpreted as
|
||||
@ -210,7 +211,7 @@
|
||||
</dl></div>
|
||||
</div>
|
||||
<div class="refsect1" lang="en">
|
||||
<a name="id2544043"></a><h2>GENERATED KEY FILES</h2>
|
||||
<a name="id2544046"></a><h2>GENERATED KEY FILES</h2>
|
||||
<p>
|
||||
When <span><strong class="command">dnssec-keyfromlabel</strong></span> completes
|
||||
successfully,
|
||||
@ -249,7 +250,7 @@
|
||||
</p>
|
||||
</div>
|
||||
<div class="refsect1" lang="en">
|
||||
<a name="id2544116"></a><h2>SEE ALSO</h2>
|
||||
<a name="id2544119"></a><h2>SEE ALSO</h2>
|
||||
<p><span class="citerefentry"><span class="refentrytitle">dnssec-keygen</span>(8)</span>,
|
||||
<span class="citerefentry"><span class="refentrytitle">dnssec-signzone</span>(8)</span>,
|
||||
<em class="citetitle">BIND 9 Administrator Reference Manual</em>,
|
||||
@ -257,7 +258,7 @@
|
||||
</p>
|
||||
</div>
|
||||
<div class="refsect1" lang="en">
|
||||
<a name="id2544149"></a><h2>AUTHOR</h2>
|
||||
<a name="id2544152"></a><h2>AUTHOR</h2>
|
||||
<p><span class="corpauthor">Internet Systems Consortium</span>
|
||||
</p>
|
||||
</div>
|
||||
|
@ -1,4 +1,4 @@
|
||||
.\" Copyright (C) 2004, 2005, 2007-2010 Internet Systems Consortium, Inc. ("ISC")
|
||||
.\" Copyright (C) 2004, 2005, 2007-2010, 2012 Internet Systems Consortium, Inc. ("ISC")
|
||||
.\" Copyright (C) 2000-2003 Internet Software Consortium.
|
||||
.\"
|
||||
.\" Permission to use, copy, modify, and/or distribute this software for any
|
||||
@ -48,7 +48,7 @@ of the key is specified on the command line. For DNSSEC keys, this must match th
|
||||
.RS 4
|
||||
Selects the cryptographic algorithm. For DNSSEC keys, the value of
|
||||
\fBalgorithm\fR
|
||||
must be one of RSAMD5, RSASHA1, DSA, NSEC3RSASHA1, NSEC3DSA, RSASHA256, RSASHA512 or ECCGOST. For TSIG/TKEY, the value must be DH (Diffie Hellman), HMAC\-MD5, HMAC\-SHA1, HMAC\-SHA224, HMAC\-SHA256, HMAC\-SHA384, or HMAC\-SHA512. These values are case insensitive.
|
||||
must be one of RSAMD5, RSASHA1, DSA, NSEC3RSASHA1, NSEC3DSA, RSASHA256, RSASHA512, ECCGOST, ECDSAP256SHA256 or ECDSAP384SHA384. For TSIG/TKEY, the value must be DH (Diffie Hellman), HMAC\-MD5, HMAC\-SHA1, HMAC\-SHA224, HMAC\-SHA256, HMAC\-SHA384, or HMAC\-SHA512. These values are case insensitive.
|
||||
.sp
|
||||
If no algorithm is specified, then RSASHA1 will be used by default, unless the
|
||||
\fB\-3\fR
|
||||
@ -63,7 +63,7 @@ Note 2: DH, HMAC\-MD5, and HMAC\-SHA1 through HMAC\-SHA512 automatically set the
|
||||
.PP
|
||||
\-b \fIkeysize\fR
|
||||
.RS 4
|
||||
Specifies the number of bits in the key. The choice of key size depends on the algorithm used. RSA keys must be between 512 and 2048 bits. Diffie Hellman keys must be between 128 and 4096 bits. DSA keys must be between 512 and 1024 bits and an exact multiple of 64. HMAC keys must be between 1 and 512 bits.
|
||||
Specifies the number of bits in the key. The choice of key size depends on the algorithm used. RSA keys must be between 512 and 2048 bits. Diffie Hellman keys must be between 128 and 4096 bits. DSA keys must be between 512 and 1024 bits and an exact multiple of 64. HMAC keys must be between 1 and 512 bits. Elliptic curve algorithms don't need this parameter.
|
||||
.sp
|
||||
The key size does not need to be specified if using a default algorithm. The default key size is 1024 bits for zone signing keys (ZSK's) and 2048 bits for key signing keys (KSK's, generated with
|
||||
\fB\-f KSK\fR). However, if an algorithm is explicitly specified with the
|
||||
@ -81,7 +81,7 @@ must either be ZONE (for a DNSSEC zone key (KEY/DNSKEY)), HOST or ENTITY (for a
|
||||
.PP
|
||||
\-3
|
||||
.RS 4
|
||||
Use an NSEC3\-capable algorithm to generate a DNSSEC key. If this option is used and no algorithm is explicitly set on the command line, NSEC3RSASHA1 will be used by default. Note that RSASHA256, RSASHA512 and ECCGOST algorithms are NSEC3\-capable.
|
||||
Use an NSEC3\-capable algorithm to generate a DNSSEC key. If this option is used and no algorithm is explicitly set on the command line, NSEC3RSASHA1 will be used by default. Note that RSASHA256, RSASHA512, ECCGOST, ECDSAP256SHA256 and ECDSAP384SHA384 algorithms are NSEC3\-capable.
|
||||
.RE
|
||||
.PP
|
||||
\-C
|
||||
@ -298,7 +298,7 @@ RFC 4034.
|
||||
.PP
|
||||
Internet Systems Consortium
|
||||
.SH "COPYRIGHT"
|
||||
Copyright \(co 2004, 2005, 2007\-2010 Internet Systems Consortium, Inc. ("ISC")
|
||||
Copyright \(co 2004, 2005, 2007\-2010, 2012 Internet Systems Consortium, Inc. ("ISC")
|
||||
.br
|
||||
Copyright \(co 2000\-2003 Internet Software Consortium.
|
||||
.br
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Portions Copyright (C) 2004-2011 Internet Systems Consortium, Inc. ("ISC")
|
||||
* Portions Copyright (C) 2004-2012 Internet Systems Consortium, Inc. ("ISC")
|
||||
* Portions Copyright (C) 1999-2003 Internet Software Consortium.
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for any
|
||||
@ -85,6 +85,7 @@ usage(void) {
|
||||
fprintf(stderr, " RSA | RSAMD5 | DSA | RSASHA1 | NSEC3RSASHA1"
|
||||
" | NSEC3DSA |\n");
|
||||
fprintf(stderr, " RSASHA256 | RSASHA512 | ECCGOST |\n");
|
||||
fprintf(stderr, " ECDSAP256SHA256 | ECDSAP384SHA384 |\n");
|
||||
fprintf(stderr, " DH | HMAC-MD5 | HMAC-SHA1 | HMAC-SHA224 | "
|
||||
"HMAC-SHA256 | \n");
|
||||
fprintf(stderr, " HMAC-SHA384 | HMAC-SHA512\n");
|
||||
@ -102,6 +103,8 @@ usage(void) {
|
||||
fprintf(stderr, " NSEC3DSA:\t[512..1024] and divisible "
|
||||
"by 64\n");
|
||||
fprintf(stderr, " ECCGOST:\tignored\n");
|
||||
fprintf(stderr, " ECDSAP256SHA256:\tignored\n");
|
||||
fprintf(stderr, " ECDSAP384SHA384:\tignored\n");
|
||||
fprintf(stderr, " HMAC-MD5:\t[1..512]\n");
|
||||
fprintf(stderr, " HMAC-SHA1:\t[1..160]\n");
|
||||
fprintf(stderr, " HMAC-SHA224:\t[1..224]\n");
|
||||
@ -549,7 +552,8 @@ main(int argc, char **argv) {
|
||||
if (use_nsec3 &&
|
||||
alg != DST_ALG_NSEC3DSA && alg != DST_ALG_NSEC3RSASHA1 &&
|
||||
alg != DST_ALG_RSASHA256 && alg!= DST_ALG_RSASHA512 &&
|
||||
alg != DST_ALG_ECCGOST) {
|
||||
alg != DST_ALG_ECCGOST &&
|
||||
alg != DST_ALG_ECDSA256 && alg != DST_ALG_ECDSA384) {
|
||||
fatal("%s is incompatible with NSEC3; "
|
||||
"do not use the -3 option", algname);
|
||||
}
|
||||
@ -579,9 +583,11 @@ main(int argc, char **argv) {
|
||||
size = 1024;
|
||||
if (verbose > 0)
|
||||
fprintf(stderr, "key size not "
|
||||
"specified; defaulting "
|
||||
"to %d\n", size);
|
||||
} else if (alg != DST_ALG_ECCGOST)
|
||||
"specified; defaulting"
|
||||
" to %d\n", size);
|
||||
} else if (alg != DST_ALG_ECCGOST &&
|
||||
alg != DST_ALG_ECDSA256 &&
|
||||
alg != DST_ALG_ECDSA384)
|
||||
fatal("key size not specified (-b option)");
|
||||
}
|
||||
|
||||
@ -710,6 +716,8 @@ main(int argc, char **argv) {
|
||||
fatal("invalid DSS key size: %d", size);
|
||||
break;
|
||||
case DST_ALG_ECCGOST:
|
||||
case DST_ALG_ECDSA256:
|
||||
case DST_ALG_ECDSA384:
|
||||
break;
|
||||
case DST_ALG_HMACMD5:
|
||||
options |= DST_TYPE_KEY;
|
||||
@ -775,7 +783,8 @@ main(int argc, char **argv) {
|
||||
|
||||
if (!(alg == DNS_KEYALG_RSAMD5 || alg == DNS_KEYALG_RSASHA1 ||
|
||||
alg == DNS_KEYALG_NSEC3RSASHA1 || alg == DNS_KEYALG_RSASHA256 ||
|
||||
alg == DNS_KEYALG_RSASHA512 || alg == DST_ALG_ECCGOST) &&
|
||||
alg == DNS_KEYALG_RSASHA512 || alg == DST_ALG_ECCGOST ||
|
||||
alg == DST_ALG_ECDSA256 || alg == DST_ALG_ECDSA384) &&
|
||||
rsa_exp != 0)
|
||||
fatal("specified RSA exponent for a non-RSA key");
|
||||
|
||||
@ -849,6 +858,8 @@ main(int argc, char **argv) {
|
||||
case DNS_KEYALG_DSA:
|
||||
case DNS_KEYALG_NSEC3DSA:
|
||||
case DST_ALG_ECCGOST:
|
||||
case DST_ALG_ECDSA256:
|
||||
case DST_ALG_ECDSA384:
|
||||
show_progress = ISC_TRUE;
|
||||
/* fall through */
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"
|
||||
[<!ENTITY mdash "—">]>
|
||||
<!--
|
||||
- Copyright (C) 2004, 2005, 2007-2010 Internet Systems Consortium, Inc. ("ISC")
|
||||
- Copyright (C) 2004, 2005, 2007-2010, 2012 Internet Systems Consortium, Inc. ("ISC")
|
||||
- Copyright (C) 2000-2003 Internet Software Consortium.
|
||||
-
|
||||
- Permission to use, copy, modify, and/or distribute this software for any
|
||||
@ -43,6 +43,7 @@
|
||||
<year>2008</year>
|
||||
<year>2009</year>
|
||||
<year>2010</year>
|
||||
<year>2012</year>
|
||||
<holder>Internet Systems Consortium, Inc. ("ISC")</holder>
|
||||
</copyright>
|
||||
<copyright>
|
||||
@ -114,7 +115,8 @@
|
||||
<para>
|
||||
Selects the cryptographic algorithm. For DNSSEC keys, the value
|
||||
of <option>algorithm</option> must be one of RSAMD5, RSASHA1,
|
||||
DSA, NSEC3RSASHA1, NSEC3DSA, RSASHA256, RSASHA512 or ECCGOST.
|
||||
DSA, NSEC3RSASHA1, NSEC3DSA, RSASHA256, RSASHA512, ECCGOST,
|
||||
ECDSAP256SHA256 or ECDSAP384SHA384.
|
||||
For TSIG/TKEY, the value must
|
||||
be DH (Diffie Hellman), HMAC-MD5, HMAC-SHA1, HMAC-SHA224,
|
||||
HMAC-SHA256, HMAC-SHA384, or HMAC-SHA512. These values are
|
||||
@ -148,7 +150,8 @@
|
||||
between 512 and 2048 bits. Diffie Hellman keys must be between
|
||||
128 and 4096 bits. DSA keys must be between 512 and 1024
|
||||
bits and an exact multiple of 64. HMAC keys must be
|
||||
between 1 and 512 bits.
|
||||
between 1 and 512 bits. Elliptic curve algorithms don't need
|
||||
this parameter.
|
||||
</para>
|
||||
<para>
|
||||
The key size does not need to be specified if using a default
|
||||
@ -184,7 +187,8 @@
|
||||
Use an NSEC3-capable algorithm to generate a DNSSEC key.
|
||||
If this option is used and no algorithm is explicitly
|
||||
set on the command line, NSEC3RSASHA1 will be used by
|
||||
default. Note that RSASHA256, RSASHA512 and ECCGOST algorithms
|
||||
default. Note that RSASHA256, RSASHA512, ECCGOST,
|
||||
ECDSAP256SHA256 and ECDSAP384SHA384 algorithms
|
||||
are NSEC3-capable.
|
||||
</para>
|
||||
</listitem>
|
||||
|
@ -1,5 +1,5 @@
|
||||
<!--
|
||||
- Copyright (C) 2004, 2005, 2007-2010 Internet Systems Consortium, Inc. ("ISC")
|
||||
- Copyright (C) 2004, 2005, 2007-2010, 2012 Internet Systems Consortium, Inc. ("ISC")
|
||||
- Copyright (C) 2000-2003 Internet Software Consortium.
|
||||
-
|
||||
- Permission to use, copy, modify, and/or distribute this software for any
|
||||
@ -32,7 +32,7 @@
|
||||
<div class="cmdsynopsis"><p><code class="command">dnssec-keygen</code> [<code class="option">-a <em class="replaceable"><code>algorithm</code></em></code>] [<code class="option">-b <em class="replaceable"><code>keysize</code></em></code>] [<code class="option">-n <em class="replaceable"><code>nametype</code></em></code>] [<code class="option">-3</code>] [<code class="option">-A <em class="replaceable"><code>date/offset</code></em></code>] [<code class="option">-C</code>] [<code class="option">-c <em class="replaceable"><code>class</code></em></code>] [<code class="option">-D <em class="replaceable"><code>date/offset</code></em></code>] [<code class="option">-E <em class="replaceable"><code>engine</code></em></code>] [<code class="option">-e</code>] [<code class="option">-f <em class="replaceable"><code>flag</code></em></code>] [<code class="option">-G</code>] [<code class="option">-g <em class="replaceable"><code>generator</code></em></code>] [<code class="option">-h</code>] [<code class="option">-I <em class="replaceable"><code>date/offset</code></em></code>] [<code class="option">-i <em class="replaceable"><code>interval</code></em></code>] [<code class="option">-K <em class="replaceable"><code>directory</code></em></code>] [<code class="option">-k</code>] [<code class="option">-P <em class="replaceable"><code>date/offset</code></em></code>] [<code class="option">-p <em class="replaceable"><code>protocol</code></em></code>] [<code class="option">-q</code>] [<code class="option">-R <em class="replaceable"><code>date/offset</code></em></code>] [<code class="option">-r <em class="replaceable"><code>randomdev</code></em></code>] [<code class="option">-S <em class="replaceable"><code>key</code></em></code>] [<code class="option">-s <em class="replaceable"><code>strength</code></em></code>] [<code class="option">-t <em class="replaceable"><code>type</code></em></code>] [<code class="option">-v <em class="replaceable"><code>level</code></em></code>] [<code class="option">-z</code>] {name}</p></div>
|
||||
</div>
|
||||
<div class="refsect1" lang="en">
|
||||
<a name="id2543579"></a><h2>DESCRIPTION</h2>
|
||||
<a name="id2543582"></a><h2>DESCRIPTION</h2>
|
||||
<p><span><strong class="command">dnssec-keygen</strong></span>
|
||||
generates keys for DNSSEC (Secure DNS), as defined in RFC 2535
|
||||
and RFC 4034. It can also generate keys for use with
|
||||
@ -46,14 +46,15 @@
|
||||
</p>
|
||||
</div>
|
||||
<div class="refsect1" lang="en">
|
||||
<a name="id2543597"></a><h2>OPTIONS</h2>
|
||||
<a name="id2543601"></a><h2>OPTIONS</h2>
|
||||
<div class="variablelist"><dl>
|
||||
<dt><span class="term">-a <em class="replaceable"><code>algorithm</code></em></span></dt>
|
||||
<dd>
|
||||
<p>
|
||||
Selects the cryptographic algorithm. For DNSSEC keys, the value
|
||||
of <code class="option">algorithm</code> must be one of RSAMD5, RSASHA1,
|
||||
DSA, NSEC3RSASHA1, NSEC3DSA, RSASHA256, RSASHA512 or ECCGOST.
|
||||
DSA, NSEC3RSASHA1, NSEC3DSA, RSASHA256, RSASHA512, ECCGOST,
|
||||
ECDSAP256SHA256 or ECDSAP384SHA384.
|
||||
For TSIG/TKEY, the value must
|
||||
be DH (Diffie Hellman), HMAC-MD5, HMAC-SHA1, HMAC-SHA224,
|
||||
HMAC-SHA256, HMAC-SHA384, or HMAC-SHA512. These values are
|
||||
@ -84,7 +85,8 @@
|
||||
between 512 and 2048 bits. Diffie Hellman keys must be between
|
||||
128 and 4096 bits. DSA keys must be between 512 and 1024
|
||||
bits and an exact multiple of 64. HMAC keys must be
|
||||
between 1 and 512 bits.
|
||||
between 1 and 512 bits. Elliptic curve algorithms don't need
|
||||
this parameter.
|
||||
</p>
|
||||
<p>
|
||||
The key size does not need to be specified if using a default
|
||||
@ -111,7 +113,8 @@
|
||||
Use an NSEC3-capable algorithm to generate a DNSSEC key.
|
||||
If this option is used and no algorithm is explicitly
|
||||
set on the command line, NSEC3RSASHA1 will be used by
|
||||
default. Note that RSASHA256, RSASHA512 and ECCGOST algorithms
|
||||
default. Note that RSASHA256, RSASHA512, ECCGOST,
|
||||
ECDSAP256SHA256 and ECDSAP384SHA384 algorithms
|
||||
are NSEC3-capable.
|
||||
</p></dd>
|
||||
<dt><span class="term">-C</span></dt>
|
||||
@ -248,7 +251,7 @@
|
||||
</dl></div>
|
||||
</div>
|
||||
<div class="refsect1" lang="en">
|
||||
<a name="id2544166"></a><h2>TIMING OPTIONS</h2>
|
||||
<a name="id2544169"></a><h2>TIMING OPTIONS</h2>
|
||||
<p>
|
||||
Dates can be expressed in the format YYYYMMDD or YYYYMMDDHHMMSS.
|
||||
If the argument begins with a '+' or '-', it is interpreted as
|
||||
@ -319,7 +322,7 @@
|
||||
</dl></div>
|
||||
</div>
|
||||
<div class="refsect1" lang="en">
|
||||
<a name="id2544356"></a><h2>GENERATED KEYS</h2>
|
||||
<a name="id2544359"></a><h2>GENERATED KEYS</h2>
|
||||
<p>
|
||||
When <span><strong class="command">dnssec-keygen</strong></span> completes
|
||||
successfully,
|
||||
@ -365,7 +368,7 @@
|
||||
</p>
|
||||
</div>
|
||||
<div class="refsect1" lang="en">
|
||||
<a name="id2544506"></a><h2>EXAMPLE</h2>
|
||||
<a name="id2544441"></a><h2>EXAMPLE</h2>
|
||||
<p>
|
||||
To generate a 768-bit DSA key for the domain
|
||||
<strong class="userinput"><code>example.com</code></strong>, the following command would be
|
||||
@ -386,7 +389,7 @@
|
||||
</p>
|
||||
</div>
|
||||
<div class="refsect1" lang="en">
|
||||
<a name="id2544550"></a><h2>SEE ALSO</h2>
|
||||
<a name="id2544485"></a><h2>SEE ALSO</h2>
|
||||
<p><span class="citerefentry"><span class="refentrytitle">dnssec-signzone</span>(8)</span>,
|
||||
<em class="citetitle">BIND 9 Administrator Reference Manual</em>,
|
||||
<em class="citetitle">RFC 2539</em>,
|
||||
@ -395,7 +398,7 @@
|
||||
</p>
|
||||
</div>
|
||||
<div class="refsect1" lang="en">
|
||||
<a name="id2544581"></a><h2>AUTHOR</h2>
|
||||
<a name="id2544584"></a><h2>AUTHOR</h2>
|
||||
<p><span class="corpauthor">Internet Systems Consortium</span>
|
||||
</p>
|
||||
</div>
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2009-2011 Internet Systems Consortium, Inc. ("ISC")
|
||||
* Copyright (C) 2009-2012 Internet Systems Consortium, Inc. ("ISC")
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
@ -38,6 +38,7 @@
|
||||
|
||||
#include <dns/keyvalues.h>
|
||||
#include <dns/result.h>
|
||||
#include <dns/log.h>
|
||||
|
||||
#include <dst/dst.h>
|
||||
|
||||
@ -151,6 +152,7 @@ main(int argc, char **argv) {
|
||||
isc_boolean_t force = ISC_FALSE;
|
||||
isc_boolean_t epoch = ISC_FALSE;
|
||||
isc_boolean_t changed = ISC_FALSE;
|
||||
isc_log_t *log = NULL;
|
||||
|
||||
if (argc == 1)
|
||||
usage();
|
||||
@ -159,6 +161,8 @@ main(int argc, char **argv) {
|
||||
if (result != ISC_R_SUCCESS)
|
||||
fatal("Out of memory");
|
||||
|
||||
setup_logging(verbose, mctx, &log);
|
||||
|
||||
dns_result_register();
|
||||
|
||||
isc_commandline_errprint = ISC_FALSE;
|
||||
@ -578,6 +582,7 @@ main(int argc, char **argv) {
|
||||
cleanup_entropy(&ectx);
|
||||
if (verbose > 10)
|
||||
isc_mem_stats(mctx, stdout);
|
||||
cleanup_logging(&log);
|
||||
isc_mem_free(mctx, directory);
|
||||
isc_mem_destroy(&mctx);
|
||||
|
||||
|
@ -3893,7 +3893,10 @@ main(int argc, char *argv[]) {
|
||||
check_result(result, "isc_file_mktemplate");
|
||||
|
||||
fp = NULL;
|
||||
result = isc_file_openunique(tempfile, &fp);
|
||||
if (outputformat == dns_masterformat_text)
|
||||
result = isc_file_openunique(tempfile, &fp);
|
||||
else
|
||||
result = isc_file_bopenunique(tempfile, &fp);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
fatal("failed to open temporary output file: %s",
|
||||
isc_result_totext(result));
|
||||
|
@ -1,4 +1,4 @@
|
||||
# Copyright (C) 2004-2011 Internet Systems Consortium, Inc. ("ISC")
|
||||
# Copyright (C) 2004-2012 Internet Systems Consortium, Inc. ("ISC")
|
||||
# Copyright (C) 1998-2002 Internet Software Consortium.
|
||||
#
|
||||
# Permission to use, copy, modify, and/or distribute this software for any
|
||||
|
@ -99,9 +99,9 @@ static size_t
|
||||
dns64_rdata(unsigned char *v, size_t start, unsigned char *rdata) {
|
||||
size_t i, j = 0;
|
||||
|
||||
for (i = 0; i < 4; i++) {
|
||||
for (i = 0; i < 4U; i++) {
|
||||
unsigned char c = v[start++];
|
||||
if (start == 7)
|
||||
if (start == 7U)
|
||||
start++;
|
||||
if (c > 99) {
|
||||
rdata[j++] = 3;
|
||||
@ -164,7 +164,7 @@ dns64_cname(const dns_name_t *zone, const dns_name_t *name,
|
||||
i = (nlen % 4) == 2U ? 1 : 0;
|
||||
j = nlen;
|
||||
memset(v, 0, sizeof(v));
|
||||
while (j != 0) {
|
||||
while (j != 0U) {
|
||||
INSIST((i/2) < sizeof(v));
|
||||
if (ndata[0] != 1)
|
||||
return (ISC_R_NOTFOUND);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2011 Internet Systems Consortium, Inc. ("ISC")
|
||||
* Copyright (C) 2004-2012 Internet Systems Consortium, Inc. ("ISC")
|
||||
* Copyright (C) 2001-2003 Internet Software Consortium.
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for any
|
||||
@ -89,7 +89,7 @@ options {\n\
|
||||
#endif
|
||||
"\
|
||||
recursive-clients 1000;\n\
|
||||
resolver-query-timeout 30;\n\
|
||||
resolver-query-timeout 10;\n\
|
||||
rrset-order {type NS order random; order cyclic; };\n\
|
||||
serial-queries 20;\n\
|
||||
serial-query-rate 20;\n\
|
||||
|
@ -373,8 +373,10 @@ control_recvmessage(isc_task_t *task, isc_event_t *event) {
|
||||
if (result == ISC_R_SUCCESS)
|
||||
break;
|
||||
isc_mem_put(listener->mctx, secret.rstart, REGION_SIZE(secret));
|
||||
log_invalid(&conn->ccmsg, result);
|
||||
goto cleanup;
|
||||
if (result != ISCCC_R_BADAUTH) {
|
||||
log_invalid(&conn->ccmsg, result);
|
||||
goto cleanup;
|
||||
}
|
||||
}
|
||||
|
||||
if (key == NULL) {
|
||||
|
@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env perl
|
||||
#
|
||||
# Copyright (C) 2006-2008 Internet Systems Consortium, Inc. ("ISC")
|
||||
# Copyright (C) 2006-2008, 2012 Internet Systems Consortium, Inc. ("ISC")
|
||||
#
|
||||
# Permission to use, copy, modify, and/or distribute this software for any
|
||||
# purpose with or without fee is hereby granted, provided that the above
|
||||
|
@ -25,6 +25,7 @@
|
||||
|
||||
#include <isc/hex.h>
|
||||
#include <isc/mem.h>
|
||||
#include <isc/serial.h>
|
||||
#include <isc/stats.h>
|
||||
#include <isc/util.h>
|
||||
|
||||
@ -2775,11 +2776,12 @@ query_add_cname(ns_client_t *client, dns_name_t *qname, dns_name_t *tname,
|
||||
*/
|
||||
static void
|
||||
mark_secure(ns_client_t *client, dns_db_t *db, dns_name_t *name,
|
||||
isc_uint32_t ttl, dns_rdataset_t *rdataset,
|
||||
dns_rdata_rrsig_t *rrsig, dns_rdataset_t *rdataset,
|
||||
dns_rdataset_t *sigrdataset)
|
||||
{
|
||||
isc_result_t result;
|
||||
dns_dbnode_t *node = NULL;
|
||||
isc_stdtime_t now;
|
||||
|
||||
rdataset->trust = dns_trust_secure;
|
||||
sigrdataset->trust = dns_trust_secure;
|
||||
@ -2790,17 +2792,10 @@ mark_secure(ns_client_t *client, dns_db_t *db, dns_name_t *name,
|
||||
result = dns_db_findnode(db, name, ISC_TRUE, &node);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
return;
|
||||
/*
|
||||
* Bound the validated ttls then minimise.
|
||||
*/
|
||||
if (sigrdataset->ttl > ttl)
|
||||
sigrdataset->ttl = ttl;
|
||||
if (rdataset->ttl > ttl)
|
||||
rdataset->ttl = ttl;
|
||||
if (rdataset->ttl > sigrdataset->ttl)
|
||||
rdataset->ttl = sigrdataset->ttl;
|
||||
else
|
||||
sigrdataset->ttl = rdataset->ttl;
|
||||
|
||||
isc_stdtime_get(&now);
|
||||
dns_rdataset_trimttl(rdataset, sigrdataset, rrsig, now,
|
||||
client->view->acceptexpired);
|
||||
|
||||
(void)dns_db_addrdataset(db, node, NULL, client->now, rdataset,
|
||||
0, NULL);
|
||||
@ -2925,8 +2920,7 @@ validate(ns_client_t *client, dns_db_t *db, dns_name_t *name,
|
||||
client->view->acceptexpired)) {
|
||||
dst_key_free(&key);
|
||||
dns_rdataset_disassociate(&keyrdataset);
|
||||
mark_secure(client, db, name,
|
||||
rrsig.originalttl,
|
||||
mark_secure(client, db, name, &rrsig,
|
||||
rdataset, sigrdataset);
|
||||
return (ISC_TRUE);
|
||||
}
|
||||
@ -3802,6 +3796,13 @@ rpz_clean(dns_zone_t **zonep, dns_db_t **dbp, dns_dbnode_t **nodep,
|
||||
dns_rdataset_disassociate(*rdatasetp);
|
||||
}
|
||||
|
||||
static void
|
||||
rpz_match_clear(dns_rpz_st_t *st)
|
||||
{
|
||||
rpz_clean(&st->m.zone, &st->m.db, &st->m.node, &st->m.rdataset);
|
||||
st->m.version = NULL;
|
||||
}
|
||||
|
||||
static inline isc_result_t
|
||||
rpz_ready(ns_client_t *client, dns_zone_t **zonep, dns_db_t **dbp,
|
||||
dns_dbnode_t **nodep, dns_rdataset_t **rdatasetp)
|
||||
@ -3821,10 +3822,9 @@ static void
|
||||
rpz_st_clear(ns_client_t *client) {
|
||||
dns_rpz_st_t *st = client->query.rpz_st;
|
||||
|
||||
rpz_clean(&st->m.zone, &st->m.db, &st->m.node, NULL);
|
||||
st->m.version = NULL;
|
||||
if (st->m.rdataset != NULL)
|
||||
query_putrdataset(client, &st->m.rdataset);
|
||||
rpz_match_clear(st);
|
||||
|
||||
rpz_clean(NULL, &st->r.db, NULL, NULL);
|
||||
if (st->r.ns_rdataset != NULL)
|
||||
@ -3974,6 +3974,9 @@ rpz_rewrite_ip(ns_client_t *client, dns_rdataset_t *rdataset,
|
||||
for (rpz = ISC_LIST_HEAD(client->view->rpz_zones);
|
||||
rpz != NULL;
|
||||
rpz = ISC_LIST_NEXT(rpz, link)) {
|
||||
if (!RECURSIONOK(client) && rpz->recursive_only)
|
||||
continue;
|
||||
|
||||
/*
|
||||
* Do not check policy zones that cannot replace a policy
|
||||
* already known to match.
|
||||
@ -4002,9 +4005,8 @@ rpz_rewrite_ip(ns_client_t *client, dns_rdataset_t *rdataset,
|
||||
* hit, if any. Note the domain name and quality of the
|
||||
* best hit.
|
||||
*/
|
||||
(void)dns_db_rpz_findips(rpz, rpz_type, zone, db, version,
|
||||
rdataset, st,
|
||||
client->query.rpz_st->qname);
|
||||
dns_db_rpz_findips(rpz, rpz_type, zone, db, version,
|
||||
rdataset, st, client->query.rpz_st->qname);
|
||||
rpz_clean(&zone, &db, NULL, NULL);
|
||||
}
|
||||
return (ISC_R_SUCCESS);
|
||||
@ -4109,8 +4111,8 @@ rpz_rewrite_rrsets(ns_client_t *client, dns_rpz_type_t rpz_type,
|
||||
*/
|
||||
static isc_result_t
|
||||
rpz_find(ns_client_t *client, dns_rdatatype_t qtype, dns_name_t *qnamef,
|
||||
dns_name_t *sname, dns_rpz_type_t rpz_type, dns_zone_t **zonep,
|
||||
dns_db_t **dbp, dns_dbversion_t **versionp,
|
||||
dns_name_t *sname, dns_rpz_zone_t *rpz, dns_rpz_type_t rpz_type,
|
||||
dns_zone_t **zonep, dns_db_t **dbp, dns_dbversion_t **versionp,
|
||||
dns_dbnode_t **nodep, dns_rdataset_t **rdatasetp,
|
||||
dns_rpz_policy_t *policyp)
|
||||
{
|
||||
@ -4149,7 +4151,7 @@ rpz_find(ns_client_t *client, dns_rdatatype_t qtype, dns_name_t *qnamef,
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
dns_db_detachnode(*dbp, nodep);
|
||||
rpz_log_fail(client, DNS_RPZ_ERROR_LEVEL, rpz_type,
|
||||
qnamef, "allrdatasets()", result);
|
||||
qnamef, "allrdatasets() ", result);
|
||||
*policyp = DNS_RPZ_POLICY_ERROR;
|
||||
return (DNS_R_SERVFAIL);
|
||||
}
|
||||
@ -4166,7 +4168,7 @@ rpz_find(ns_client_t *client, dns_rdatatype_t qtype, dns_name_t *qnamef,
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
if (result != ISC_R_NOMORE) {
|
||||
rpz_log_fail(client, DNS_RPZ_ERROR_LEVEL,
|
||||
rpz_type, qnamef, "rdatasetiter",
|
||||
rpz_type, qnamef, "rdatasetiter ",
|
||||
result);
|
||||
*policyp = DNS_RPZ_POLICY_ERROR;
|
||||
return (DNS_R_SERVFAIL);
|
||||
@ -4194,7 +4196,7 @@ rpz_find(ns_client_t *client, dns_rdatatype_t qtype, dns_name_t *qnamef,
|
||||
if ((*rdatasetp)->type != dns_rdatatype_cname) {
|
||||
policy = DNS_RPZ_POLICY_RECORD;
|
||||
} else {
|
||||
policy = dns_rpz_decode_cname(*rdatasetp, sname);
|
||||
policy = dns_rpz_decode_cname(rpz, *rdatasetp, sname);
|
||||
if ((policy == DNS_RPZ_POLICY_RECORD ||
|
||||
policy == DNS_RPZ_POLICY_WILDCNAME) &&
|
||||
qtype != dns_rdatatype_cname &&
|
||||
@ -4265,6 +4267,9 @@ rpz_rewrite_name(ns_client_t *client, dns_rdatatype_t qtype, dns_name_t *qname,
|
||||
for (rpz = ISC_LIST_HEAD(client->view->rpz_zones);
|
||||
rpz != NULL;
|
||||
rpz = ISC_LIST_NEXT(rpz, link)) {
|
||||
if (!RECURSIONOK(client) && rpz->recursive_only)
|
||||
continue;
|
||||
|
||||
/*
|
||||
* Do not check policy zones that cannot replace a policy
|
||||
* already known to match.
|
||||
@ -4310,11 +4315,11 @@ rpz_rewrite_name(ns_client_t *client, dns_rdatatype_t qtype, dns_name_t *qname,
|
||||
}
|
||||
|
||||
/*
|
||||
* See if the policy record exists.
|
||||
* See if the policy record exists and get its policy.
|
||||
*/
|
||||
result = rpz_find(client, qtype, rpz_qname, qname, rpz_type,
|
||||
&zone, &db, &version, &node, rdatasetp,
|
||||
&policy);
|
||||
result = rpz_find(client, qtype, rpz_qname, qname, rpz,
|
||||
rpz_type, &zone, &db, &version, &node,
|
||||
rdatasetp, &policy);
|
||||
switch (result) {
|
||||
case DNS_R_NXDOMAIN:
|
||||
case DNS_R_EMPTYNAME:
|
||||
@ -4350,8 +4355,7 @@ rpz_rewrite_name(ns_client_t *client, dns_rdatatype_t qtype, dns_name_t *qname,
|
||||
continue;
|
||||
}
|
||||
|
||||
rpz_clean(&st->m.zone, &st->m.db, &st->m.node,
|
||||
&st->m.rdataset);
|
||||
rpz_match_clear(st);
|
||||
st->m.rpz = rpz;
|
||||
st->m.type = rpz_type;
|
||||
st->m.prefix = 0;
|
||||
@ -4365,9 +4369,11 @@ rpz_rewrite_name(ns_client_t *client, dns_rdatatype_t qtype, dns_name_t *qname,
|
||||
trdataset = st->m.rdataset;
|
||||
st->m.rdataset = *rdatasetp;
|
||||
*rdatasetp = trdataset;
|
||||
st->m.ttl = st->m.rdataset->ttl;
|
||||
st->m.ttl = ISC_MIN(st->m.rdataset->ttl,
|
||||
rpz->max_policy_ttl);
|
||||
} else {
|
||||
st->m.ttl = DNS_RPZ_TTL_DEFAULT;
|
||||
st->m.ttl = ISC_MIN(DNS_RPZ_TTL_DEFAULT,
|
||||
rpz->max_policy_ttl);
|
||||
}
|
||||
st->m.node = node;
|
||||
node = NULL;
|
||||
@ -4462,13 +4468,13 @@ rpz_rewrite(ns_client_t *client, dns_rdatatype_t qtype, isc_result_t qresult,
|
||||
case DNS_R_BROKENCHAIN:
|
||||
rpz_log_fail(client, DNS_RPZ_DEBUG_LEVEL3, DNS_RPZ_TYPE_QNAME,
|
||||
client->query.qname,
|
||||
"stop on qresult in rpz_rewrite()",
|
||||
"stop on qresult in rpz_rewrite() ",
|
||||
qresult);
|
||||
return (ISC_R_SUCCESS);
|
||||
default:
|
||||
rpz_log_fail(client, DNS_RPZ_DEBUG_LEVEL1, DNS_RPZ_TYPE_QNAME,
|
||||
client->query.qname,
|
||||
"stop on unrecognized qresult in rpz_rewrite()",
|
||||
"stop on unrecognized qresult in rpz_rewrite() ",
|
||||
qresult);
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
@ -4647,10 +4653,11 @@ cleanup:
|
||||
if (st->m.policy == DNS_RPZ_POLICY_MISS ||
|
||||
st->m.policy == DNS_RPZ_POLICY_PASSTHRU ||
|
||||
st->m.policy == DNS_RPZ_POLICY_ERROR) {
|
||||
if (st->m.policy == DNS_RPZ_POLICY_PASSTHRU)
|
||||
if (st->m.policy == DNS_RPZ_POLICY_PASSTHRU &&
|
||||
result != DNS_R_DELEGATION)
|
||||
rpz_log_rewrite(client, "", st->m.policy, st->m.type,
|
||||
st->qname);
|
||||
rpz_clean(&st->m.zone, &st->m.db, &st->m.node, &st->m.rdataset);
|
||||
rpz_match_clear(st);
|
||||
}
|
||||
if (st->m.policy == DNS_RPZ_POLICY_ERROR) {
|
||||
st->m.type = DNS_RPZ_TYPE_BAD;
|
||||
@ -4663,6 +4670,64 @@ cleanup:
|
||||
return (result);
|
||||
}
|
||||
|
||||
/*
|
||||
* See if response policy zone rewriting is allowed a lack of interest
|
||||
* by the client in DNSSEC or a lack of signatures.
|
||||
*/
|
||||
static isc_boolean_t
|
||||
rpz_ck_dnssec(ns_client_t *client, isc_result_t result,
|
||||
dns_rdataset_t *rdataset, dns_rdataset_t *sigrdataset)
|
||||
{
|
||||
dns_fixedname_t fixed;
|
||||
dns_name_t *found;
|
||||
dns_rdataset_t trdataset;
|
||||
dns_rdatatype_t type;
|
||||
|
||||
if (client->view->rpz_break_dnssec)
|
||||
return (ISC_TRUE);
|
||||
/*
|
||||
* sigrdataset == NULL if and only !WANTDNSSEC(client)
|
||||
*/
|
||||
if (sigrdataset == NULL)
|
||||
return (ISC_TRUE);
|
||||
if (dns_rdataset_isassociated(sigrdataset))
|
||||
return (ISC_FALSE);
|
||||
|
||||
/*
|
||||
* We are happy to rewrite nothing.
|
||||
*/
|
||||
if (rdataset == NULL || !dns_rdataset_isassociated(rdataset))
|
||||
return (ISC_TRUE);
|
||||
/*
|
||||
* Do not rewrite if there is any sign of signatures.
|
||||
*/
|
||||
if (rdataset->type == dns_rdatatype_nsec ||
|
||||
rdataset->type == dns_rdatatype_nsec3 ||
|
||||
rdataset->type == dns_rdatatype_rrsig)
|
||||
return (ISC_FALSE);
|
||||
|
||||
/*
|
||||
* Look for a signature in a negative cache rdataset.
|
||||
*/
|
||||
if ((rdataset->attributes & DNS_RDATASETATTR_NEGATIVE) == 0)
|
||||
return (ISC_TRUE);
|
||||
dns_fixedname_init(&fixed);
|
||||
found = dns_fixedname_name(&fixed);
|
||||
dns_rdataset_init(&trdataset);
|
||||
for (result = dns_rdataset_first(rdataset);
|
||||
result == ISC_R_SUCCESS;
|
||||
result = dns_rdataset_next(rdataset)) {
|
||||
dns_ncache_current(rdataset, found, &trdataset);
|
||||
type = trdataset.type;
|
||||
dns_rdataset_disassociate(&trdataset);
|
||||
if (type == dns_rdatatype_nsec ||
|
||||
type == dns_rdatatype_nsec3 ||
|
||||
type == dns_rdatatype_rrsig)
|
||||
return (ISC_FALSE);
|
||||
}
|
||||
return (ISC_TRUE);
|
||||
}
|
||||
|
||||
/*
|
||||
* Add a CNAME to the query response, including translating foo.evil.com and
|
||||
* *.evil.com CNAME *.example.com
|
||||
@ -4707,7 +4772,8 @@ rpz_add_cname(ns_client_t *client, dns_rpz_st_t *st,
|
||||
* Turn off DNSSEC because the results of a
|
||||
* response policy zone cannot verify.
|
||||
*/
|
||||
client->attributes &= ~NS_CLIENTATTR_WANTDNSSEC;
|
||||
client->attributes &= ~(NS_CLIENTATTR_WANTDNSSEC |
|
||||
DNS_MESSAGEFLAG_AD);
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
@ -5117,10 +5183,12 @@ dns64_ttl(dns_db_t *db, dns_dbversion_t *version) {
|
||||
isc_result_t result;
|
||||
isc_uint32_t ttl = ISC_UINT32_MAX;
|
||||
|
||||
dns_rdataset_init(&rdataset);
|
||||
|
||||
result = dns_db_getoriginnode(db, &node);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
goto cleanup;
|
||||
dns_rdataset_init(&rdataset);
|
||||
|
||||
result = dns_db_findrdataset(db, node, version, dns_rdatatype_soa,
|
||||
0, 0, &rdataset, NULL);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
@ -5502,9 +5570,9 @@ query_find(ns_client_t *client, dns_fetchevent_t *event, dns_rdatatype_t qtype)
|
||||
CTRACE("query_find: resume");
|
||||
|
||||
if (!ISC_LIST_EMPTY(client->view->rpz_zones) &&
|
||||
RECURSIONOK(client) && !RECURSING(client) &&
|
||||
(!WANTDNSSEC(client) || sigrdataset == NULL ||
|
||||
!dns_rdataset_isassociated(sigrdataset)) &&
|
||||
(RECURSIONOK(client) || !client->view->rpz_recursive_only) &&
|
||||
rpz_ck_dnssec(client, result, rdataset, sigrdataset) &&
|
||||
!RECURSING(client) &&
|
||||
(client->query.rpz_st == NULL ||
|
||||
(client->query.rpz_st->state & DNS_RPZ_REWRITTEN) == 0) &&
|
||||
!dns_name_equal(client->query.qname, dns_rootname)) {
|
||||
@ -5578,10 +5646,22 @@ query_find(ns_client_t *client, dns_fetchevent_t *event, dns_rdatatype_t qtype)
|
||||
break;
|
||||
case DNS_RPZ_POLICY_RECORD:
|
||||
result = rpz_st->m.result;
|
||||
if (type == dns_rdatatype_any &&
|
||||
result != DNS_R_CNAME &&
|
||||
dns_rdataset_isassociated(rdataset))
|
||||
dns_rdataset_disassociate(rdataset);
|
||||
if (qtype == dns_rdatatype_any &&
|
||||
result != DNS_R_CNAME) {
|
||||
/*
|
||||
* We will add all of the rdatasets of
|
||||
* the node by iterating, setting the
|
||||
* TTL then.
|
||||
*/
|
||||
if (dns_rdataset_isassociated(rdataset))
|
||||
dns_rdataset_disassociate(rdataset);
|
||||
} else {
|
||||
/*
|
||||
* We will add this rdataset.
|
||||
*/
|
||||
rdataset->ttl = ISC_MIN(rdataset->ttl,
|
||||
rpz_st->m.ttl);
|
||||
}
|
||||
break;
|
||||
case DNS_RPZ_POLICY_WILDCNAME:
|
||||
result = dns_rdataset_first(rdataset);
|
||||
@ -5620,7 +5700,8 @@ query_find(ns_client_t *client, dns_fetchevent_t *event, dns_rdatatype_t qtype)
|
||||
* Turn off DNSSEC because the results of a
|
||||
* response policy zone cannot verify.
|
||||
*/
|
||||
client->attributes &= ~NS_CLIENTATTR_WANTDNSSEC;
|
||||
client->attributes &= ~(NS_CLIENTATTR_WANTDNSSEC |
|
||||
DNS_MESSAGEFLAG_AD);
|
||||
query_putrdataset(client, &sigrdataset);
|
||||
is_zone = ISC_TRUE;
|
||||
rpz_log_rewrite(client, "", rpz_st->m.policy,
|
||||
@ -6560,6 +6641,10 @@ query_find(ns_client_t *client, dns_fetchevent_t *event, dns_rdatatype_t qtype)
|
||||
noqname = rdataset;
|
||||
else
|
||||
noqname = NULL;
|
||||
rpz_st = client->query.rpz_st;
|
||||
if (rpz_st != NULL)
|
||||
rdataset->ttl = ISC_MIN(rdataset->ttl,
|
||||
rpz_st->m.ttl);
|
||||
query_addrrset(client,
|
||||
fname != NULL ? &fname : &tname,
|
||||
&rdataset, NULL,
|
||||
@ -6852,8 +6937,7 @@ query_find(ns_client_t *client, dns_fetchevent_t *event, dns_rdatatype_t qtype)
|
||||
*/
|
||||
rpz_st = client->query.rpz_st;
|
||||
if (rpz_st != NULL && (rpz_st->state & DNS_RPZ_RECURSING) == 0) {
|
||||
rpz_clean(&rpz_st->m.zone, &rpz_st->m.db, &rpz_st->m.node,
|
||||
&rpz_st->m.rdataset);
|
||||
rpz_match_clear(rpz_st);
|
||||
rpz_st->state &= ~DNS_RPZ_DONE_QNAME;
|
||||
}
|
||||
if (rdataset != NULL)
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user