Merge from head@274682
This commit is contained in:
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"project.name": "S",
|
"project.name": "S",
|
||||||
"phabricator.uri" : "https://phabric.freebsd.org/",
|
"phabricator.uri" : "https://reviews.freebsd.org/",
|
||||||
"history.immutable" : true
|
"history.immutable" : true
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-3
@@ -20,7 +20,7 @@ It is not a registry of 'turf' or private property.
|
|||||||
|
|
||||||
subsystem login notes
|
subsystem login notes
|
||||||
-----------------------------
|
-----------------------------
|
||||||
kqueue jmg Pre-commit review requested.
|
kqueue jmg Pre-commit review requested. Documentation Required.
|
||||||
libc/posix1e rwatson Pre-commit review requested.
|
libc/posix1e rwatson Pre-commit review requested.
|
||||||
POSIX.1e ACLs rwatson Pre-commit review requested.
|
POSIX.1e ACLs rwatson Pre-commit review requested.
|
||||||
UFS EAs rwatson Pre-commit review requested.
|
UFS EAs rwatson Pre-commit review requested.
|
||||||
@@ -48,7 +48,6 @@ cd(4) ken Pre-commit review requested.
|
|||||||
pass(4) ken Pre-commit review requested.
|
pass(4) ken Pre-commit review requested.
|
||||||
ch(4) ken Pre-commit review requested.
|
ch(4) ken Pre-commit review requested.
|
||||||
em(4) jfv Pre-commit review requested.
|
em(4) jfv Pre-commit review requested.
|
||||||
bxe(4) davidch Pre-commit review requested.
|
|
||||||
tdfx(4) cokane Just keep me informed of changes, try not to break it.
|
tdfx(4) cokane Just keep me informed of changes, try not to break it.
|
||||||
sendmail gshapiro Pre-commit review requested.
|
sendmail gshapiro Pre-commit review requested.
|
||||||
etc/mail gshapiro Pre-commit review requested.
|
etc/mail gshapiro Pre-commit review requested.
|
||||||
@@ -78,10 +77,11 @@ inetd dwmalone Recommends pre-commit review.
|
|||||||
contrib/smbfs bp Open for in-tree committs. In case of functional
|
contrib/smbfs bp Open for in-tree committs. In case of functional
|
||||||
changes pre-commit review requested.
|
changes pre-commit review requested.
|
||||||
contrib/pf glebius Pre-commit review recommended.
|
contrib/pf glebius Pre-commit review recommended.
|
||||||
binutils obrien Insists on BU blocked from unapproved commits
|
|
||||||
file obrien Insists to keep file blocked from other's unapproved
|
file obrien Insists to keep file blocked from other's unapproved
|
||||||
commits
|
commits
|
||||||
contrib/bzip2 obrien Pre-commit review required.
|
contrib/bzip2 obrien Pre-commit review required.
|
||||||
|
contrib/netbsd-tests freebsd-testing,ngie Pre-commit review requested.
|
||||||
|
contrib/pjdfstest freebsd-testing,ngie Pre-commit review requested.
|
||||||
geom_concat pjd Pre-commit review preferred.
|
geom_concat pjd Pre-commit review preferred.
|
||||||
geom_eli pjd Pre-commit review preferred.
|
geom_eli pjd Pre-commit review preferred.
|
||||||
geom_gate pjd Pre-commit review preferred.
|
geom_gate pjd Pre-commit review preferred.
|
||||||
@@ -132,3 +132,4 @@ release/release.sh gjb Pre-commit review and regression tests
|
|||||||
requested.
|
requested.
|
||||||
nanobsd imp Pre-commit review requested for coordination.
|
nanobsd imp Pre-commit review requested for coordination.
|
||||||
vmm(4) neel,grehan Pre-commit review requested.
|
vmm(4) neel,grehan Pre-commit review requested.
|
||||||
|
opencrypto jmg Pre-commit review requested. Documentation Required.
|
||||||
|
|||||||
@@ -37,6 +37,8 @@
|
|||||||
# xdev-build - Build cross-development tools.
|
# xdev-build - Build cross-development tools.
|
||||||
# xdev-install - Install cross-development tools.
|
# xdev-install - Install cross-development tools.
|
||||||
# xdev-links - Create traditional links in /usr/bin for cc, etc
|
# xdev-links - Create traditional links in /usr/bin for cc, etc
|
||||||
|
# native-xtools - Create host binaries that produce target objects
|
||||||
|
# for use in qemu user-mode jails.
|
||||||
#
|
#
|
||||||
# "quick" way to test all kernel builds:
|
# "quick" way to test all kernel builds:
|
||||||
# _jflag=`sysctl -n hw.ncpu`
|
# _jflag=`sysctl -n hw.ncpu`
|
||||||
@@ -111,7 +113,7 @@ TGTS= all all-man buildenv buildenvvars buildkernel buildworld \
|
|||||||
_worldtmp _legacy _bootstrap-tools _cleanobj _obj \
|
_worldtmp _legacy _bootstrap-tools _cleanobj _obj \
|
||||||
_build-tools _cross-tools _includes _libraries _depend \
|
_build-tools _cross-tools _includes _libraries _depend \
|
||||||
build32 builddtb distribute32 install32 xdev xdev-build xdev-install \
|
build32 builddtb distribute32 install32 xdev xdev-build xdev-install \
|
||||||
xdev-links \
|
xdev-links native-xtools \
|
||||||
|
|
||||||
TGTS+= ${SUBDIR_TARGETS}
|
TGTS+= ${SUBDIR_TARGETS}
|
||||||
|
|
||||||
|
|||||||
+148
-39
@@ -246,7 +246,7 @@ BMAKE= MAKEOBJDIRPREFIX=${WORLDTMP} \
|
|||||||
${BMAKEENV} ${MAKE} ${WORLD_FLAGS} -f Makefile.inc1 \
|
${BMAKEENV} ${MAKE} ${WORLD_FLAGS} -f Makefile.inc1 \
|
||||||
DESTDIR= \
|
DESTDIR= \
|
||||||
BOOTSTRAPPING=${OSRELDATE} \
|
BOOTSTRAPPING=${OSRELDATE} \
|
||||||
SSP_CFLAGS= MK_PIE=no \
|
SSP_CFLAGS= \
|
||||||
MK_HTML=no MK_INFO=no NO_LINT=yes MK_MAN=no \
|
MK_HTML=no MK_INFO=no NO_LINT=yes MK_MAN=no \
|
||||||
-DNO_PIC MK_PROFILE=no -DNO_SHARED \
|
-DNO_PIC MK_PROFILE=no -DNO_SHARED \
|
||||||
-DNO_CPU_CFLAGS MK_WARNS=no MK_CTF=no \
|
-DNO_CPU_CFLAGS MK_WARNS=no MK_CTF=no \
|
||||||
@@ -258,7 +258,7 @@ TMAKE= MAKEOBJDIRPREFIX=${OBJTREE} \
|
|||||||
TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \
|
TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \
|
||||||
DESTDIR= \
|
DESTDIR= \
|
||||||
BOOTSTRAPPING=${OSRELDATE} \
|
BOOTSTRAPPING=${OSRELDATE} \
|
||||||
SSP_CFLAGS= MK_PIE=no \
|
SSP_CFLAGS= \
|
||||||
-DNO_LINT \
|
-DNO_LINT \
|
||||||
-DNO_CPU_CFLAGS MK_WARNS=no MK_CTF=no MK_CLANG_FULL=no MK_LLDB=no MK_TESTS=no
|
-DNO_CPU_CFLAGS MK_WARNS=no MK_CTF=no MK_CLANG_FULL=no MK_LLDB=no MK_TESTS=no
|
||||||
|
|
||||||
@@ -276,7 +276,7 @@ KTMAKE= TOOLS_PREFIX=${WORLDTMP} MAKEOBJDIRPREFIX=${WORLDTMP} \
|
|||||||
${KTMAKEENV} ${MAKE} ${WORLD_FLAGS} -f Makefile.inc1 \
|
${KTMAKEENV} ${MAKE} ${WORLD_FLAGS} -f Makefile.inc1 \
|
||||||
DESTDIR= \
|
DESTDIR= \
|
||||||
BOOTSTRAPPING=${OSRELDATE} \
|
BOOTSTRAPPING=${OSRELDATE} \
|
||||||
SSP_CFLAGS= MK_PIE=no \
|
SSP_CFLAGS= \
|
||||||
MK_HTML=no MK_INFO=no -DNO_LINT MK_MAN=no \
|
MK_HTML=no MK_INFO=no -DNO_LINT MK_MAN=no \
|
||||||
-DNO_PIC MK_PROFILE=no -DNO_SHARED \
|
-DNO_PIC MK_PROFILE=no -DNO_SHARED \
|
||||||
-DNO_CPU_CFLAGS MK_WARNS=no MK_CTF=no
|
-DNO_CPU_CFLAGS MK_WARNS=no MK_CTF=no
|
||||||
@@ -299,6 +299,10 @@ HMAKE+= PATH=${TMPPATH} METALOG=${METALOG} -DNO_ROOT
|
|||||||
WMAKEENV+= MK_CTF=no
|
WMAKEENV+= MK_CTF=no
|
||||||
.endif
|
.endif
|
||||||
|
|
||||||
|
.if defined(CROSS_TOOLCHAIN)
|
||||||
|
LOCALBASE?= /usr/local
|
||||||
|
.include "${LOCALBASE}/share/toolchains/${CROSS_TOOLCHAIN}.mk"
|
||||||
|
.endif
|
||||||
.if defined(CROSS_TOOLCHAIN_PREFIX)
|
.if defined(CROSS_TOOLCHAIN_PREFIX)
|
||||||
CROSS_COMPILER_PREFIX?=${CROSS_TOOLCHAIN_PREFIX}
|
CROSS_COMPILER_PREFIX?=${CROSS_TOOLCHAIN_PREFIX}
|
||||||
CROSS_BINUTILS_PREFIX?=${CROSS_TOOLCHAIN_PREFIX}
|
CROSS_BINUTILS_PREFIX?=${CROSS_TOOLCHAIN_PREFIX}
|
||||||
@@ -311,7 +315,7 @@ X${COMPILER}?= ${CROSS_COMPILER_PREFIX}${${COMPILER}}
|
|||||||
X${COMPILER}?= ${${COMPILER}}
|
X${COMPILER}?= ${${COMPILER}}
|
||||||
.endif
|
.endif
|
||||||
.endfor
|
.endfor
|
||||||
XBINUTILS= AS AR LD NM OBJDUMP RANLIB STRINGS
|
XBINUTILS= AS AR LD NM OBJCOPY OBJDUMP RANLIB SIZE STRINGS
|
||||||
.for BINUTIL in ${XBINUTILS}
|
.for BINUTIL in ${XBINUTILS}
|
||||||
.if defined(CROSS_BINUTILS_PREFIX)
|
.if defined(CROSS_BINUTILS_PREFIX)
|
||||||
X${BINUTIL}?= ${CROSS_BINUTILS_PREFIX}${${BINUTIL}}
|
X${BINUTIL}?= ${CROSS_BINUTILS_PREFIX}${${BINUTIL}}
|
||||||
@@ -319,10 +323,13 @@ X${BINUTIL}?= ${CROSS_BINUTILS_PREFIX}${${BINUTIL}}
|
|||||||
X${BINUTIL}?= ${${BINUTIL}}
|
X${BINUTIL}?= ${${BINUTIL}}
|
||||||
.endif
|
.endif
|
||||||
.endfor
|
.endfor
|
||||||
WMAKEENV+= CC="${XCC} ${XFLAGS}" CXX="${XCXX} ${XFLAGS}" \
|
WMAKEENV+= CC="${XCC} ${XCFLAGS}" CXX="${XCXX} ${XCFLAGS} ${XCXXFLAGS}" \
|
||||||
CPP="${XCPP} ${XFLAGS}" \
|
DEPFLAGS="${DEPFLAGS}" \
|
||||||
|
CPP="${XCPP} ${XCFLAGS}" \
|
||||||
AS="${XAS}" AR="${XAR}" LD="${XLD}" NM=${XNM} \
|
AS="${XAS}" AR="${XAR}" LD="${XLD}" NM=${XNM} \
|
||||||
OBJDUMP=${XOBJDUMP} RANLIB=${XRANLIB} STRINGS=${XSTRINGS}
|
OBJDUMP=${XOBJDUMP} OBJCOPY="${XOBJCOPY}" \
|
||||||
|
RANLIB=${XRANLIB} STRINGS=${XSTRINGS} \
|
||||||
|
SIZE="${XSIZE}"
|
||||||
|
|
||||||
.if ${XCC:M/*}
|
.if ${XCC:M/*}
|
||||||
XFLAGS= --sysroot=${WORLDTMP}
|
XFLAGS= --sysroot=${WORLDTMP}
|
||||||
@@ -336,22 +343,29 @@ XFLAGS+= -B${CROSS_BINUTILS_PREFIX}
|
|||||||
.else
|
.else
|
||||||
XFLAGS+= -B${WORLDTMP}/usr/bin
|
XFLAGS+= -B${WORLDTMP}/usr/bin
|
||||||
.endif
|
.endif
|
||||||
.if ${TARGET} == "arm" && ${MK_ARM_EABI} != "no"
|
.if ${TARGET} == "arm"
|
||||||
.if ${TARGET_ARCH:M*eb*} == ""
|
.if ${TARGET_ARCH:M*hf*} != ""
|
||||||
TARGET_ABI= gnueabi
|
|
||||||
.elif ${TARGET_ARCH} == "armv6hf"
|
|
||||||
TARGET_ABI= gnueabihf
|
TARGET_ABI= gnueabihf
|
||||||
|
.else
|
||||||
|
TARGET_ABI= gnueabi
|
||||||
.endif
|
.endif
|
||||||
.endif
|
.endif
|
||||||
|
.if defined(X_COMPILER_TYPE) && ${X_COMPILER_TYPE} == gcc
|
||||||
|
XCFLAGS+= -isystem ${WORLDTMP}/usr/include -L${WORLDTMP}/usr/lib
|
||||||
|
XCXXFLAGS+= -I${WORLDTMP}/usr/include/c++/v1 -std=gnu++11 -L${WORLDTMP}/../lib/libc++
|
||||||
|
DEPFLAGS+= -I${WORLDTMP}/usr/include/c++/v1
|
||||||
|
.else
|
||||||
TARGET_ABI?= unknown
|
TARGET_ABI?= unknown
|
||||||
TARGET_TRIPLE?= ${TARGET_ARCH:C/amd64/x86_64/}-${TARGET_ABI}-freebsd11.0
|
TARGET_TRIPLE?= ${TARGET_ARCH:C/amd64/x86_64/}-${TARGET_ABI}-freebsd11.0
|
||||||
XFLAGS+= -target ${TARGET_TRIPLE}
|
XCFLAGS+= -target ${TARGET_TRIPLE}
|
||||||
|
.endif
|
||||||
.endif
|
.endif
|
||||||
|
|
||||||
WMAKE= ${WMAKEENV} ${MAKE} ${WORLD_FLAGS} -f Makefile.inc1 DESTDIR=${WORLDTMP}
|
WMAKE= ${WMAKEENV} ${MAKE} ${WORLD_FLAGS} -f Makefile.inc1 DESTDIR=${WORLDTMP}
|
||||||
|
|
||||||
.if ${TARGET_ARCH} == "amd64" || ${TARGET_ARCH} == "powerpc64"
|
.if ${TARGET_ARCH} == "amd64" || ${TARGET_ARCH} == "powerpc64"
|
||||||
# 32 bit world
|
# 32 bit world
|
||||||
|
LIB32_OBJTREE= ${OBJTREE}${.CURDIR}/world32
|
||||||
LIB32TMP= ${OBJTREE}${.CURDIR}/lib32
|
LIB32TMP= ${OBJTREE}${.CURDIR}/lib32
|
||||||
|
|
||||||
.if ${TARGET_ARCH} == "amd64"
|
.if ${TARGET_ARCH} == "amd64"
|
||||||
@@ -387,7 +401,7 @@ LIB32FLAGS+= --sysroot=${WORLDTMP}
|
|||||||
.endif
|
.endif
|
||||||
|
|
||||||
# Yes, the flags are redundant.
|
# Yes, the flags are redundant.
|
||||||
LIB32WMAKEENV+= MAKEOBJDIRPREFIX=${OBJTREE}/lib32 \
|
LIB32WMAKEENV+= MAKEOBJDIRPREFIX=${LIB32_OBJTREE} \
|
||||||
_SHLIBDIRPREFIX=${LIB32TMP} \
|
_SHLIBDIRPREFIX=${LIB32TMP} \
|
||||||
_LDSCRIPTROOT=${LIB32TMP} \
|
_LDSCRIPTROOT=${LIB32TMP} \
|
||||||
VERSION="${VERSION}" \
|
VERSION="${VERSION}" \
|
||||||
@@ -395,7 +409,8 @@ LIB32WMAKEENV+= MAKEOBJDIRPREFIX=${OBJTREE}/lib32 \
|
|||||||
PATH=${TMPPATH} \
|
PATH=${TMPPATH} \
|
||||||
LIBDIR=/usr/lib32 \
|
LIBDIR=/usr/lib32 \
|
||||||
SHLIBDIR=/usr/lib32 \
|
SHLIBDIR=/usr/lib32 \
|
||||||
LIBPRIVATEDIR=/usr/lib32/private
|
LIBPRIVATEDIR=/usr/lib32/private \
|
||||||
|
DTRACE="${DTRACE} -32"
|
||||||
LIB32WMAKEFLAGS+= CC="${XCC} ${LIB32FLAGS}" \
|
LIB32WMAKEFLAGS+= CC="${XCC} ${LIB32FLAGS}" \
|
||||||
CXX="${XCXX} ${LIB32FLAGS}" \
|
CXX="${XCXX} ${LIB32FLAGS}" \
|
||||||
DESTDIR=${LIB32TMP} \
|
DESTDIR=${LIB32TMP} \
|
||||||
@@ -559,7 +574,7 @@ _libraries:
|
|||||||
@echo "--------------------------------------------------------------"
|
@echo "--------------------------------------------------------------"
|
||||||
${_+_}cd ${.CURDIR}; \
|
${_+_}cd ${.CURDIR}; \
|
||||||
${WMAKE} -DNO_FSCHG MK_HTML=no MK_INFO=no -DNO_LINT MK_MAN=no \
|
${WMAKE} -DNO_FSCHG MK_HTML=no MK_INFO=no -DNO_LINT MK_MAN=no \
|
||||||
MK_PROFILE=no MK_TESTS=no libraries
|
MK_PROFILE=no MK_TESTS=no MK_TESTS_SUPPORT=${MK_TESTS} libraries
|
||||||
_depend:
|
_depend:
|
||||||
@echo
|
@echo
|
||||||
@echo "--------------------------------------------------------------"
|
@echo "--------------------------------------------------------------"
|
||||||
@@ -610,7 +625,7 @@ build32:
|
|||||||
cd ${.CURDIR}/${_dir}; \
|
cd ${.CURDIR}/${_dir}; \
|
||||||
WORLDTMP=${WORLDTMP} \
|
WORLDTMP=${WORLDTMP} \
|
||||||
MAKEFLAGS="-m ${.CURDIR}/tools/build/mk ${.MAKEFLAGS}" \
|
MAKEFLAGS="-m ${.CURDIR}/tools/build/mk ${.MAKEFLAGS}" \
|
||||||
MAKEOBJDIRPREFIX=${OBJTREE}/lib32 ${MAKE} SSP_CFLAGS= DESTDIR= \
|
MAKEOBJDIRPREFIX=${LIB32_OBJTREE} ${MAKE} SSP_CFLAGS= DESTDIR= \
|
||||||
DIRPRFX=${_dir}/ -DNO_LINT -DNO_CPU_CFLAGS MK_WARNS=no MK_CTF=no \
|
DIRPRFX=${_dir}/ -DNO_LINT -DNO_CPU_CFLAGS MK_WARNS=no MK_CTF=no \
|
||||||
build-tools
|
build-tools
|
||||||
.endfor
|
.endfor
|
||||||
@@ -909,7 +924,7 @@ packageworld:
|
|||||||
# and do a 'make reinstall' on the *client* to install new binaries from the
|
# and do a 'make reinstall' on the *client* to install new binaries from the
|
||||||
# most recent server build.
|
# most recent server build.
|
||||||
#
|
#
|
||||||
reinstall:
|
reinstall: .MAKE
|
||||||
@echo "--------------------------------------------------------------"
|
@echo "--------------------------------------------------------------"
|
||||||
@echo ">>> Making hierarchy"
|
@echo ">>> Making hierarchy"
|
||||||
@echo "--------------------------------------------------------------"
|
@echo "--------------------------------------------------------------"
|
||||||
@@ -924,7 +939,7 @@ reinstall:
|
|||||||
${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install32
|
${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install32
|
||||||
.endif
|
.endif
|
||||||
|
|
||||||
redistribute:
|
redistribute: .MAKE
|
||||||
@echo "--------------------------------------------------------------"
|
@echo "--------------------------------------------------------------"
|
||||||
@echo ">>> Distributing everything"
|
@echo ">>> Distributing everything"
|
||||||
@echo "--------------------------------------------------------------"
|
@echo "--------------------------------------------------------------"
|
||||||
@@ -934,7 +949,7 @@ redistribute:
|
|||||||
DISTRIBUTION=lib32
|
DISTRIBUTION=lib32
|
||||||
.endif
|
.endif
|
||||||
|
|
||||||
distrib-dirs distribution:
|
distrib-dirs distribution: .MAKE
|
||||||
cd ${.CURDIR}/etc; ${CROSSENV} PATH=${TMPPATH} ${MAKE} \
|
cd ${.CURDIR}/etc; ${CROSSENV} PATH=${TMPPATH} ${MAKE} \
|
||||||
${IMAKE_INSTALL} ${IMAKE_MTREE} METALOG=${METALOG} ${.TARGET}
|
${IMAKE_INSTALL} ${IMAKE_MTREE} METALOG=${METALOG} ${.TARGET}
|
||||||
|
|
||||||
@@ -1207,12 +1222,9 @@ _vtfontcvt= usr.bin/vtfontcvt
|
|||||||
_sed= usr.bin/sed
|
_sed= usr.bin/sed
|
||||||
.endif
|
.endif
|
||||||
|
|
||||||
.if ${BOOTSTRAPPING} < 900006
|
|
||||||
_lex= usr.bin/lex
|
|
||||||
.endif
|
|
||||||
|
|
||||||
.if ${BOOTSTRAPPING} < 1000002
|
.if ${BOOTSTRAPPING} < 1000002
|
||||||
_m4= usr.bin/m4
|
_m4= lib/libohash \
|
||||||
|
usr.bin/m4
|
||||||
.endif
|
.endif
|
||||||
|
|
||||||
.if ${BOOTSTRAPPING} < 1000013
|
.if ${BOOTSTRAPPING} < 1000013
|
||||||
@@ -1233,15 +1245,19 @@ _nmtree= lib/libnetbsd \
|
|||||||
_cat= bin/cat
|
_cat= bin/cat
|
||||||
.endif
|
.endif
|
||||||
|
|
||||||
|
.if ${BOOTSTRAPPING} < 1000033
|
||||||
|
_lex= usr.bin/lex
|
||||||
|
.endif
|
||||||
|
|
||||||
.if ${BOOTSTRAPPING} >= 900040 && ${BOOTSTRAPPING} < 900041
|
.if ${BOOTSTRAPPING} >= 900040 && ${BOOTSTRAPPING} < 900041
|
||||||
_awk= usr.bin/awk
|
_awk= usr.bin/awk
|
||||||
.endif
|
.endif
|
||||||
|
|
||||||
.if ${MK_BSNMP} != "no" && !exists(/usr/sbin/gensnmptree)
|
.if ${MK_BSNMP} != "no"
|
||||||
_gensnmptree= usr.sbin/bsnmpd/gensnmptree
|
_gensnmptree= usr.sbin/bsnmpd/gensnmptree
|
||||||
.endif
|
.endif
|
||||||
|
|
||||||
# We need to build tlbgen when we're building clang either as
|
# We need to build tblgen when we're building clang either as
|
||||||
# the bootstrap compiler, or as the part of the normal build.
|
# the bootstrap compiler, or as the part of the normal build.
|
||||||
.if ${MK_CLANG_BOOTSTRAP} != "no" || ${MK_CLANG} != "no"
|
.if ${MK_CLANG_BOOTSTRAP} != "no" || ${MK_CLANG} != "no"
|
||||||
_clang_tblgen= \
|
_clang_tblgen= \
|
||||||
@@ -1406,7 +1422,8 @@ cross-tools: .MAKE
|
|||||||
usr.bin/xlint/lint1 usr.bin/xlint/lint2 usr.bin/xlint/xlint \
|
usr.bin/xlint/lint1 usr.bin/xlint/lint2 usr.bin/xlint/xlint \
|
||||||
${_btxld} \
|
${_btxld} \
|
||||||
${_crunchide} \
|
${_crunchide} \
|
||||||
${_kgzip}
|
${_kgzip} \
|
||||||
|
sys/boot/usb/tools
|
||||||
${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \
|
${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \
|
||||||
cd ${.CURDIR}/${_tool} && \
|
cd ${.CURDIR}/${_tool} && \
|
||||||
${MAKE} DIRPRFX=${_tool}/ obj && \
|
${MAKE} DIRPRFX=${_tool}/ obj && \
|
||||||
@@ -1415,10 +1432,98 @@ cross-tools: .MAKE
|
|||||||
${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX} install
|
${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX} install
|
||||||
.endfor
|
.endfor
|
||||||
|
|
||||||
|
NXBENV= MAKEOBJDIRPREFIX=${OBJTREE}/nxb \
|
||||||
|
INSTALL="sh ${.CURDIR}/tools/install.sh" \
|
||||||
|
VERSION="${VERSION}"
|
||||||
|
NXBMAKE= ${NXBENV} ${MAKE} \
|
||||||
|
TBLGEN=${OBJTREE}/nxb-bin/usr/bin/tblgen \
|
||||||
|
CLANG_TBLGEN=${OBJTREE}/nxb-bin/usr/bin/clang-tblgen \
|
||||||
|
MACHINE=${TARGET} MACHINE_ARCH=${TARGET_ARCH} \
|
||||||
|
MK_GDB=no MK_TESTS=no \
|
||||||
|
SSP_CFLAGS= \
|
||||||
|
MK_HTML=no MK_INFO=no NO_LINT=yes MK_MAN=no \
|
||||||
|
-DNO_PIC MK_PROFILE=no -DNO_SHARED \
|
||||||
|
-DNO_CPU_CFLAGS MK_WARNS=no MK_CTF=no \
|
||||||
|
MK_CLANG_FULL=no MK_LLDB=no
|
||||||
|
|
||||||
|
native-xtools: .MAKE
|
||||||
|
mkdir -p ${OBJTREE}/nxb-bin/bin
|
||||||
|
mkdir -p ${OBJTREE}/nxb-bin/sbin
|
||||||
|
mkdir -p ${OBJTREE}/nxb-bin/usr
|
||||||
|
mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
|
||||||
|
-p ${OBJTREE}/nxb-bin/usr >/dev/null
|
||||||
|
mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
|
||||||
|
-p ${OBJTREE}/nxb-bin/usr/include >/dev/null
|
||||||
|
.for _tool in \
|
||||||
|
bin/cat \
|
||||||
|
bin/chmod \
|
||||||
|
bin/cp \
|
||||||
|
bin/csh \
|
||||||
|
bin/echo \
|
||||||
|
bin/expr \
|
||||||
|
bin/hostname \
|
||||||
|
bin/ln \
|
||||||
|
bin/ls \
|
||||||
|
bin/mkdir \
|
||||||
|
bin/mv \
|
||||||
|
bin/ps \
|
||||||
|
bin/realpath \
|
||||||
|
bin/rm \
|
||||||
|
bin/rmdir \
|
||||||
|
bin/sh \
|
||||||
|
bin/sleep \
|
||||||
|
${_clang_tblgen} \
|
||||||
|
usr.bin/ar \
|
||||||
|
${_binutils} \
|
||||||
|
${_cc} \
|
||||||
|
${_gcc_tools} \
|
||||||
|
${_clang_libs} \
|
||||||
|
${_clang} \
|
||||||
|
sbin/md5 \
|
||||||
|
sbin/sysctl \
|
||||||
|
gnu/usr.bin/diff \
|
||||||
|
usr.bin/awk \
|
||||||
|
usr.bin/basename \
|
||||||
|
usr.bin/bmake \
|
||||||
|
usr.bin/bzip2 \
|
||||||
|
usr.bin/cmp \
|
||||||
|
usr.bin/dirname \
|
||||||
|
usr.bin/env \
|
||||||
|
usr.bin/fetch \
|
||||||
|
usr.bin/find \
|
||||||
|
usr.bin/grep \
|
||||||
|
usr.bin/gzip \
|
||||||
|
usr.bin/id \
|
||||||
|
usr.bin/lex \
|
||||||
|
usr.bin/lorder \
|
||||||
|
usr.bin/mktemp \
|
||||||
|
usr.bin/mt \
|
||||||
|
usr.bin/patch \
|
||||||
|
usr.bin/sed \
|
||||||
|
usr.bin/sort \
|
||||||
|
usr.bin/tar \
|
||||||
|
usr.bin/touch \
|
||||||
|
usr.bin/tr \
|
||||||
|
usr.bin/true \
|
||||||
|
usr.bin/uniq \
|
||||||
|
usr.bin/unzip \
|
||||||
|
usr.bin/xargs \
|
||||||
|
usr.bin/xinstall \
|
||||||
|
usr.bin/xz \
|
||||||
|
usr.bin/yacc \
|
||||||
|
usr.sbin/chown
|
||||||
|
${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \
|
||||||
|
cd ${.CURDIR}/${_tool} && \
|
||||||
|
${NXBMAKE} DIRPRFX=${_tool}/ obj && \
|
||||||
|
${NXBMAKE} DIRPRFX=${_tool}/ depend && \
|
||||||
|
${NXBMAKE} DIRPRFX=${_tool}/ all && \
|
||||||
|
${NXBMAKE} DIRPRFX=${_tool}/ DESTDIR=${OBJTREE}/nxb-bin install
|
||||||
|
.endfor
|
||||||
|
|
||||||
#
|
#
|
||||||
# hierarchy - ensure that all the needed directories are present
|
# hierarchy - ensure that all the needed directories are present
|
||||||
#
|
#
|
||||||
hierarchy hier:
|
hierarchy hier: .MAKE
|
||||||
cd ${.CURDIR}/etc && ${HMAKE} distrib-dirs
|
cd ${.CURDIR}/etc && ${HMAKE} distrib-dirs
|
||||||
|
|
||||||
#
|
#
|
||||||
@@ -1476,35 +1581,32 @@ _prebuild_libs= ${_kerberos5_lib_libasn1} \
|
|||||||
${_kerberos5_lib_libhx509} ${_kerberos5_lib_libkrb5} \
|
${_kerberos5_lib_libhx509} ${_kerberos5_lib_libkrb5} \
|
||||||
${_kerberos5_lib_libroken} \
|
${_kerberos5_lib_libroken} \
|
||||||
${_kerberos5_lib_libwind} \
|
${_kerberos5_lib_libwind} \
|
||||||
${_lib_atf} \
|
|
||||||
lib/libbz2 ${_libcom_err} lib/libcrypt \
|
lib/libbz2 ${_libcom_err} lib/libcrypt \
|
||||||
lib/libelf lib/libexpat \
|
lib/libelf lib/libexpat \
|
||||||
|
lib/libfigpar \
|
||||||
${_lib_libgssapi} \
|
${_lib_libgssapi} \
|
||||||
lib/libkiconv lib/libkvm lib/liblzma lib/libmd lib/libnv \
|
lib/libkiconv lib/libkvm lib/liblzma lib/libmd lib/libnv \
|
||||||
${_lib_libcapsicum} \
|
${_lib_libcapsicum} \
|
||||||
lib/ncurses/ncurses lib/ncurses/ncursesw \
|
lib/ncurses/ncurses lib/ncurses/ncursesw \
|
||||||
lib/libopie lib/libpam ${_lib_libthr} \
|
lib/libopie lib/libpam ${_lib_libthr} \
|
||||||
lib/libradius lib/libsbuf lib/libtacplus \
|
lib/libradius lib/libsbuf lib/libtacplus \
|
||||||
|
lib/libgeom \
|
||||||
${_cddl_lib_libumem} ${_cddl_lib_libnvpair} \
|
${_cddl_lib_libumem} ${_cddl_lib_libnvpair} \
|
||||||
|
${_cddl_lib_libuutil} \
|
||||||
${_cddl_lib_libavl} \
|
${_cddl_lib_libavl} \
|
||||||
${_cddl_lib_libzfs_core} \
|
${_cddl_lib_libzfs_core} \
|
||||||
|
${_cddl_lib_libctf} \
|
||||||
lib/libutil lib/libpjdlog ${_lib_libypclnt} lib/libz lib/msun \
|
lib/libutil lib/libpjdlog ${_lib_libypclnt} lib/libz lib/msun \
|
||||||
${_secure_lib_libcrypto} ${_lib_libldns} \
|
${_secure_lib_libcrypto} ${_lib_libldns} \
|
||||||
${_secure_lib_libssh} ${_secure_lib_libssl}
|
${_secure_lib_libssh} ${_secure_lib_libssl} \
|
||||||
|
gnu/lib/libdialog
|
||||||
.if ${MK_GNUCXX} != "no"
|
.if ${MK_GNUCXX} != "no"
|
||||||
_prebuild_libs+= gnu/lib/libstdc++ gnu/lib/libsupc++
|
_prebuild_libs+= gnu/lib/libstdc++ gnu/lib/libsupc++
|
||||||
gnu/lib/libstdc++__L: lib/msun__L
|
gnu/lib/libstdc++__L: lib/msun__L
|
||||||
gnu/lib/libsupc++__L: gnu/lib/libstdc++__L
|
gnu/lib/libsupc++__L: gnu/lib/libstdc++__L
|
||||||
.endif
|
.endif
|
||||||
|
|
||||||
.if defined(WITH_ATF) || ${MK_TESTS} != "no"
|
lib/libgeom__L: lib/libexpat__L
|
||||||
.if !defined(WITH_ATF)
|
|
||||||
# Ensure that the ATF libraries will be built during make libraries, even
|
|
||||||
# though they will have WITHOUT_TESTS
|
|
||||||
MAKE+= -DWITH_ATF
|
|
||||||
.endif
|
|
||||||
_lib_atf= lib/atf
|
|
||||||
.endif
|
|
||||||
|
|
||||||
.if ${MK_LIBTHR} != "no"
|
.if ${MK_LIBTHR} != "no"
|
||||||
_lib_libthr= lib/libthr
|
_lib_libthr= lib/libthr
|
||||||
@@ -1534,9 +1636,13 @@ lib/libopie__L lib/libtacplus__L: lib/libmd__L
|
|||||||
_cddl_lib_libumem= cddl/lib/libumem
|
_cddl_lib_libumem= cddl/lib/libumem
|
||||||
_cddl_lib_libnvpair= cddl/lib/libnvpair
|
_cddl_lib_libnvpair= cddl/lib/libnvpair
|
||||||
_cddl_lib_libavl= cddl/lib/libavl
|
_cddl_lib_libavl= cddl/lib/libavl
|
||||||
|
_cddl_lib_libuutil= cddl/lib/libuutil
|
||||||
_cddl_lib_libzfs_core= cddl/lib/libzfs_core
|
_cddl_lib_libzfs_core= cddl/lib/libzfs_core
|
||||||
|
_cddl_lib_libctf= cddl/lib/libctf
|
||||||
_cddl_lib= cddl/lib
|
_cddl_lib= cddl/lib
|
||||||
cddl/lib/libzfs_core__L: cddl/lib/libnvpair__L
|
cddl/lib/libzfs_core__L: cddl/lib/libnvpair__L
|
||||||
|
cddl/lib/libzfs__L: lib/libgeom__L
|
||||||
|
cddl/lib/libctf__L: lib/libz__L
|
||||||
.endif
|
.endif
|
||||||
|
|
||||||
.if ${MK_CRYPT} != "no"
|
.if ${MK_CRYPT} != "no"
|
||||||
@@ -1611,6 +1717,8 @@ _lib_libypclnt= lib/libypclnt
|
|||||||
lib/libradius__L: lib/libmd__L
|
lib/libradius__L: lib/libmd__L
|
||||||
.endif
|
.endif
|
||||||
|
|
||||||
|
gnu/lib/libdialog__L: lib/msun__L lib/ncurses/ncursesw__L
|
||||||
|
|
||||||
.for _lib in ${_prereq_libs}
|
.for _lib in ${_prereq_libs}
|
||||||
${_lib}__PL: .PHONY .MAKE
|
${_lib}__PL: .PHONY .MAKE
|
||||||
.if exists(${.CURDIR}/${_lib})
|
.if exists(${.CURDIR}/${_lib})
|
||||||
@@ -1823,7 +1931,8 @@ check-old: check-old-files check-old-libs check-old-dirs
|
|||||||
# showconfig - show build configuration.
|
# showconfig - show build configuration.
|
||||||
#
|
#
|
||||||
showconfig:
|
showconfig:
|
||||||
@${MAKE} -n -f src.opts.mk -V dummy -dg1 2>&1 | grep ^MK_ | sort
|
@(${MAKE} -n -f ${.CURDIR}/sys/conf/kern.opts.mk -V dummy -dg1; \
|
||||||
|
${MAKE} -n -f ${.CURDIR}/share/mk/src.opts.mk -V dummy -dg1) 2>&1 | grep ^MK_ | sort -u
|
||||||
|
|
||||||
.if !empty(KRNLOBJDIR) && !empty(KERNCONF)
|
.if !empty(KRNLOBJDIR) && !empty(KERNCONF)
|
||||||
DTBOUTPUTPATH= ${KRNLOBJDIR}/${KERNCONF}/
|
DTBOUTPUTPATH= ${KRNLOBJDIR}/${KERNCONF}/
|
||||||
|
|||||||
+265
-1
@@ -38,6 +38,74 @@
|
|||||||
# xargs -n1 | sort | uniq -d;
|
# xargs -n1 | sort | uniq -d;
|
||||||
# done
|
# done
|
||||||
|
|
||||||
|
# 20141109: faith/faithd removal
|
||||||
|
OLD_FILES+=etc/rc.d/faith
|
||||||
|
OLD_FILES+=usr/share/man/man4/faith.4.gz
|
||||||
|
OLD_FILES+=usr/share/man/man4/if_faith.4.gz
|
||||||
|
OLD_FILES+=usr/sbin/faithd
|
||||||
|
OLD_FILES+=usr/share/man/man8/faithd.8.gz
|
||||||
|
# 20141102: postrandom obsoleted by new /dev/random code
|
||||||
|
OLD_FILES+=etc/rc.d/postrandom
|
||||||
|
# 20141031: initrandom obsoleted by new /dev/random code
|
||||||
|
OLD_FILES+=etc/rc.d/initrandom
|
||||||
|
# 20141028: debug files accidentally installed as directory name
|
||||||
|
OLD_FILES+=usr/lib/debug/usr/lib/i18n
|
||||||
|
OLD_FILES+=usr/lib/debug/usr/lib/private
|
||||||
|
OLD_FILES+=usr/lib/debug/usr/lib32/i18n
|
||||||
|
OLD_FILES+=usr/lib/debug/usr/lib32/private
|
||||||
|
# 20141015: OpenSSL 1.0.1j import
|
||||||
|
OLD_FILES+=usr/share/openssl/man/man3/CMS_sign_add1_signer.3.gz
|
||||||
|
# 20140922: sleepq_calc_signal_retval.9 and sleepq_catch_signals.9 removed
|
||||||
|
OLD_FILES+=usr/share/man/man9/sleepq_calc_signal_retval.9.gz
|
||||||
|
OLD_FILES+=usr/share/man/man9/sleepq_catch_signals.9.gz
|
||||||
|
# 20140917: hv_kvpd rc.d script removed in favor of devd configuration
|
||||||
|
OLD_FILES+=etc/rc.d/hv_kvpd
|
||||||
|
# 20140917: libnv was accidentally being installed to /usr/lib instead of /lib
|
||||||
|
OLD_LIBS+=usr/lib/libnv.so.0
|
||||||
|
# 20140829: rc.d/kerberos removed
|
||||||
|
OLD_FILES+=etc/rc.d/kerberos
|
||||||
|
# 20140814: libopie version bump
|
||||||
|
OLD_LIBS+=usr/lib/libopie.so.7
|
||||||
|
OLD_LIBS+=usr/lib32/libopie.so.7
|
||||||
|
# 20140811: otp-sha renamed to otp-sha1
|
||||||
|
OLD_FILES+=usr/bin/otp-sha
|
||||||
|
OLD_FILES+=usr/share/man/man1/otp-sha.1.gz
|
||||||
|
# 20140807: Remove private lib files that should not be installed.
|
||||||
|
OLD_FILES+=usr/lib/private/libatf-c.a
|
||||||
|
OLD_FILES+=usr/lib/private/libatf-c.so
|
||||||
|
OLD_FILES+=usr/lib/private/libatf-c_p.a
|
||||||
|
OLD_FILES+=usr/lib/private/libatf-c++.a
|
||||||
|
OLD_FILES+=usr/lib/private/libatf-c++.so
|
||||||
|
OLD_FILES+=usr/lib/private/libatf-c++_p.a
|
||||||
|
OLD_FILES+=usr/lib/private/libbsdstat.a
|
||||||
|
OLD_FILES+=usr/lib/private/libbsdstat.so
|
||||||
|
OLD_FILES+=usr/lib/private/libbsdstat_p.a
|
||||||
|
OLD_FILES+=usr/lib/private/libheimipcc.a
|
||||||
|
OLD_FILES+=usr/lib/private/libheimipcc.so
|
||||||
|
OLD_FILES+=usr/lib/private/libheimipcc_p.a
|
||||||
|
OLD_FILES+=usr/lib/private/libheimipcs.a
|
||||||
|
OLD_FILES+=usr/lib/private/libheimipcs.so
|
||||||
|
OLD_FILES+=usr/lib/private/libheimipcs_p.a
|
||||||
|
OLD_FILES+=usr/lib/private/libldns.a
|
||||||
|
OLD_FILES+=usr/lib/private/libldns.so
|
||||||
|
OLD_FILES+=usr/lib/private/libldns_p.a
|
||||||
|
OLD_FILES+=usr/lib/private/libssh.a
|
||||||
|
OLD_FILES+=usr/lib/private/libssh.so
|
||||||
|
OLD_FILES+=usr/lib/private/libssh.p.a
|
||||||
|
OLD_FILES+=usr/lib/private/libunbound.a
|
||||||
|
OLD_FILES+=usr/lib/private/libunbound.so
|
||||||
|
OLD_FILES+=usr/lib/private/libunbound_p.a
|
||||||
|
OLD_FILES+=usr/lib/private/libucl.a
|
||||||
|
OLD_FILES+=usr/lib/private/libucl.so
|
||||||
|
OLD_FILES+=usr/lib/private/libucl_p.a
|
||||||
|
# 20140803: Remove an obsolete man page
|
||||||
|
OLD_FILES+=usr/share/man/man9/pmap_change_wiring.9.gz
|
||||||
|
# 20140728: libsbuf restored to old version.
|
||||||
|
OLD_LIBS+=lib/libsbuf.so.7
|
||||||
|
# 20140728: Remove an obsolete man page
|
||||||
|
OLD_FILES+=usr/share/man/man9/VOP_GETVOBJECT.9.gz
|
||||||
|
OLD_FILES+=usr/share/man/man9/VOP_CREATEVOBJECT.9.gz
|
||||||
|
OLD_FILES+=usr/share/man/man9/VOP_DESTROYVOBJECT.9.gz
|
||||||
# 20140723: renamed to PCBGROUP.9
|
# 20140723: renamed to PCBGROUP.9
|
||||||
OLD_FILES+=usr/share/man/man9/PCBGROUPS.9.gz
|
OLD_FILES+=usr/share/man/man9/PCBGROUPS.9.gz
|
||||||
# 20140718: Remove obsolete man pages
|
# 20140718: Remove obsolete man pages
|
||||||
@@ -314,7 +382,6 @@ OLD_FILES+=usr/share/man/man1/atf-report.1.gz
|
|||||||
OLD_FILES+=usr/share/man/man1/atf-run.1.gz
|
OLD_FILES+=usr/share/man/man1/atf-run.1.gz
|
||||||
OLD_FILES+=usr/share/man/man1/atf-version.1.gz
|
OLD_FILES+=usr/share/man/man1/atf-version.1.gz
|
||||||
OLD_FILES+=usr/share/man/man5/atf-formats.5.gz
|
OLD_FILES+=usr/share/man/man5/atf-formats.5.gz
|
||||||
OLD_FILES+=usr/share/man/man7/atf.7.gz
|
|
||||||
OLD_FILES+=usr/share/xml/atf/tests-results.dtd
|
OLD_FILES+=usr/share/xml/atf/tests-results.dtd
|
||||||
OLD_FILES+=usr/share/xsl/atf/tests-results.xsl
|
OLD_FILES+=usr/share/xsl/atf/tests-results.xsl
|
||||||
# 20131009: freebsd-version moved from /libexec to /bin
|
# 20131009: freebsd-version moved from /libexec to /bin
|
||||||
@@ -1446,6 +1513,7 @@ OLD_LIBS+=usr/lib/libpanel.so.4
|
|||||||
OLD_LIBS+=usr/lib/libpanelw.so.4
|
OLD_LIBS+=usr/lib/libpanelw.so.4
|
||||||
OLD_LIBS+=usr/lib/libpmc.so.4
|
OLD_LIBS+=usr/lib/libpmc.so.4
|
||||||
OLD_LIBS+=usr/lib/libproc.so.1
|
OLD_LIBS+=usr/lib/libproc.so.1
|
||||||
|
OLD_LIBS+=usr/lib/libproc.so.2
|
||||||
OLD_LIBS+=usr/lib/libradius.so.3
|
OLD_LIBS+=usr/lib/libradius.so.3
|
||||||
OLD_LIBS+=usr/lib/librpcsvc.so.4
|
OLD_LIBS+=usr/lib/librpcsvc.so.4
|
||||||
OLD_LIBS+=usr/lib/libsdp.so.3
|
OLD_LIBS+=usr/lib/libsdp.so.3
|
||||||
@@ -3163,6 +3231,202 @@ OLD_FILES+=lib/geom/geom_concat.so.1
|
|||||||
OLD_FILES+=lib/geom/geom_label.so.1
|
OLD_FILES+=lib/geom/geom_label.so.1
|
||||||
OLD_FILES+=lib/geom/geom_nop.so.1
|
OLD_FILES+=lib/geom/geom_nop.so.1
|
||||||
OLD_FILES+=lib/geom/geom_stripe.so.1
|
OLD_FILES+=lib/geom/geom_stripe.so.1
|
||||||
|
# 20040728: GCC 3.4.2
|
||||||
|
OLD_DIRS+=usr/include/c++/3.3
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/FlexLexer.h
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/algorithm
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/backward/algo.h
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/backward/algobase.h
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/backward/alloc.h
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/backward/backward_warning.h
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/backward/bvector.h
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/backward/complex.h
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/backward/defalloc.h
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/backward/deque.h
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/backward/fstream.h
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/backward/function.h
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/backward/hash_map.h
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/backward/hash_set.h
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/backward/hashtable.h
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/backward/heap.h
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/backward/iomanip.h
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/backward/iostream.h
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/backward/istream.h
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/backward/iterator.h
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/backward/list.h
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/backward/map.h
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/backward/multimap.h
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/backward/multiset.h
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/backward/new.h
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/backward/ostream.h
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/backward/pair.h
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/backward/queue.h
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/backward/rope.h
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/backward/set.h
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/backward/slist.h
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/backward/stack.h
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/backward/stream.h
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/backward/streambuf.h
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/backward/strstream
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/backward/strstream.h
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/backward/tempbuf.h
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/backward/tree.h
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/backward/vector.h
|
||||||
|
OLD_DIRS+=usr/include/c++/3.3/backward
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/bits/atomicity.h
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/bits/basic_file.h
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/bits/basic_ios.h
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/bits/basic_ios.tcc
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/bits/basic_string.h
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/bits/basic_string.tcc
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/bits/boost_concept_check.h
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/bits/c++config.h
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/bits/c++io.h
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/bits/c++locale.h
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/bits/c++locale_internal.h
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/bits/char_traits.h
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/bits/cmath.tcc
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/bits/codecvt.h
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/bits/codecvt_specializations.h
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/bits/concept_check.h
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/bits/cpp_type_traits.h
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/bits/ctype_base.h
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/bits/ctype_inline.h
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/bits/ctype_noninline.h
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/bits/deque.tcc
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/bits/fpos.h
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/bits/fstream.tcc
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/bits/functexcept.h
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/bits/generic_shadow.h
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/bits/gslice.h
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/bits/gslice_array.h
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/bits/gthr-default.h
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/bits/gthr-posix.h
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/bits/gthr-single.h
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/bits/gthr.h
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/bits/indirect_array.h
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/bits/ios_base.h
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/bits/istream.tcc
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/bits/list.tcc
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/bits/locale_classes.h
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/bits/locale_facets.h
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/bits/locale_facets.tcc
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/bits/localefwd.h
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/bits/mask_array.h
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/bits/messages_members.h
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/bits/os_defines.h
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/bits/ostream.tcc
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/bits/pthread_allocimpl.h
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/bits/slice.h
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/bits/slice_array.h
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/bits/sstream.tcc
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/bits/stl_algo.h
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/bits/stl_algobase.h
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/bits/stl_alloc.h
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/bits/stl_bvector.h
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/bits/stl_construct.h
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/bits/stl_deque.h
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/bits/stl_function.h
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/bits/stl_heap.h
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/bits/stl_iterator.h
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/bits/stl_iterator_base_funcs.h
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/bits/stl_iterator_base_types.h
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/bits/stl_list.h
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/bits/stl_map.h
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/bits/stl_multimap.h
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/bits/stl_multiset.h
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/bits/stl_numeric.h
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/bits/stl_pair.h
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/bits/stl_pthread_alloc.h
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/bits/stl_queue.h
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/bits/stl_raw_storage_iter.h
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/bits/stl_relops.h
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/bits/stl_set.h
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/bits/stl_stack.h
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/bits/stl_tempbuf.h
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/bits/stl_threads.h
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/bits/stl_tree.h
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/bits/stl_uninitialized.h
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/bits/stl_vector.h
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/bits/stream_iterator.h
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/bits/streambuf.tcc
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/bits/streambuf_iterator.h
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/bits/stringfwd.h
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/bits/time_members.h
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/bits/type_traits.h
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/bits/valarray_array.h
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/bits/valarray_array.tcc
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/bits/valarray_meta.h
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/bits/vector.tcc
|
||||||
|
OLD_DIRS+=usr/include/c++/3.3/bits
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/bitset
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/cassert
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/cctype
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/cerrno
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/cfloat
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/ciso646
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/climits
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/clocale
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/cmath
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/complex
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/csetjmp
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/csignal
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/cstdarg
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/cstddef
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/cstdio
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/cstdlib
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/cstring
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/ctime
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/cwchar
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/cwctype
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/cxxabi.h
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/deque
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/exception
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/exception_defines.h
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/ext/algorithm
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/ext/enc_filebuf.h
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/ext/functional
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/ext/hash_map
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/ext/hash_set
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/ext/iterator
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/ext/memory
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/ext/numeric
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/ext/rb_tree
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/ext/rope
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/ext/ropeimpl.h
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/ext/slist
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/ext/stdio_filebuf.h
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/ext/stl_hash_fun.h
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/ext/stl_hashtable.h
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/ext/stl_rope.h
|
||||||
|
OLD_DIRS+=usr/include/c++/3.3/ext
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/fstream
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/functional
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/iomanip
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/ios
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/iosfwd
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/iostream
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/istream
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/iterator
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/limits
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/list
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/locale
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/map
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/memory
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/new
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/numeric
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/ostream
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/queue
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/set
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/sstream
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/stack
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/stdexcept
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/streambuf
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/string
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/typeinfo
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/utility
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/valarray
|
||||||
|
OLD_FILES+=usr/include/c++/3.3/vector
|
||||||
# 20040713: fla(4) removed.
|
# 20040713: fla(4) removed.
|
||||||
OLD_FILES+=usr/share/man/man4/fla.4.gz
|
OLD_FILES+=usr/share/man/man4/fla.4.gz
|
||||||
# 200407XX
|
# 200407XX
|
||||||
|
|||||||
@@ -31,6 +31,57 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 11.x IS SLOW:
|
|||||||
disable the most expensive debugging functionality run
|
disable the most expensive debugging functionality run
|
||||||
"ln -s 'abort:false,junk:false' /etc/malloc.conf".)
|
"ln -s 'abort:false,junk:false' /etc/malloc.conf".)
|
||||||
|
|
||||||
|
20141109:
|
||||||
|
faith(4) and faithd(8) has been removed from base system. It
|
||||||
|
has been obsolete for a very long time.
|
||||||
|
|
||||||
|
20141104:
|
||||||
|
vt(4), the new console driver, is enabled by default. It brings
|
||||||
|
support for Unicode and double-width characters, as well as
|
||||||
|
support for UEFI and integration with the KMS kernel video
|
||||||
|
drivers.
|
||||||
|
|
||||||
|
You may need to update your console settings in /etc/rc.conf,
|
||||||
|
most probably the keymap. During boot, /etc/rc.d/syscons will
|
||||||
|
indicate what you need to do.
|
||||||
|
|
||||||
|
vt(4) still has issues and lacks some features compared to
|
||||||
|
syscons(4). See the wiki for up-to-date information:
|
||||||
|
https://wiki.freebsd.org/Newcons
|
||||||
|
|
||||||
|
If you want to keep using syscons(4), you can do so by adding
|
||||||
|
the following line to /boot/loader.conf:
|
||||||
|
kern.vty=sc
|
||||||
|
|
||||||
|
20141102:
|
||||||
|
pjdfstest has been integrated into kyua as an opt-in test suite.
|
||||||
|
Please see share/doc/pjdfstest/README for a more details on how to
|
||||||
|
execute it.
|
||||||
|
|
||||||
|
20141009:
|
||||||
|
gperf has been removed from the base system for architectures
|
||||||
|
that use clang. Ports that require gperf will obtain it from the
|
||||||
|
devel/gperf port.
|
||||||
|
|
||||||
|
20140923:
|
||||||
|
pjdfstest has been moved from tools/regression/pjdfstest to
|
||||||
|
contrib/pjdfstest .
|
||||||
|
|
||||||
|
20140922:
|
||||||
|
At svn r271982, The default linux compat kernel ABI has been adjusted
|
||||||
|
to 2.6.18 in support of the linux-c6 compat ports infrastructure
|
||||||
|
update. If you wish to continue using the linux-f10 compat ports,
|
||||||
|
add compat.linux.osrelease=2.6.16 to your local sysctl.conf. Users are
|
||||||
|
encouraged to update their linux-compat packages to linux-c6 during
|
||||||
|
their next update cycle.
|
||||||
|
|
||||||
|
20140729:
|
||||||
|
The ofwfb driver, used to provide a graphics console on PowerPC when
|
||||||
|
using vt(4), no longer allows mmap() of all of physical memory. This
|
||||||
|
will prevent Xorg on PowerPC with some ATI graphics cards from
|
||||||
|
initializing properly unless x11-servers/xorg-server is updated to
|
||||||
|
1.12.4_8 or newer.
|
||||||
|
|
||||||
20140723:
|
20140723:
|
||||||
The xdev targets have been converted to using TARGET and
|
The xdev targets have been converted to using TARGET and
|
||||||
TARGET_ARCH instead of XDEV and XDEV_ARCH.
|
TARGET_ARCH instead of XDEV and XDEV_ARCH.
|
||||||
@@ -786,8 +837,8 @@ COMMON ITEMS:
|
|||||||
2.) update the ZFS boot block on your boot drive
|
2.) update the ZFS boot block on your boot drive
|
||||||
|
|
||||||
The following example updates the ZFS boot block on the first
|
The following example updates the ZFS boot block on the first
|
||||||
partition (freebsd-boot) of a GPT partitioned drive ad0:
|
partition (freebsd-boot) of a GPT partitioned drive ada0:
|
||||||
"gpart bootcode -p /boot/gptzfsboot -i 1 ad0"
|
"gpart bootcode -p /boot/gptzfsboot -i 1 ada0"
|
||||||
|
|
||||||
Non-boot pools do not need these updates.
|
Non-boot pools do not need these updates.
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -94,7 +94,7 @@ GENHDRS+= iconv.h
|
|||||||
SRCS+= iconv_stub.c
|
SRCS+= iconv_stub.c
|
||||||
|
|
||||||
iconv.h: ${.CURDIR}/iconv_stub.h
|
iconv.h: ${.CURDIR}/iconv_stub.h
|
||||||
cp ${.CURDIR}/iconv_stub.h ${.TARGET}
|
cp -f ${.CURDIR}/iconv_stub.h ${.TARGET}
|
||||||
.endif
|
.endif
|
||||||
.endif
|
.endif
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,6 @@
|
|||||||
|
|
||||||
TESTSDIR= ${TESTSBASE}/bin/date
|
TESTSDIR= ${TESTSBASE}/bin/date
|
||||||
|
|
||||||
TAP_TESTS_SH= legacy_test
|
ATF_TESTS_SH= format_string_test
|
||||||
|
|
||||||
.include <bsd.test.mk>
|
.include <bsd.test.mk>
|
||||||
|
|||||||
Executable
+92
@@ -0,0 +1,92 @@
|
|||||||
|
#
|
||||||
|
# Regression tests for date(1)
|
||||||
|
#
|
||||||
|
# Submitted by Edwin Groothuis <edwin@FreeBSD.org>
|
||||||
|
#
|
||||||
|
# $FreeBSD$
|
||||||
|
#
|
||||||
|
|
||||||
|
#
|
||||||
|
# These two date/times have been chosen carefully -- they
|
||||||
|
# create both the single digit and double/multidigit version of
|
||||||
|
# the values.
|
||||||
|
#
|
||||||
|
# To create a new one, make sure you are using the UTC timezone!
|
||||||
|
#
|
||||||
|
|
||||||
|
TEST1=3222243 # 1970-02-07 07:04:03
|
||||||
|
TEST2=1005600000 # 2001-11-12 21:11:12
|
||||||
|
|
||||||
|
check()
|
||||||
|
{
|
||||||
|
local format_string exp_output_1 exp_output_2
|
||||||
|
|
||||||
|
format_string=${1}
|
||||||
|
exp_output_1=${2}
|
||||||
|
exp_output_2=${3}
|
||||||
|
|
||||||
|
atf_check -o "inline:${exp_output_1}\n" \
|
||||||
|
date -r ${TEST1} +%${format_string}
|
||||||
|
atf_check -o "inline:${exp_output_2}\n" \
|
||||||
|
date -r ${TEST2} +%${format_string}
|
||||||
|
}
|
||||||
|
|
||||||
|
format_string_test()
|
||||||
|
{
|
||||||
|
local desc exp_output_1 exp_output_2 flag
|
||||||
|
|
||||||
|
desc=${1}
|
||||||
|
flag=${2}
|
||||||
|
exp_output_1=${3}
|
||||||
|
exp_output_2=${4}
|
||||||
|
|
||||||
|
atf_test_case ${desc}_test
|
||||||
|
eval "
|
||||||
|
${desc}_test_body() {
|
||||||
|
check ${flag} '${exp_output_1}' '${exp_output_2}';
|
||||||
|
}"
|
||||||
|
atf_add_test_case ${desc}_test
|
||||||
|
}
|
||||||
|
|
||||||
|
atf_init_test_cases()
|
||||||
|
{
|
||||||
|
format_string_test A A Saturday Monday
|
||||||
|
format_string_test a a Sat Mon
|
||||||
|
format_string_test B B February November
|
||||||
|
format_string_test b b Feb Nov
|
||||||
|
format_string_test C C 19 20
|
||||||
|
format_string_test c c "Sat Feb 7 07:04:03 1970" "Mon Nov 12 21:20:00 2001"
|
||||||
|
format_string_test D D 02/07/70 11/12/01
|
||||||
|
format_string_test d d 07 12
|
||||||
|
format_string_test e e " 7" 12
|
||||||
|
format_string_test F F "1970-02-07" "2001-11-12"
|
||||||
|
format_string_test G G 1970 2001
|
||||||
|
format_string_test g g 70 01
|
||||||
|
format_string_test H H 07 21
|
||||||
|
format_string_test h h Feb Nov
|
||||||
|
format_string_test I I 07 09
|
||||||
|
format_string_test j j 038 316
|
||||||
|
format_string_test k k " 7" 21
|
||||||
|
format_string_test l l " 7" " 9"
|
||||||
|
format_string_test M M 04 20
|
||||||
|
format_string_test m m 02 11
|
||||||
|
format_string_test p p AM PM
|
||||||
|
format_string_test R R 07:04 21:20
|
||||||
|
format_string_test r r "07:04:03 AM" "09:20:00 PM"
|
||||||
|
format_string_test S S 03 00
|
||||||
|
format_string_test s s ${TEST1} ${TEST2}
|
||||||
|
format_string_test U U 05 45
|
||||||
|
format_string_test u u 6 1
|
||||||
|
format_string_test V V 06 46
|
||||||
|
format_string_test v v " 7-Feb-1970" "12-Nov-2001"
|
||||||
|
format_string_test W W 05 46
|
||||||
|
format_string_test w w 6 1
|
||||||
|
format_string_test X X "07:04:03" "21:20:00"
|
||||||
|
format_string_test x x "02/07/70" "11/12/01"
|
||||||
|
format_string_test Y Y 1970 2001
|
||||||
|
format_string_test y y 70 01
|
||||||
|
format_string_test Z Z UTC UTC
|
||||||
|
format_string_test z z +0000 +0000
|
||||||
|
format_string_test percent % % %
|
||||||
|
format_string_test plus + "Sat Feb 7 07:04:03 UTC 1970" "Mon Nov 12 21:20:00 UTC 2001"
|
||||||
|
}
|
||||||
@@ -1,91 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
#
|
|
||||||
# Regression tests for date(1)
|
|
||||||
#
|
|
||||||
# Submitted by Edwin Groothuis <edwin@FreeBSD.org>
|
|
||||||
#
|
|
||||||
# $FreeBSD$
|
|
||||||
#
|
|
||||||
|
|
||||||
#
|
|
||||||
# These two date/times have been chosen carefully, they
|
|
||||||
# create both the single digit and double/multidigit version of
|
|
||||||
# the values.
|
|
||||||
#
|
|
||||||
# To create a new one, make sure you are using the UTC timezone!
|
|
||||||
#
|
|
||||||
|
|
||||||
TEST1=3222243 # 1970-02-07 07:04:03
|
|
||||||
TEST2=1005600000 # 2001-11-12 21:11:12
|
|
||||||
|
|
||||||
export LC_ALL=C
|
|
||||||
export TZ=UTC
|
|
||||||
count=0
|
|
||||||
|
|
||||||
check()
|
|
||||||
{
|
|
||||||
S=$1
|
|
||||||
A1=$2
|
|
||||||
A2=$3
|
|
||||||
|
|
||||||
count=`expr ${count} + 1`
|
|
||||||
|
|
||||||
if [ -z "${A2}" ]; then A2=${A1}; fi
|
|
||||||
|
|
||||||
R=`date -r ${TEST1} +%${S}`
|
|
||||||
if [ "${R}" = "${A1}" ]; then
|
|
||||||
echo "ok ${S}{t1}"
|
|
||||||
else
|
|
||||||
echo "no ok ${S}{t1} - (got ${R}, expected ${A1})"
|
|
||||||
fi
|
|
||||||
|
|
||||||
R=`date -r ${TEST2} +%${S}`
|
|
||||||
if [ "${R}" = "${A2}" ]; then
|
|
||||||
echo "ok ${S}{t2}"
|
|
||||||
else
|
|
||||||
echo "no ok ${S}{t2} - (got ${R}, expected ${A2})"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
echo "1..78"
|
|
||||||
|
|
||||||
check A Saturday Monday
|
|
||||||
check a Sat Mon
|
|
||||||
check B February November
|
|
||||||
check b Feb Nov
|
|
||||||
check C 19 20
|
|
||||||
check c "Sat Feb 7 07:04:03 1970" "Mon Nov 12 21:20:00 2001"
|
|
||||||
check D 02/07/70 11/12/01
|
|
||||||
check d 07 12
|
|
||||||
check e " 7" 12
|
|
||||||
check F "1970-02-07" "2001-11-12"
|
|
||||||
check G 1970 2001
|
|
||||||
check g 70 01
|
|
||||||
check H 07 21
|
|
||||||
check h Feb Nov
|
|
||||||
check I 07 09
|
|
||||||
check j 038 316
|
|
||||||
check k " 7" 21
|
|
||||||
check l " 7" " 9"
|
|
||||||
check M 04 20
|
|
||||||
check m 02 11
|
|
||||||
check p AM PM
|
|
||||||
check R 07:04 21:20
|
|
||||||
check r "07:04:03 AM" "09:20:00 PM"
|
|
||||||
check S 03 00
|
|
||||||
check s ${TEST1} ${TEST2}
|
|
||||||
check U 05 45
|
|
||||||
check u 6 1
|
|
||||||
check V 06 46
|
|
||||||
check v " 7-Feb-1970" "12-Nov-2001"
|
|
||||||
check W 05 46
|
|
||||||
check w 6 1
|
|
||||||
check X "07:04:03" "21:20:00"
|
|
||||||
check x "02/07/70" "11/12/01"
|
|
||||||
check Y 1970 2001
|
|
||||||
check y 70 01
|
|
||||||
check Z UTC UTC
|
|
||||||
check z +0000 +0000
|
|
||||||
check % % %
|
|
||||||
check + "Sat Feb 7 07:04:03 UTC 1970" "Mon Nov 12 21:20:00 UTC 2001"
|
|
||||||
+6
-1
@@ -32,7 +32,7 @@
|
|||||||
.\" @(#)dd.1 8.2 (Berkeley) 1/13/94
|
.\" @(#)dd.1 8.2 (Berkeley) 1/13/94
|
||||||
.\" $FreeBSD$
|
.\" $FreeBSD$
|
||||||
.\"
|
.\"
|
||||||
.Dd April 2, 2014
|
.Dd August 28, 2014
|
||||||
.Dt DD 1
|
.Dt DD 1
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
@@ -408,6 +408,11 @@ To create an image of a Mode-1 CD-ROM, which is a commonly used format
|
|||||||
for data CD-ROM disks, use a block size of 2048 bytes:
|
for data CD-ROM disks, use a block size of 2048 bytes:
|
||||||
.Pp
|
.Pp
|
||||||
.Dl "dd if=/dev/acd0 of=filename.iso bs=2048"
|
.Dl "dd if=/dev/acd0 of=filename.iso bs=2048"
|
||||||
|
.Pp
|
||||||
|
Write a filesystem image to a memory stick, padding the end with zeros,
|
||||||
|
if necessary, to a 1MiB boundary:
|
||||||
|
.Pp
|
||||||
|
.Dl "dd if=memstick.img of=/dev/da0 bs=1m conv=noerror,sync"
|
||||||
.Sh SEE ALSO
|
.Sh SEE ALSO
|
||||||
.Xr cp 1 ,
|
.Xr cp 1 ,
|
||||||
.Xr mt 1 ,
|
.Xr mt 1 ,
|
||||||
|
|||||||
+2
-2
@@ -9,7 +9,7 @@ SRCS= df.c vfslist.c
|
|||||||
|
|
||||||
CFLAGS+= -I${MOUNT}
|
CFLAGS+= -I${MOUNT}
|
||||||
|
|
||||||
DPADD= ${LIBUTIL}
|
DPADD= ${LIBUTIL} ${LIBXO}
|
||||||
LDADD= -lutil
|
LDADD= -lutil -lxo
|
||||||
|
|
||||||
.include <bsd.prog.mk>
|
.include <bsd.prog.mk>
|
||||||
|
|||||||
+4
-1
@@ -29,7 +29,7 @@
|
|||||||
.\" @(#)df.1 8.3 (Berkeley) 5/8/95
|
.\" @(#)df.1 8.3 (Berkeley) 5/8/95
|
||||||
.\" $FreeBSD$
|
.\" $FreeBSD$
|
||||||
.\"
|
.\"
|
||||||
.Dd January 16, 2014
|
.Dd November 6, 2014
|
||||||
.Dt DF 1
|
.Dt DF 1
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
@@ -37,6 +37,7 @@
|
|||||||
.Nd display free disk space
|
.Nd display free disk space
|
||||||
.Sh SYNOPSIS
|
.Sh SYNOPSIS
|
||||||
.Nm
|
.Nm
|
||||||
|
.Op Fl -libxo
|
||||||
.Op Fl b | g | H | h | k | m | P
|
.Op Fl b | g | H | h | k | m | P
|
||||||
.Op Fl acilnT
|
.Op Fl acilnT
|
||||||
.Op Fl \&,
|
.Op Fl \&,
|
||||||
@@ -193,7 +194,9 @@ If the value is outside, it will be set to the appropriate limit.
|
|||||||
.Xr statfs 2 ,
|
.Xr statfs 2 ,
|
||||||
.Xr getbsize 3 ,
|
.Xr getbsize 3 ,
|
||||||
.Xr getmntinfo 3 ,
|
.Xr getmntinfo 3 ,
|
||||||
|
.Xr libxo 3 ,
|
||||||
.Xr localeconv 3 ,
|
.Xr localeconv 3 ,
|
||||||
|
.Xr xo_parse_args 3 ,
|
||||||
.Xr fstab 5 ,
|
.Xr fstab 5 ,
|
||||||
.Xr mount 8 ,
|
.Xr mount 8 ,
|
||||||
.Xr pstat 8 ,
|
.Xr pstat 8 ,
|
||||||
|
|||||||
+72
-48
@@ -60,6 +60,7 @@ __FBSDID("$FreeBSD$");
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <sysexits.h>
|
#include <sysexits.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#include <libxo/xo.h>
|
||||||
|
|
||||||
#include "extern.h"
|
#include "extern.h"
|
||||||
|
|
||||||
@@ -82,7 +83,7 @@ static char *getmntpt(const char *);
|
|||||||
static int int64width(int64_t);
|
static int int64width(int64_t);
|
||||||
static char *makenetvfslist(void);
|
static char *makenetvfslist(void);
|
||||||
static void prthuman(const struct statfs *, int64_t);
|
static void prthuman(const struct statfs *, int64_t);
|
||||||
static void prthumanval(int64_t);
|
static void prthumanval(const char *, int64_t);
|
||||||
static intmax_t fsbtoblk(int64_t, uint64_t, u_long);
|
static intmax_t fsbtoblk(int64_t, uint64_t, u_long);
|
||||||
static void prtstat(struct statfs *, struct maxwidths *);
|
static void prtstat(struct statfs *, struct maxwidths *);
|
||||||
static size_t regetmntinfo(struct statfs **, long, const char **);
|
static size_t regetmntinfo(struct statfs **, long, const char **);
|
||||||
@@ -119,6 +120,11 @@ main(int argc, char *argv[])
|
|||||||
totalbuf.f_bsize = DEV_BSIZE;
|
totalbuf.f_bsize = DEV_BSIZE;
|
||||||
strlcpy(totalbuf.f_mntfromname, "total", MNAMELEN);
|
strlcpy(totalbuf.f_mntfromname, "total", MNAMELEN);
|
||||||
vfslist = NULL;
|
vfslist = NULL;
|
||||||
|
|
||||||
|
argc = xo_parse_args(argc, argv);
|
||||||
|
if (argc < 0)
|
||||||
|
exit(1);
|
||||||
|
|
||||||
while ((ch = getopt(argc, argv, "abcgHhiklmnPt:T,")) != -1)
|
while ((ch = getopt(argc, argv, "abcgHhiklmnPt:T,")) != -1)
|
||||||
switch (ch) {
|
switch (ch) {
|
||||||
case 'a':
|
case 'a':
|
||||||
@@ -161,7 +167,7 @@ main(int argc, char *argv[])
|
|||||||
break;
|
break;
|
||||||
case 'l':
|
case 'l':
|
||||||
if (vfslist != NULL)
|
if (vfslist != NULL)
|
||||||
errx(1, "-l and -t are mutually exclusive.");
|
xo_errx(1, "-l and -t are mutually exclusive.");
|
||||||
vfslist = makevfslist(makenetvfslist());
|
vfslist = makevfslist(makenetvfslist());
|
||||||
lflag = 1;
|
lflag = 1;
|
||||||
break;
|
break;
|
||||||
@@ -174,9 +180,9 @@ main(int argc, char *argv[])
|
|||||||
break;
|
break;
|
||||||
case 't':
|
case 't':
|
||||||
if (lflag)
|
if (lflag)
|
||||||
errx(1, "-l and -t are mutually exclusive.");
|
xo_errx(1, "-l and -t are mutually exclusive.");
|
||||||
if (vfslist != NULL)
|
if (vfslist != NULL)
|
||||||
errx(1, "only one -t option may be specified");
|
xo_errx(1, "only one -t option may be specified");
|
||||||
fstype = optarg;
|
fstype = optarg;
|
||||||
vfslist = makevfslist(optarg);
|
vfslist = makevfslist(optarg);
|
||||||
break;
|
break;
|
||||||
@@ -202,16 +208,19 @@ main(int argc, char *argv[])
|
|||||||
/* just the filesystems specified on the command line */
|
/* just the filesystems specified on the command line */
|
||||||
mntbuf = malloc(argc * sizeof(*mntbuf));
|
mntbuf = malloc(argc * sizeof(*mntbuf));
|
||||||
if (mntbuf == NULL)
|
if (mntbuf == NULL)
|
||||||
err(1, "malloc()");
|
xo_err(1, "malloc()");
|
||||||
mntsize = 0;
|
mntsize = 0;
|
||||||
/* continued in for loop below */
|
/* continued in for loop below */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
xo_open_container("storage-system-information");
|
||||||
|
xo_open_list("filesystem");
|
||||||
|
|
||||||
/* iterate through specified filesystems */
|
/* iterate through specified filesystems */
|
||||||
for (; *argv; argv++) {
|
for (; *argv; argv++) {
|
||||||
if (stat(*argv, &stbuf) < 0) {
|
if (stat(*argv, &stbuf) < 0) {
|
||||||
if ((mntpt = getmntpt(*argv)) == NULL) {
|
if ((mntpt = getmntpt(*argv)) == NULL) {
|
||||||
warn("%s", *argv);
|
xo_warn("%s", *argv);
|
||||||
rv = 1;
|
rv = 1;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -220,20 +229,20 @@ main(int argc, char *argv[])
|
|||||||
mdev.fspec = *argv;
|
mdev.fspec = *argv;
|
||||||
mntpath = strdup("/tmp/df.XXXXXX");
|
mntpath = strdup("/tmp/df.XXXXXX");
|
||||||
if (mntpath == NULL) {
|
if (mntpath == NULL) {
|
||||||
warn("strdup failed");
|
xo_warn("strdup failed");
|
||||||
rv = 1;
|
rv = 1;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
mntpt = mkdtemp(mntpath);
|
mntpt = mkdtemp(mntpath);
|
||||||
if (mntpt == NULL) {
|
if (mntpt == NULL) {
|
||||||
warn("mkdtemp(\"%s\") failed", mntpath);
|
xo_warn("mkdtemp(\"%s\") failed", mntpath);
|
||||||
rv = 1;
|
rv = 1;
|
||||||
free(mntpath);
|
free(mntpath);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (mount(fstype, mntpt, MNT_RDONLY,
|
if (mount(fstype, mntpt, MNT_RDONLY,
|
||||||
&mdev) != 0) {
|
&mdev) != 0) {
|
||||||
warn("%s", *argv);
|
xo_warn("%s", *argv);
|
||||||
rv = 1;
|
rv = 1;
|
||||||
(void)rmdir(mntpt);
|
(void)rmdir(mntpt);
|
||||||
free(mntpath);
|
free(mntpath);
|
||||||
@@ -244,7 +253,7 @@ main(int argc, char *argv[])
|
|||||||
if (cflag)
|
if (cflag)
|
||||||
addstat(&totalbuf, &statfsbuf);
|
addstat(&totalbuf, &statfsbuf);
|
||||||
} else {
|
} else {
|
||||||
warn("%s", *argv);
|
xo_warn("%s", *argv);
|
||||||
rv = 1;
|
rv = 1;
|
||||||
}
|
}
|
||||||
(void)unmount(mntpt, 0);
|
(void)unmount(mntpt, 0);
|
||||||
@@ -260,7 +269,7 @@ main(int argc, char *argv[])
|
|||||||
* implement nflag here.
|
* implement nflag here.
|
||||||
*/
|
*/
|
||||||
if (statfs(mntpt, &statfsbuf) < 0) {
|
if (statfs(mntpt, &statfsbuf) < 0) {
|
||||||
warn("%s", mntpt);
|
xo_warn("%s", mntpt);
|
||||||
rv = 1;
|
rv = 1;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -294,8 +303,14 @@ main(int argc, char *argv[])
|
|||||||
for (i = 0; i < mntsize; i++)
|
for (i = 0; i < mntsize; i++)
|
||||||
if (aflag || (mntbuf[i].f_flags & MNT_IGNORE) == 0)
|
if (aflag || (mntbuf[i].f_flags & MNT_IGNORE) == 0)
|
||||||
prtstat(&mntbuf[i], &maxwidths);
|
prtstat(&mntbuf[i], &maxwidths);
|
||||||
|
|
||||||
|
xo_close_list("filesystem");
|
||||||
|
|
||||||
if (cflag)
|
if (cflag)
|
||||||
prtstat(&totalbuf, &maxwidths);
|
prtstat(&totalbuf, &maxwidths);
|
||||||
|
|
||||||
|
xo_close_container("storage-system-information");
|
||||||
|
xo_finish();
|
||||||
return (rv);
|
return (rv);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -341,7 +356,7 @@ regetmntinfo(struct statfs **mntbufp, long mntsize, const char **vfslist)
|
|||||||
if (nflag || error < 0)
|
if (nflag || error < 0)
|
||||||
if (i != j) {
|
if (i != j) {
|
||||||
if (error < 0)
|
if (error < 0)
|
||||||
warnx("%s stats possibly stale",
|
xo_warnx("%s stats possibly stale",
|
||||||
mntbuf[i].f_mntonname);
|
mntbuf[i].f_mntonname);
|
||||||
mntbuf[j] = mntbuf[i];
|
mntbuf[j] = mntbuf[i];
|
||||||
}
|
}
|
||||||
@@ -354,13 +369,13 @@ static void
|
|||||||
prthuman(const struct statfs *sfsp, int64_t used)
|
prthuman(const struct statfs *sfsp, int64_t used)
|
||||||
{
|
{
|
||||||
|
|
||||||
prthumanval(sfsp->f_blocks * sfsp->f_bsize);
|
prthumanval(" {:blocks/%6s}", sfsp->f_blocks * sfsp->f_bsize);
|
||||||
prthumanval(used * sfsp->f_bsize);
|
prthumanval(" {:used/%6s}", used * sfsp->f_bsize);
|
||||||
prthumanval(sfsp->f_bavail * sfsp->f_bsize);
|
prthumanval(" {:available/%6s}", sfsp->f_bavail * sfsp->f_bsize);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
prthumanval(int64_t bytes)
|
prthumanval(const char *fmt, int64_t bytes)
|
||||||
{
|
{
|
||||||
char buf[6];
|
char buf[6];
|
||||||
int flags;
|
int flags;
|
||||||
@@ -372,14 +387,15 @@ prthumanval(int64_t bytes)
|
|||||||
humanize_number(buf, sizeof(buf) - (bytes < 0 ? 0 : 1),
|
humanize_number(buf, sizeof(buf) - (bytes < 0 ? 0 : 1),
|
||||||
bytes, "", HN_AUTOSCALE, flags);
|
bytes, "", HN_AUTOSCALE, flags);
|
||||||
|
|
||||||
(void)printf(" %6s", buf);
|
xo_attr("value", "%lld", (long long) bytes);
|
||||||
|
xo_emit(fmt, buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Print an inode count in "human-readable" format.
|
* Print an inode count in "human-readable" format.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
prthumanvalinode(int64_t bytes)
|
prthumanvalinode(const char *fmt, int64_t bytes)
|
||||||
{
|
{
|
||||||
char buf[6];
|
char buf[6];
|
||||||
int flags;
|
int flags;
|
||||||
@@ -389,7 +405,8 @@ prthumanvalinode(int64_t bytes)
|
|||||||
humanize_number(buf, sizeof(buf) - (bytes < 0 ? 0 : 1),
|
humanize_number(buf, sizeof(buf) - (bytes < 0 ? 0 : 1),
|
||||||
bytes, "", HN_AUTOSCALE, flags);
|
bytes, "", HN_AUTOSCALE, flags);
|
||||||
|
|
||||||
(void)printf(" %5s", buf);
|
xo_attr("value", "%lld", (long long) bytes);
|
||||||
|
xo_emit(fmt, buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -434,70 +451,77 @@ prtstat(struct statfs *sfsp, struct maxwidths *mwp)
|
|||||||
mwp->used = imax(mwp->used, (int)strlen("Used"));
|
mwp->used = imax(mwp->used, (int)strlen("Used"));
|
||||||
mwp->avail = imax(mwp->avail, (int)strlen("Avail"));
|
mwp->avail = imax(mwp->avail, (int)strlen("Avail"));
|
||||||
|
|
||||||
(void)printf("%-*s", mwp->mntfrom, "Filesystem");
|
xo_emit("{T:/%-*s}", mwp->mntfrom, "Filesystem");
|
||||||
if (Tflag)
|
if (Tflag)
|
||||||
(void)printf(" %-*s", mwp->fstype, "Type");
|
xo_emit(" {T:/%-*s}", mwp->fstype, "Type");
|
||||||
(void)printf(" %*s %*s %*s Capacity", mwp->total, header,
|
xo_emit(" {T:/%*s} {T:/%*s} {T:/%*s} Capacity",
|
||||||
|
mwp->total, header,
|
||||||
mwp->used, "Used", mwp->avail, "Avail");
|
mwp->used, "Used", mwp->avail, "Avail");
|
||||||
if (iflag) {
|
if (iflag) {
|
||||||
mwp->iused = imax(hflag ? 0 : mwp->iused,
|
mwp->iused = imax(hflag ? 0 : mwp->iused,
|
||||||
(int)strlen(" iused"));
|
(int)strlen(" iused"));
|
||||||
mwp->ifree = imax(hflag ? 0 : mwp->ifree,
|
mwp->ifree = imax(hflag ? 0 : mwp->ifree,
|
||||||
(int)strlen("ifree"));
|
(int)strlen("ifree"));
|
||||||
(void)printf(" %*s %*s %%iused",
|
xo_emit(" {T:/%*s} {T:/%*s} {T:\%iused}",
|
||||||
mwp->iused - 2, "iused", mwp->ifree, "ifree");
|
mwp->iused - 2, "iused", mwp->ifree, "ifree");
|
||||||
}
|
}
|
||||||
(void)printf(" Mounted on\n");
|
xo_emit(" {T:Mounted on}\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
xo_open_instance("filesystem");
|
||||||
/* Check for 0 block size. Can this happen? */
|
/* Check for 0 block size. Can this happen? */
|
||||||
if (sfsp->f_bsize == 0) {
|
if (sfsp->f_bsize == 0) {
|
||||||
warnx ("File system %s does not have a block size, assuming 512.",
|
xo_warnx ("File system %s does not have a block size, assuming 512.",
|
||||||
sfsp->f_mntonname);
|
sfsp->f_mntonname);
|
||||||
sfsp->f_bsize = 512;
|
sfsp->f_bsize = 512;
|
||||||
}
|
}
|
||||||
(void)printf("%-*s", mwp->mntfrom, sfsp->f_mntfromname);
|
xo_emit("{tk:name/%-*s}", mwp->mntfrom, sfsp->f_mntfromname);
|
||||||
if (Tflag)
|
if (Tflag)
|
||||||
(void)printf(" %-*s", mwp->fstype, sfsp->f_fstypename);
|
xo_emit(" {:type/%-*s}", mwp->fstype, sfsp->f_fstypename);
|
||||||
used = sfsp->f_blocks - sfsp->f_bfree;
|
used = sfsp->f_blocks - sfsp->f_bfree;
|
||||||
availblks = sfsp->f_bavail + used;
|
availblks = sfsp->f_bavail + used;
|
||||||
if (hflag) {
|
if (hflag) {
|
||||||
prthuman(sfsp, used);
|
prthuman(sfsp, used);
|
||||||
} else {
|
} else {
|
||||||
if (thousands)
|
if (thousands)
|
||||||
format = " %*j'd %*j'd %*j'd";
|
format = " {t:total-blocks/%*j'd} {t:used-blocks/%*j'd} "
|
||||||
|
"{t:available-blocks/%*j'd}";
|
||||||
else
|
else
|
||||||
format = " %*jd %*jd %*jd";
|
format = " {t:total-blocks/%*jd} {t:used-blocks/%*jd} "
|
||||||
(void)printf(format,
|
"{t:available-blocks/%*jd}";
|
||||||
|
xo_emit(format,
|
||||||
mwp->total, fsbtoblk(sfsp->f_blocks,
|
mwp->total, fsbtoblk(sfsp->f_blocks,
|
||||||
sfsp->f_bsize, blocksize),
|
sfsp->f_bsize, blocksize),
|
||||||
mwp->used, fsbtoblk(used, sfsp->f_bsize, blocksize),
|
mwp->used, fsbtoblk(used, sfsp->f_bsize, blocksize),
|
||||||
mwp->avail, fsbtoblk(sfsp->f_bavail,
|
mwp->avail, fsbtoblk(sfsp->f_bavail,
|
||||||
sfsp->f_bsize, blocksize));
|
sfsp->f_bsize, blocksize));
|
||||||
}
|
}
|
||||||
(void)printf(" %5.0f%%",
|
xo_emit(" {:used-percent/%5.0f}{U:%%}",
|
||||||
availblks == 0 ? 100.0 : (double)used / (double)availblks * 100.0);
|
availblks == 0 ? 100.0 : (double)used / (double)availblks * 100.0);
|
||||||
if (iflag) {
|
if (iflag) {
|
||||||
inodes = sfsp->f_files;
|
inodes = sfsp->f_files;
|
||||||
used = inodes - sfsp->f_ffree;
|
used = inodes - sfsp->f_ffree;
|
||||||
if (hflag) {
|
if (hflag) {
|
||||||
(void)printf(" ");
|
xo_emit(" ");
|
||||||
prthumanvalinode(used);
|
prthumanvalinode(" {:inodes-used/%5s}", used);
|
||||||
prthumanvalinode(sfsp->f_ffree);
|
prthumanvalinode(" {:inodes-free/%5s}", sfsp->f_ffree);
|
||||||
} else {
|
} else {
|
||||||
if (thousands)
|
if (thousands)
|
||||||
format = " %*j'd %*j'd";
|
format = " {:inodes-used/%*j'd} {:inodes-free/%*j'd}";
|
||||||
else
|
else
|
||||||
format = " %*jd %*jd";
|
format = " {:inodes-used/%*jd} {:inodes-free/%*jd}";
|
||||||
(void)printf(format, mwp->iused, (intmax_t)used,
|
xo_emit(format, mwp->iused, (intmax_t)used,
|
||||||
mwp->ifree, (intmax_t)sfsp->f_ffree);
|
mwp->ifree, (intmax_t)sfsp->f_ffree);
|
||||||
}
|
}
|
||||||
(void)printf(" %4.0f%% ", inodes == 0 ? 100.0 :
|
xo_emit(" {:inodes-used-percent/%4.0f}{U:%%} ",
|
||||||
|
inodes == 0 ? 100.0 :
|
||||||
(double)used / (double)inodes * 100.0);
|
(double)used / (double)inodes * 100.0);
|
||||||
} else
|
} else
|
||||||
(void)printf(" ");
|
xo_emit(" ");
|
||||||
if (strncmp(sfsp->f_mntfromname, "total", MNAMELEN) != 0)
|
if (strncmp(sfsp->f_mntfromname, "total", MNAMELEN) != 0)
|
||||||
(void)printf(" %s", sfsp->f_mntonname);
|
xo_emit(" {:mounted-on}", sfsp->f_mntonname);
|
||||||
(void)printf("\n");
|
xo_emit("\n");
|
||||||
|
xo_close_instance("filesystem");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -564,7 +588,7 @@ static void
|
|||||||
usage(void)
|
usage(void)
|
||||||
{
|
{
|
||||||
|
|
||||||
(void)fprintf(stderr,
|
xo_error(
|
||||||
"usage: df [-b | -g | -H | -h | -k | -m | -P] [-acilnT] [-t type] [-,]\n"
|
"usage: df [-b | -g | -H | -h | -k | -m | -P] [-acilnT] [-t type] [-,]\n"
|
||||||
" [file | filesystem ...]\n");
|
" [file | filesystem ...]\n");
|
||||||
exit(EX_USAGE);
|
exit(EX_USAGE);
|
||||||
@@ -579,24 +603,24 @@ makenetvfslist(void)
|
|||||||
int cnt, i, maxvfsconf;
|
int cnt, i, maxvfsconf;
|
||||||
|
|
||||||
if (sysctlbyname("vfs.conflist", NULL, &buflen, NULL, 0) < 0) {
|
if (sysctlbyname("vfs.conflist", NULL, &buflen, NULL, 0) < 0) {
|
||||||
warn("sysctl(vfs.conflist)");
|
xo_warn("sysctl(vfs.conflist)");
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
xvfsp = malloc(buflen);
|
xvfsp = malloc(buflen);
|
||||||
if (xvfsp == NULL) {
|
if (xvfsp == NULL) {
|
||||||
warnx("malloc failed");
|
xo_warnx("malloc failed");
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
keep_xvfsp = xvfsp;
|
keep_xvfsp = xvfsp;
|
||||||
if (sysctlbyname("vfs.conflist", xvfsp, &buflen, NULL, 0) < 0) {
|
if (sysctlbyname("vfs.conflist", xvfsp, &buflen, NULL, 0) < 0) {
|
||||||
warn("sysctl(vfs.conflist)");
|
xo_warn("sysctl(vfs.conflist)");
|
||||||
free(keep_xvfsp);
|
free(keep_xvfsp);
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
maxvfsconf = buflen / sizeof(struct xvfsconf);
|
maxvfsconf = buflen / sizeof(struct xvfsconf);
|
||||||
|
|
||||||
if ((listptr = malloc(sizeof(char*) * maxvfsconf)) == NULL) {
|
if ((listptr = malloc(sizeof(char*) * maxvfsconf)) == NULL) {
|
||||||
warnx("malloc failed");
|
xo_warnx("malloc failed");
|
||||||
free(keep_xvfsp);
|
free(keep_xvfsp);
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
@@ -605,7 +629,7 @@ makenetvfslist(void)
|
|||||||
if (xvfsp->vfc_flags & VFCF_NETWORK) {
|
if (xvfsp->vfc_flags & VFCF_NETWORK) {
|
||||||
listptr[cnt++] = strdup(xvfsp->vfc_name);
|
listptr[cnt++] = strdup(xvfsp->vfc_name);
|
||||||
if (listptr[cnt-1] == NULL) {
|
if (listptr[cnt-1] == NULL) {
|
||||||
warnx("malloc failed");
|
xo_warnx("malloc failed");
|
||||||
free(listptr);
|
free(listptr);
|
||||||
free(keep_xvfsp);
|
free(keep_xvfsp);
|
||||||
return (NULL);
|
return (NULL);
|
||||||
@@ -617,7 +641,7 @@ makenetvfslist(void)
|
|||||||
if (cnt == 0 ||
|
if (cnt == 0 ||
|
||||||
(str = malloc(sizeof(char) * (32 * cnt + cnt + 2))) == NULL) {
|
(str = malloc(sizeof(char) * (32 * cnt + cnt + 2))) == NULL) {
|
||||||
if (cnt > 0)
|
if (cnt > 0)
|
||||||
warnx("malloc failed");
|
xo_warnx("malloc failed");
|
||||||
free(listptr);
|
free(listptr);
|
||||||
free(keep_xvfsp);
|
free(keep_xvfsp);
|
||||||
return (NULL);
|
return (NULL);
|
||||||
|
|||||||
+1
-1
@@ -237,7 +237,7 @@ expand_des_key(char *obuf, char *kbuf)
|
|||||||
/*
|
/*
|
||||||
* now translate it, bombing on any illegal hex digit
|
* now translate it, bombing on any illegal hex digit
|
||||||
*/
|
*/
|
||||||
for (i = 0; kbuf[i] && i < 16; i++)
|
for (i = 0; i < 16 && kbuf[i]; i++)
|
||||||
if ((nbuf[i] = hex_to_binary((int) kbuf[i], 16)) == -1)
|
if ((nbuf[i] = hex_to_binary((int) kbuf[i], 16)) == -1)
|
||||||
des_error("bad hex digit in key");
|
des_error("bad hex digit in key");
|
||||||
while (i < 16)
|
while (i < 16)
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ TAP_TESTS_SH+= pgrep-g_test
|
|||||||
TAP_TESTS_SH+= pgrep-i_test
|
TAP_TESTS_SH+= pgrep-i_test
|
||||||
TAP_TESTS_SH+= pgrep-j_test
|
TAP_TESTS_SH+= pgrep-j_test
|
||||||
TEST_METADATA.pgrep-j_test+= required_user="root"
|
TEST_METADATA.pgrep-j_test+= required_user="root"
|
||||||
|
TEST_METADATA.pgrep-j_test+= required_programs="jail jls"
|
||||||
TAP_TESTS_SH+= pgrep-l_test
|
TAP_TESTS_SH+= pgrep-l_test
|
||||||
TAP_TESTS_SH+= pgrep-n_test
|
TAP_TESTS_SH+= pgrep-n_test
|
||||||
TAP_TESTS_SH+= pgrep-o_test
|
TAP_TESTS_SH+= pgrep-o_test
|
||||||
@@ -31,6 +32,7 @@ TAP_TESTS_SH+= pkill-g_test
|
|||||||
TAP_TESTS_SH+= pkill-i_test
|
TAP_TESTS_SH+= pkill-i_test
|
||||||
TAP_TESTS_SH+= pkill-j_test
|
TAP_TESTS_SH+= pkill-j_test
|
||||||
TEST_METADATA.pkill-j_test+= required_user="root"
|
TEST_METADATA.pkill-j_test+= required_user="root"
|
||||||
|
TEST_METADATA.pkill-j_test+= required_programs="jail jls"
|
||||||
TAP_TESTS_SH+= pkill-s_test
|
TAP_TESTS_SH+= pkill-s_test
|
||||||
TAP_TESTS_SH+= pkill-t_test
|
TAP_TESTS_SH+= pkill-t_test
|
||||||
TAP_TESTS_SH+= pkill-x_test
|
TAP_TESTS_SH+= pkill-x_test
|
||||||
|
|||||||
@@ -1,7 +1,23 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# $FreeBSD$
|
# $FreeBSD$
|
||||||
|
|
||||||
base=`basename $0`
|
jail_name_to_jid()
|
||||||
|
{
|
||||||
|
local check_name="$1"
|
||||||
|
(
|
||||||
|
line="$(jls -n 2> /dev/null | grep name=$check_name )"
|
||||||
|
for nv in $line; do
|
||||||
|
local name="${nv%=*}"
|
||||||
|
if [ "${name}" = "jid" ]; then
|
||||||
|
eval $nv
|
||||||
|
echo $jid
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
base=pgrep_j_test
|
||||||
|
|
||||||
echo "1..3"
|
echo "1..3"
|
||||||
|
|
||||||
@@ -9,21 +25,25 @@ name="pgrep -j <jid>"
|
|||||||
if [ `id -u` -eq 0 ]; then
|
if [ `id -u` -eq 0 ]; then
|
||||||
sleep=$(pwd)/sleep.txt
|
sleep=$(pwd)/sleep.txt
|
||||||
ln -sf /bin/sleep $sleep
|
ln -sf /bin/sleep $sleep
|
||||||
jail / $base-1 127.0.0.1 $sleep 5 &
|
jail -c path=/ name=${base}_1_1 ip4.addr=127.0.0.1 \
|
||||||
chpid=$!
|
command=daemon -p ${PWD}/${base}_1_1.pid $sleep 5 &
|
||||||
jail / $base-2 127.0.0.1 $sleep 5 &
|
|
||||||
chpid2=$!
|
jail -c path=/ name=${base}_1_2 ip4.addr=127.0.0.1 \
|
||||||
$sleep 5 &
|
command=daemon -p ${PWD}/${base}_1_2.pid $sleep 5 &
|
||||||
chpid3=$!
|
|
||||||
sleep 0.5
|
jid1=$(jail_name_to_jid ${base}_1_1)
|
||||||
jid=`jls | awk "/127\\.0\\.0\\.1.*${base}-1/ {print \$1}"`
|
jid2=$(jail_name_to_jid ${base}_1_2)
|
||||||
pid=`pgrep -f -j $jid $sleep`
|
jid="${jid1},${jid2}"
|
||||||
if [ "$pid" = "$chpid" ]; then
|
pid1="$(pgrep -f -x -j $jid "$sleep 5" | sort)"
|
||||||
|
pid2=$(printf "%s\n%s" "$(cat ${PWD}/${base}_1_1.pid)" \
|
||||||
|
$(cat ${PWD}/${base}_1_2.pid) | sort)
|
||||||
|
if [ "$pid1" = "$pid2" ]; then
|
||||||
echo "ok 1 - $name"
|
echo "ok 1 - $name"
|
||||||
else
|
else
|
||||||
echo "not ok 1 - $name"
|
echo "not ok 1 - $name"
|
||||||
fi
|
fi
|
||||||
kill $chpid $chpid2 $chpid3
|
[ -f ${PWD}/${base}_1_1.pid ] && kill $(cat ${PWD}/${base}_1_1.pid)
|
||||||
|
[ -f ${PWD}/${base}_1_2.pid ] && kill $(cat ${PWD}/${base}_1_2.pid)
|
||||||
rm -f $sleep
|
rm -f $sleep
|
||||||
else
|
else
|
||||||
echo "ok 1 - $name # skip Test needs uid 0."
|
echo "ok 1 - $name # skip Test needs uid 0."
|
||||||
@@ -33,21 +53,23 @@ name="pgrep -j any"
|
|||||||
if [ `id -u` -eq 0 ]; then
|
if [ `id -u` -eq 0 ]; then
|
||||||
sleep=$(pwd)/sleep.txt
|
sleep=$(pwd)/sleep.txt
|
||||||
ln -sf /bin/sleep $sleep
|
ln -sf /bin/sleep $sleep
|
||||||
jail / $base-1 127.0.0.1 $sleep 5 &
|
jail -c path=/ name=${base}_2_1 ip4.addr=127.0.0.1 \
|
||||||
chpid=$!
|
command=daemon -p ${PWD}/${base}_2_1.pid $sleep 5 &
|
||||||
jail / $base-2 127.0.0.1 $sleep 5 &
|
|
||||||
chpid2=$!
|
jail -c path=/ name=${base}_2_2 ip4.addr=127.0.0.1 \
|
||||||
$sleep 5 &
|
command=daemon -p ${PWD}/${base}_2_2.pid $sleep 5 &
|
||||||
chpid3=$!
|
|
||||||
sleep 0.5
|
sleep 2
|
||||||
pids=`pgrep -f -j any $sleep | sort`
|
pid1="$(pgrep -f -x -j any "$sleep 5" | sort)"
|
||||||
refpids=`{ echo $chpid; echo $chpid2; } | sort`
|
pid2=$(printf "%s\n%s" "$(cat ${PWD}/${base}_2_1.pid)" \
|
||||||
if [ "$pids" = "$refpids" ]; then
|
$(cat ${PWD}/${base}_2_2.pid) | sort)
|
||||||
|
if [ "$pid1" = "$pid2" ]; then
|
||||||
echo "ok 2 - $name"
|
echo "ok 2 - $name"
|
||||||
else
|
else
|
||||||
echo "not ok 2 - $name"
|
echo "not ok 2 - $name"
|
||||||
fi
|
fi
|
||||||
kill $chpid $chpid2 $chpid3
|
[ -f ${PWD}/${base}_2_1.pid ] && kill $(cat ${PWD}/${base}_2_1.pid)
|
||||||
|
[ -f ${PWD}/${base}_2_2.pid ] && kill $(cat ${PWD}/${base}_2_2.pid)
|
||||||
rm -f $sleep
|
rm -f $sleep
|
||||||
else
|
else
|
||||||
echo "ok 2 - $name # skip Test needs uid 0."
|
echo "ok 2 - $name # skip Test needs uid 0."
|
||||||
@@ -57,19 +79,19 @@ name="pgrep -j none"
|
|||||||
if [ `id -u` -eq 0 ]; then
|
if [ `id -u` -eq 0 ]; then
|
||||||
sleep=$(pwd)/sleep.txt
|
sleep=$(pwd)/sleep.txt
|
||||||
ln -sf /bin/sleep $sleep
|
ln -sf /bin/sleep $sleep
|
||||||
$sleep 5 &
|
daemon -p ${PWD}/${base}_3_1.pid $sleep 5 &
|
||||||
chpid=$!
|
jail -c path=/ name=${base}_3_2 ip4.addr=127.0.0.1 \
|
||||||
jail / $base 127.0.0.1 $sleep 5 &
|
command=daemon -p ${PWD}/${base}_3_2.pid $sleep 5 &
|
||||||
chpid2=$!
|
sleep 2
|
||||||
sleep 0.5
|
pid="$(pgrep -f -x -j none "$sleep 5")"
|
||||||
pid=`pgrep -f -j none $sleep`
|
if [ "$pid" = "$(cat ${PWD}/${base}_3_1.pid)" ]; then
|
||||||
if [ "$pid" = "$chpid" ]; then
|
|
||||||
echo "ok 3 - $name"
|
echo "ok 3 - $name"
|
||||||
else
|
else
|
||||||
echo "not ok 3 - $name"
|
echo "not ok 3 - $name"
|
||||||
fi
|
fi
|
||||||
kill $chpid $chpid2
|
|
||||||
rm -f $sleep
|
rm -f $sleep
|
||||||
|
[ -f ${PWD}/${base}_3_1.pid ] && kill $(cat $PWD/${base}_3_1.pid)
|
||||||
|
[ -f ${PWD}/${base}_3_2.pid ] && kill $(cat $PWD/${base}_3_2.pid)
|
||||||
else
|
else
|
||||||
echo "ok 3 - $name # skip Test needs uid 0."
|
echo "ok 3 - $name # skip Test needs uid 0."
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -1,7 +1,23 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# $FreeBSD$
|
# $FreeBSD$
|
||||||
|
|
||||||
base=`basename $0`
|
jail_name_to_jid()
|
||||||
|
{
|
||||||
|
local check_name="$1"
|
||||||
|
(
|
||||||
|
line="$(jls -n 2> /dev/null | grep name=$check_name )"
|
||||||
|
for nv in $line; do
|
||||||
|
local name="${nv%=*}"
|
||||||
|
if [ "${name}" = "jid" ]; then
|
||||||
|
eval $nv
|
||||||
|
echo $jid
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
base=pkill_j_test
|
||||||
|
|
||||||
echo "1..3"
|
echo "1..3"
|
||||||
|
|
||||||
@@ -9,21 +25,28 @@ name="pkill -j <jid>"
|
|||||||
if [ `id -u` -eq 0 ]; then
|
if [ `id -u` -eq 0 ]; then
|
||||||
sleep=$(pwd)/sleep.txt
|
sleep=$(pwd)/sleep.txt
|
||||||
ln -sf /bin/sleep $sleep
|
ln -sf /bin/sleep $sleep
|
||||||
jail / $base-1 127.0.0.1 $sleep 5 &
|
jail -c path=/ name=${base}_1_1 ip4.addr=127.0.0.1 \
|
||||||
chpid=$!
|
command=daemon -p ${PWD}/${base}_1_1.pid $sleep 5 &
|
||||||
jail / $base-2 127.0.0.1 $sleep 5 &
|
|
||||||
chpid2=$!
|
jail -c path=/ name=${base}_1_2 ip4.addr=127.0.0.1 \
|
||||||
|
command=daemon -p ${PWD}/${base}_1_2.pid $sleep 5 &
|
||||||
|
|
||||||
$sleep 5 &
|
$sleep 5 &
|
||||||
chpid3=$!
|
|
||||||
sleep 0.5
|
sleep 0.5
|
||||||
jid=`jls | awk "/127\\.0\\.0\\.1.*${base}-1/ {print \$1}"`
|
jid1=$(jail_name_to_jid ${base}_1_1)
|
||||||
if pkill -f -j $jid $sleep && sleep 0.5 &&
|
jid2=$(jail_name_to_jid ${base}_1_2)
|
||||||
! kill $chpid && kill $chpid2 $chpid3; then
|
jid="${jid1},${jid2}"
|
||||||
|
if pkill -f -j "$jid" $sleep && sleep 0.5 &&
|
||||||
|
! -f ${PWD}/${base}_1_1.pid &&
|
||||||
|
! -f ${PWD}/${base}_1_2.pid ; then
|
||||||
echo "ok 1 - $name"
|
echo "ok 1 - $name"
|
||||||
else
|
else
|
||||||
echo "not ok 1 - $name"
|
echo "not ok 1 - $name"
|
||||||
fi 2>/dev/null
|
fi 2>/dev/null
|
||||||
rm -f $sleep
|
rm -f $sleep
|
||||||
|
[ -f ${PWD}/${base}_1_1.pid ] && kill $(cat ${PWD}/${base}_1_1.pid)
|
||||||
|
[ -f ${PWD}/${base}_1_2.pid ] && kill $(cat ${PWD}/${base}_1_2.pid)
|
||||||
|
wait
|
||||||
else
|
else
|
||||||
echo "ok 1 - $name # skip Test needs uid 0."
|
echo "ok 1 - $name # skip Test needs uid 0."
|
||||||
fi
|
fi
|
||||||
@@ -32,20 +55,26 @@ name="pkill -j any"
|
|||||||
if [ `id -u` -eq 0 ]; then
|
if [ `id -u` -eq 0 ]; then
|
||||||
sleep=$(pwd)/sleep.txt
|
sleep=$(pwd)/sleep.txt
|
||||||
ln -sf /bin/sleep $sleep
|
ln -sf /bin/sleep $sleep
|
||||||
jail / $base-1 127.0.0.1 $sleep 5 &
|
jail -c path=/ name=${base}_2_1 ip4.addr=127.0.0.1 \
|
||||||
chpid=$!
|
command=daemon -p ${PWD}/${base}_2_1.pid $sleep 5 &
|
||||||
jail / $base-2 127.0.0.1 $sleep 5 &
|
|
||||||
chpid2=$!
|
jail -c path=/ name=${base}_2_2 ip4.addr=127.0.0.1 \
|
||||||
|
command=daemon -p ${PWD}/${base}_2_2.pid $sleep 5 &
|
||||||
|
|
||||||
$sleep 5 &
|
$sleep 5 &
|
||||||
chpid3=$!
|
|
||||||
sleep 0.5
|
sleep 0.5
|
||||||
|
chpid3=$!
|
||||||
if pkill -f -j any $sleep && sleep 0.5 &&
|
if pkill -f -j any $sleep && sleep 0.5 &&
|
||||||
! kill $chpid && ! kill $chpid2 && kill $chpid3; then
|
[ ! -f ${PWD}/${base}_2_1.pid -a
|
||||||
|
! -f ${PWD}/${base}_2_2.pid ] && kill $chpid3; then
|
||||||
echo "ok 2 - $name"
|
echo "ok 2 - $name"
|
||||||
else
|
else
|
||||||
echo "not ok 2 - $name"
|
echo "not ok 2 - $name"
|
||||||
fi 2>/dev/null
|
fi 2>/dev/null
|
||||||
rm -f $sleep
|
rm -f $sleep
|
||||||
|
[ -f ${PWD}/${base}_2_1.pid ] && kill $(cat ${PWD}/${base}_2_1.pid)
|
||||||
|
[ -f ${PWD}/${base}_2_2.pid ] && kill $(cat ${PWD}/${base}_2_2.pid)
|
||||||
|
wait
|
||||||
else
|
else
|
||||||
echo "ok 2 - $name # skip Test needs uid 0."
|
echo "ok 2 - $name # skip Test needs uid 0."
|
||||||
fi
|
fi
|
||||||
@@ -54,18 +83,20 @@ name="pkill -j none"
|
|||||||
if [ `id -u` -eq 0 ]; then
|
if [ `id -u` -eq 0 ]; then
|
||||||
sleep=$(pwd)/sleep.txt
|
sleep=$(pwd)/sleep.txt
|
||||||
ln -sf /bin/sleep $sleep
|
ln -sf /bin/sleep $sleep
|
||||||
$sleep 5 &
|
daemon -p ${PWD}/${base}_3_1.pid $sleep 5
|
||||||
chpid=$!
|
jail -c path=/ name=${base}_3_2 ip4.addr=127.0.0.1 \
|
||||||
jail / $base 127.0.0.1 $sleep 5 &
|
command=daemon -p ${PWD}/${base}_3_2.pid $sleep 5 &
|
||||||
chpid2=$!
|
sleep 1
|
||||||
sleep 0.5
|
if pkill -f -j none "$sleep 5" && sleep 1 &&
|
||||||
if pkill -f -j none $sleep && sleep 0.5 &&
|
[ ! -f ${PWD}/${base}_3_1.pid -a -f ${PWD}/${base}_3_2.pid ] ; then
|
||||||
! kill $chpid && kill $chpid2; then
|
|
||||||
echo "ok 3 - $name"
|
echo "ok 3 - $name"
|
||||||
else
|
else
|
||||||
|
ls ${PWD}/*.pid
|
||||||
echo "not ok 3 - $name"
|
echo "not ok 3 - $name"
|
||||||
fi 2>/dev/null
|
fi 2>/dev/null
|
||||||
rm -f $sleep
|
rm -f $sleep
|
||||||
|
[ -f ${PWD}/${base}_3_1.pid ] && kill $(cat ${base}_3_1.pid)
|
||||||
|
[ -f ${PWD}/${base}_3_2.pid ] && kill $(cat ${base}_3_2.pid)
|
||||||
else
|
else
|
||||||
echo "ok 3 - $name # skip Test needs uid 0."
|
echo "ok 3 - $name # skip Test needs uid 0."
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -157,6 +157,7 @@ static VAR var[] = {
|
|||||||
{"tdnam", "TDNAM", NULL, LJUST, tdnam, 0, CHAR, NULL, 0},
|
{"tdnam", "TDNAM", NULL, LJUST, tdnam, 0, CHAR, NULL, 0},
|
||||||
{"time", "TIME", NULL, USER, cputime, 0, CHAR, NULL, 0},
|
{"time", "TIME", NULL, USER, cputime, 0, CHAR, NULL, 0},
|
||||||
{"tpgid", "TPGID", NULL, 0, kvar, KOFF(ki_tpgid), UINT, PIDFMT, 0},
|
{"tpgid", "TPGID", NULL, 0, kvar, KOFF(ki_tpgid), UINT, PIDFMT, 0},
|
||||||
|
{"tracer", "TRACER", NULL, 0, kvar, KOFF(ki_tracer), UINT, PIDFMT, 0},
|
||||||
{"tsid", "TSID", NULL, 0, kvar, KOFF(ki_tsid), UINT, PIDFMT, 0},
|
{"tsid", "TSID", NULL, 0, kvar, KOFF(ki_tsid), UINT, PIDFMT, 0},
|
||||||
{"tsiz", "TSIZ", NULL, 0, kvar, KOFF(ki_tsize), PGTOK, "ld", 0},
|
{"tsiz", "TSIZ", NULL, 0, kvar, KOFF(ki_tsize), PGTOK, "ld", 0},
|
||||||
{"tt", "TT ", NULL, 0, tname, 0, CHAR, NULL, 0},
|
{"tt", "TT ", NULL, 0, tname, 0, CHAR, NULL, 0},
|
||||||
|
|||||||
+3
-2
@@ -29,7 +29,7 @@
|
|||||||
.\" @(#)ps.1 8.3 (Berkeley) 4/18/94
|
.\" @(#)ps.1 8.3 (Berkeley) 4/18/94
|
||||||
.\" $FreeBSD$
|
.\" $FreeBSD$
|
||||||
.\"
|
.\"
|
||||||
.Dd June 6, 2014
|
.Dd August 27, 2014
|
||||||
.Dt PS 1
|
.Dt PS 1
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
@@ -332,7 +332,6 @@ the include file
|
|||||||
.It Dv "P_SINGLE_BOUNDARY" Ta No "0x400000" Ta "Threads should suspend at user boundary"
|
.It Dv "P_SINGLE_BOUNDARY" Ta No "0x400000" Ta "Threads should suspend at user boundary"
|
||||||
.It Dv "P_HWPMC" Ta No "0x800000" Ta "Process is using HWPMCs"
|
.It Dv "P_HWPMC" Ta No "0x800000" Ta "Process is using HWPMCs"
|
||||||
.It Dv "P_JAILED" Ta No "0x1000000" Ta "Process is in jail"
|
.It Dv "P_JAILED" Ta No "0x1000000" Ta "Process is in jail"
|
||||||
.It Dv "P_ORPHAN" Ta No "0x2000000" Ta "Orphaned by original parent, reparented to debugger"
|
|
||||||
.It Dv "P_INEXEC" Ta No "0x4000000" Ta "Process is in execve()"
|
.It Dv "P_INEXEC" Ta No "0x4000000" Ta "Process is in execve()"
|
||||||
.It Dv "P_STATCHILD" Ta No "0x8000000" Ta "Child process stopped or exited"
|
.It Dv "P_STATCHILD" Ta No "0x8000000" Ta "Child process stopped or exited"
|
||||||
.It Dv "P_INMEM" Ta No "0x10000000" Ta "Loaded into memory"
|
.It Dv "P_INMEM" Ta No "0x10000000" Ta "Loaded into memory"
|
||||||
@@ -666,6 +665,8 @@ accumulated CPU time, user + system (alias
|
|||||||
.Cm cputime )
|
.Cm cputime )
|
||||||
.It Cm tpgid
|
.It Cm tpgid
|
||||||
control terminal process group ID
|
control terminal process group ID
|
||||||
|
.It Cm tracer
|
||||||
|
tracer process ID
|
||||||
.\".It Cm trss
|
.\".It Cm trss
|
||||||
.\"text resident set size (in Kbytes)
|
.\"text resident set size (in Kbytes)
|
||||||
.It Cm tsid
|
.It Cm tsid
|
||||||
|
|||||||
@@ -14,8 +14,6 @@ MAN= rmail.8
|
|||||||
WARNS?= 2
|
WARNS?= 2
|
||||||
CFLAGS+=-I${SENDMAIL_DIR}/include -I.
|
CFLAGS+=-I${SENDMAIL_DIR}/include -I.
|
||||||
|
|
||||||
NO_PIE= yes
|
|
||||||
|
|
||||||
LIBSMDIR= ${.OBJDIR}/../../lib/libsm
|
LIBSMDIR= ${.OBJDIR}/../../lib/libsm
|
||||||
LIBSM= ${LIBSMDIR}/libsm.a
|
LIBSM= ${LIBSMDIR}/libsm.a
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -139,9 +139,9 @@ static arith_t do_binop(int op, arith_t a, arith_t b)
|
|||||||
case ARITH_SUB:
|
case ARITH_SUB:
|
||||||
return (uintmax_t)a - (uintmax_t)b;
|
return (uintmax_t)a - (uintmax_t)b;
|
||||||
case ARITH_LSHIFT:
|
case ARITH_LSHIFT:
|
||||||
return (uintmax_t)a << b;
|
return (uintmax_t)a << (b & (sizeof(uintmax_t) * CHAR_BIT - 1));
|
||||||
case ARITH_RSHIFT:
|
case ARITH_RSHIFT:
|
||||||
return a >> b;
|
return a >> (b & (sizeof(uintmax_t) * CHAR_BIT - 1));
|
||||||
case ARITH_LT:
|
case ARITH_LT:
|
||||||
return a < b;
|
return a < b;
|
||||||
case ARITH_LE:
|
case ARITH_LE:
|
||||||
|
|||||||
+7
-6
@@ -168,6 +168,8 @@ evalstring(char *s, int flags)
|
|||||||
else
|
else
|
||||||
evaltree(n, flags);
|
evaltree(n, flags);
|
||||||
any = 1;
|
any = 1;
|
||||||
|
if (evalskip)
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
popstackmark(&smark);
|
popstackmark(&smark);
|
||||||
setstackmark(&smark);
|
setstackmark(&smark);
|
||||||
@@ -316,9 +318,10 @@ evalloop(union node *n, int flags)
|
|||||||
loopnest++;
|
loopnest++;
|
||||||
status = 0;
|
status = 0;
|
||||||
for (;;) {
|
for (;;) {
|
||||||
|
if (!evalskip)
|
||||||
evaltree(n->nbinary.ch1, EV_TESTED);
|
evaltree(n->nbinary.ch1, EV_TESTED);
|
||||||
if (evalskip) {
|
if (evalskip) {
|
||||||
skipping: if (evalskip == SKIPCONT && --skipcount <= 0) {
|
if (evalskip == SKIPCONT && --skipcount <= 0) {
|
||||||
evalskip = 0;
|
evalskip = 0;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -337,8 +340,6 @@ skipping: if (evalskip == SKIPCONT && --skipcount <= 0) {
|
|||||||
}
|
}
|
||||||
evaltree(n->nbinary.ch2, flags);
|
evaltree(n->nbinary.ch2, flags);
|
||||||
status = exitstatus;
|
status = exitstatus;
|
||||||
if (evalskip)
|
|
||||||
goto skipping;
|
|
||||||
}
|
}
|
||||||
loopnest--;
|
loopnest--;
|
||||||
exitstatus = status;
|
exitstatus = status;
|
||||||
@@ -648,15 +649,15 @@ evalbackcmd(union node *n, struct backcmd *result)
|
|||||||
struct jmploc *savehandler;
|
struct jmploc *savehandler;
|
||||||
struct localvar *savelocalvars;
|
struct localvar *savelocalvars;
|
||||||
|
|
||||||
setstackmark(&smark);
|
|
||||||
result->fd = -1;
|
result->fd = -1;
|
||||||
result->buf = NULL;
|
result->buf = NULL;
|
||||||
result->nleft = 0;
|
result->nleft = 0;
|
||||||
result->jp = NULL;
|
result->jp = NULL;
|
||||||
if (n == NULL) {
|
if (n == NULL) {
|
||||||
exitstatus = 0;
|
exitstatus = 0;
|
||||||
goto out;
|
return;
|
||||||
}
|
}
|
||||||
|
setstackmark(&smark);
|
||||||
exitstatus = oexitstatus;
|
exitstatus = oexitstatus;
|
||||||
if (is_valid_fast_cmdsubst(n)) {
|
if (is_valid_fast_cmdsubst(n)) {
|
||||||
savelocalvars = localvars;
|
savelocalvars = localvars;
|
||||||
@@ -698,7 +699,6 @@ evalbackcmd(union node *n, struct backcmd *result)
|
|||||||
result->fd = pip[0];
|
result->fd = pip[0];
|
||||||
result->jp = jp;
|
result->jp = jp;
|
||||||
}
|
}
|
||||||
out:
|
|
||||||
popstackmark(&smark);
|
popstackmark(&smark);
|
||||||
TRACE(("evalbackcmd done: fd=%d buf=%p nleft=%d jp=%p\n",
|
TRACE(("evalbackcmd done: fd=%d buf=%p nleft=%d jp=%p\n",
|
||||||
result->fd, result->buf, result->nleft, result->jp));
|
result->fd, result->buf, result->nleft, result->jp));
|
||||||
@@ -1039,6 +1039,7 @@ evalcommand(union node *cmd, int flags, struct backcmd *backcmd)
|
|||||||
shellparam.reset = 1;
|
shellparam.reset = 1;
|
||||||
shellparam.nparam = argc - 1;
|
shellparam.nparam = argc - 1;
|
||||||
shellparam.p = argv + 1;
|
shellparam.p = argv + 1;
|
||||||
|
shellparam.optp = NULL;
|
||||||
shellparam.optnext = NULL;
|
shellparam.optnext = NULL;
|
||||||
INTOFF;
|
INTOFF;
|
||||||
savelocalvars = localvars;
|
savelocalvars = localvars;
|
||||||
|
|||||||
+32
-36
@@ -328,24 +328,19 @@ exptilde(char *p, int flag)
|
|||||||
done:
|
done:
|
||||||
*p = '\0';
|
*p = '\0';
|
||||||
if (*(startp+1) == '\0') {
|
if (*(startp+1) == '\0') {
|
||||||
if ((home = lookupvar("HOME")) == NULL)
|
home = lookupvar("HOME");
|
||||||
goto lose;
|
|
||||||
} else {
|
} else {
|
||||||
if ((pw = getpwnam(startp+1)) == NULL)
|
pw = getpwnam(startp+1);
|
||||||
goto lose;
|
home = pw != NULL ? pw->pw_dir : NULL;
|
||||||
home = pw->pw_dir;
|
|
||||||
}
|
}
|
||||||
if (*home == '\0')
|
|
||||||
goto lose;
|
|
||||||
*p = c;
|
*p = c;
|
||||||
|
if (home == NULL || *home == '\0')
|
||||||
|
return (startp);
|
||||||
if (quotes)
|
if (quotes)
|
||||||
STPUTS_QUOTES(home, SQSYNTAX, expdest);
|
STPUTS_QUOTES(home, SQSYNTAX, expdest);
|
||||||
else
|
else
|
||||||
STPUTS(home, expdest);
|
STPUTS(home, expdest);
|
||||||
return (p);
|
return (p);
|
||||||
lose:
|
|
||||||
*p = c;
|
|
||||||
return (startp);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -867,7 +862,7 @@ varisset(const char *name, int nulok)
|
|||||||
static void
|
static void
|
||||||
strtodest(const char *p, int flag, int subtype, int quoted)
|
strtodest(const char *p, int flag, int subtype, int quoted)
|
||||||
{
|
{
|
||||||
if (flag & (EXP_FULL | EXP_CASE) && subtype != VSLENGTH)
|
if (flag & (EXP_FULL | EXP_CASE | EXP_REDIR) && subtype != VSLENGTH)
|
||||||
STPUTS_QUOTES(p, quoted ? DQSYNTAX : BASESYNTAX, expdest);
|
STPUTS_QUOTES(p, quoted ? DQSYNTAX : BASESYNTAX, expdest);
|
||||||
else
|
else
|
||||||
STPUTS(p, expdest);
|
STPUTS(p, expdest);
|
||||||
@@ -883,30 +878,28 @@ varvalue(const char *name, int quoted, int subtype, int flag)
|
|||||||
int num;
|
int num;
|
||||||
char *p;
|
char *p;
|
||||||
int i;
|
int i;
|
||||||
char sep;
|
char sep[2];
|
||||||
char **ap;
|
char **ap;
|
||||||
|
|
||||||
switch (*name) {
|
switch (*name) {
|
||||||
case '$':
|
case '$':
|
||||||
num = rootpid;
|
num = rootpid;
|
||||||
goto numvar;
|
break;
|
||||||
case '?':
|
case '?':
|
||||||
num = oexitstatus;
|
num = oexitstatus;
|
||||||
goto numvar;
|
break;
|
||||||
case '#':
|
case '#':
|
||||||
num = shellparam.nparam;
|
num = shellparam.nparam;
|
||||||
goto numvar;
|
break;
|
||||||
case '!':
|
case '!':
|
||||||
num = backgndpidval();
|
num = backgndpidval();
|
||||||
numvar:
|
|
||||||
expdest = cvtnum(num, expdest);
|
|
||||||
break;
|
break;
|
||||||
case '-':
|
case '-':
|
||||||
for (i = 0 ; i < NOPTS ; i++) {
|
for (i = 0 ; i < NOPTS ; i++) {
|
||||||
if (optlist[i].val)
|
if (optlist[i].val)
|
||||||
STPUTC(optlist[i].letter, expdest);
|
STPUTC(optlist[i].letter, expdest);
|
||||||
}
|
}
|
||||||
break;
|
return;
|
||||||
case '@':
|
case '@':
|
||||||
if (flag & EXP_FULL && quoted) {
|
if (flag & EXP_FULL && quoted) {
|
||||||
for (ap = shellparam.p ; (p = *ap++) != NULL ; ) {
|
for (ap = shellparam.p ; (p = *ap++) != NULL ; ) {
|
||||||
@@ -914,22 +907,25 @@ varvalue(const char *name, int quoted, int subtype, int flag)
|
|||||||
if (*ap)
|
if (*ap)
|
||||||
STPUTC('\0', expdest);
|
STPUTC('\0', expdest);
|
||||||
}
|
}
|
||||||
break;
|
return;
|
||||||
}
|
}
|
||||||
/* FALLTHROUGH */
|
/* FALLTHROUGH */
|
||||||
case '*':
|
case '*':
|
||||||
if (ifsset())
|
if (ifsset())
|
||||||
sep = ifsval()[0];
|
sep[0] = ifsval()[0];
|
||||||
else
|
else
|
||||||
sep = ' ';
|
sep[0] = ' ';
|
||||||
|
sep[1] = '\0';
|
||||||
for (ap = shellparam.p ; (p = *ap++) != NULL ; ) {
|
for (ap = shellparam.p ; (p = *ap++) != NULL ; ) {
|
||||||
strtodest(p, flag, subtype, quoted);
|
strtodest(p, flag, subtype, quoted);
|
||||||
if (!*ap)
|
if (!*ap)
|
||||||
break;
|
break;
|
||||||
if (sep || (flag & EXP_FULL && !quoted && **ap != '\0'))
|
if (sep[0])
|
||||||
STPUTC(sep, expdest);
|
strtodest(sep, flag, subtype, quoted);
|
||||||
|
else if (flag & EXP_FULL && !quoted && **ap != '\0')
|
||||||
|
STPUTC('\0', expdest);
|
||||||
}
|
}
|
||||||
break;
|
return;
|
||||||
default:
|
default:
|
||||||
if (is_digit(*name)) {
|
if (is_digit(*name)) {
|
||||||
num = atoi(name);
|
num = atoi(name);
|
||||||
@@ -938,11 +934,12 @@ varvalue(const char *name, int quoted, int subtype, int flag)
|
|||||||
else if (num > 0 && num <= shellparam.nparam)
|
else if (num > 0 && num <= shellparam.nparam)
|
||||||
p = shellparam.p[num - 1];
|
p = shellparam.p[num - 1];
|
||||||
else
|
else
|
||||||
break;
|
return;
|
||||||
strtodest(p, flag, subtype, quoted);
|
strtodest(p, flag, subtype, quoted);
|
||||||
}
|
}
|
||||||
break;
|
return;
|
||||||
}
|
}
|
||||||
|
expdest = cvtnum(num, expdest);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1110,24 +1107,23 @@ expandmeta(struct strlist *str, int flag __unused)
|
|||||||
/* TODO - EXP_REDIR */
|
/* TODO - EXP_REDIR */
|
||||||
|
|
||||||
while (str) {
|
while (str) {
|
||||||
if (fflag)
|
|
||||||
goto nometa;
|
|
||||||
p = str->text;
|
|
||||||
for (;;) { /* fast check for meta chars */
|
|
||||||
if ((c = *p++) == '\0')
|
|
||||||
goto nometa;
|
|
||||||
if (c == '*' || c == '?' || c == '[')
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
savelastp = exparg.lastp;
|
savelastp = exparg.lastp;
|
||||||
|
if (!fflag) {
|
||||||
|
p = str->text;
|
||||||
|
for (; (c = *p) != '\0'; p++) {
|
||||||
|
/* fast check for meta chars */
|
||||||
|
if (c == '*' || c == '?' || c == '[') {
|
||||||
INTOFF;
|
INTOFF;
|
||||||
expmeta(expdir, str->text);
|
expmeta(expdir, str->text);
|
||||||
INTON;
|
INTON;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
if (exparg.lastp == savelastp) {
|
if (exparg.lastp == savelastp) {
|
||||||
/*
|
/*
|
||||||
* no matches
|
* no matches
|
||||||
*/
|
*/
|
||||||
nometa:
|
|
||||||
*exparg.lastp = str;
|
*exparg.lastp = str;
|
||||||
rmescapes(str->text);
|
rmescapes(str->text);
|
||||||
exparg.lastp = &str->next;
|
exparg.lastp = &str->next;
|
||||||
|
|||||||
+3
-2
@@ -166,9 +166,10 @@ sethistsize(const char *hs)
|
|||||||
HistEvent he;
|
HistEvent he;
|
||||||
|
|
||||||
if (hist != NULL) {
|
if (hist != NULL) {
|
||||||
if (hs == NULL || *hs == '\0' ||
|
if (hs == NULL || !is_number(hs))
|
||||||
(histsize = atoi(hs)) < 0)
|
|
||||||
histsize = 100;
|
histsize = 100;
|
||||||
|
else
|
||||||
|
histsize = atoi(hs);
|
||||||
history(hist, &he, H_SETSIZE, histsize);
|
history(hist, &he, H_SETSIZE, histsize);
|
||||||
history(hist, &he, H_SETUNIQUE, 1);
|
history(hist, &he, H_SETUNIQUE, 1);
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-28
@@ -116,33 +116,6 @@ resetinput(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Read a line from the script.
|
|
||||||
*/
|
|
||||||
|
|
||||||
char *
|
|
||||||
pfgets(char *line, int len)
|
|
||||||
{
|
|
||||||
char *p = line;
|
|
||||||
int nleft = len;
|
|
||||||
int c;
|
|
||||||
|
|
||||||
while (--nleft > 0) {
|
|
||||||
c = pgetc_macro();
|
|
||||||
if (c == PEOF) {
|
|
||||||
if (p == line)
|
|
||||||
return NULL;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
*p++ = c;
|
|
||||||
if (c == '\n')
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
*p = '\0';
|
|
||||||
return line;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Read a character from the script, returning PEOF on end of file.
|
* Read a character from the script, returning PEOF on end of file.
|
||||||
@@ -338,7 +311,7 @@ pungetc(void)
|
|||||||
* We handle aliases this way.
|
* We handle aliases this way.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
pushstring(char *s, int len, struct alias *ap)
|
pushstring(const char *s, int len, struct alias *ap)
|
||||||
{
|
{
|
||||||
struct strpush *sp;
|
struct strpush *sp;
|
||||||
|
|
||||||
|
|||||||
+1
-2
@@ -48,12 +48,11 @@ struct alias;
|
|||||||
struct parsefile;
|
struct parsefile;
|
||||||
|
|
||||||
void resetinput(void);
|
void resetinput(void);
|
||||||
char *pfgets(char *, int);
|
|
||||||
int pgetc(void);
|
int pgetc(void);
|
||||||
int preadbuffer(void);
|
int preadbuffer(void);
|
||||||
int preadateof(void);
|
int preadateof(void);
|
||||||
void pungetc(void);
|
void pungetc(void);
|
||||||
void pushstring(char *, int, struct alias *);
|
void pushstring(const char *, int, struct alias *);
|
||||||
void setinputfile(const char *, int);
|
void setinputfile(const char *, int);
|
||||||
void setinputfd(int, int);
|
void setinputfd(int, int);
|
||||||
void setinputstring(const char *, int);
|
void setinputstring(const char *, int);
|
||||||
|
|||||||
+97
-54
@@ -118,6 +118,24 @@ static void showjob(struct job *, int);
|
|||||||
static int jobctl;
|
static int jobctl;
|
||||||
|
|
||||||
#if JOBS
|
#if JOBS
|
||||||
|
static void
|
||||||
|
jobctl_notty(void)
|
||||||
|
{
|
||||||
|
if (ttyfd >= 0) {
|
||||||
|
close(ttyfd);
|
||||||
|
ttyfd = -1;
|
||||||
|
}
|
||||||
|
if (!iflag) {
|
||||||
|
setsignal(SIGTSTP);
|
||||||
|
setsignal(SIGTTOU);
|
||||||
|
setsignal(SIGTTIN);
|
||||||
|
jobctl = 1;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
out2fmt_flush("sh: can't access tty; job control turned off\n");
|
||||||
|
mflag = 0;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
setjobctl(int on)
|
setjobctl(int on)
|
||||||
{
|
{
|
||||||
@@ -133,8 +151,10 @@ setjobctl(int on)
|
|||||||
while (i <= 2 && !isatty(i))
|
while (i <= 2 && !isatty(i))
|
||||||
i++;
|
i++;
|
||||||
if (i > 2 ||
|
if (i > 2 ||
|
||||||
(ttyfd = fcntl(i, F_DUPFD_CLOEXEC, 10)) < 0)
|
(ttyfd = fcntl(i, F_DUPFD_CLOEXEC, 10)) < 0) {
|
||||||
goto out;
|
jobctl_notty();
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (ttyfd < 10) {
|
if (ttyfd < 10) {
|
||||||
/*
|
/*
|
||||||
@@ -142,9 +162,8 @@ setjobctl(int on)
|
|||||||
* the user's redirections.
|
* the user's redirections.
|
||||||
*/
|
*/
|
||||||
if ((i = fcntl(ttyfd, F_DUPFD_CLOEXEC, 10)) < 0) {
|
if ((i = fcntl(ttyfd, F_DUPFD_CLOEXEC, 10)) < 0) {
|
||||||
close(ttyfd);
|
jobctl_notty();
|
||||||
ttyfd = -1;
|
return;
|
||||||
goto out;
|
|
||||||
}
|
}
|
||||||
close(ttyfd);
|
close(ttyfd);
|
||||||
ttyfd = i;
|
ttyfd = i;
|
||||||
@@ -152,11 +171,15 @@ setjobctl(int on)
|
|||||||
do { /* while we are in the background */
|
do { /* while we are in the background */
|
||||||
initialpgrp = tcgetpgrp(ttyfd);
|
initialpgrp = tcgetpgrp(ttyfd);
|
||||||
if (initialpgrp < 0) {
|
if (initialpgrp < 0) {
|
||||||
out: out2fmt_flush("sh: can't access tty; job control turned off\n");
|
jobctl_notty();
|
||||||
mflag = 0;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (initialpgrp != getpgrp()) {
|
if (initialpgrp != getpgrp()) {
|
||||||
|
if (!iflag) {
|
||||||
|
initialpgrp = -1;
|
||||||
|
jobctl_notty();
|
||||||
|
return;
|
||||||
|
}
|
||||||
kill(0, SIGTTIN);
|
kill(0, SIGTTIN);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -168,9 +191,11 @@ out: out2fmt_flush("sh: can't access tty; job control turned off\n");
|
|||||||
tcsetpgrp(ttyfd, rootpid);
|
tcsetpgrp(ttyfd, rootpid);
|
||||||
} else { /* turning job control off */
|
} else { /* turning job control off */
|
||||||
setpgid(0, initialpgrp);
|
setpgid(0, initialpgrp);
|
||||||
|
if (ttyfd >= 0) {
|
||||||
tcsetpgrp(ttyfd, initialpgrp);
|
tcsetpgrp(ttyfd, initialpgrp);
|
||||||
close(ttyfd);
|
close(ttyfd);
|
||||||
ttyfd = -1;
|
ttyfd = -1;
|
||||||
|
}
|
||||||
setsignal(SIGTSTP);
|
setsignal(SIGTSTP);
|
||||||
setsignal(SIGTTOU);
|
setsignal(SIGTTOU);
|
||||||
setsignal(SIGTTIN);
|
setsignal(SIGTTIN);
|
||||||
@@ -195,6 +220,7 @@ fgcmd(int argc __unused, char **argv __unused)
|
|||||||
printjobcmd(jp);
|
printjobcmd(jp);
|
||||||
flushout(&output);
|
flushout(&output);
|
||||||
pgrp = jp->ps[0].pid;
|
pgrp = jp->ps[0].pid;
|
||||||
|
if (ttyfd >= 0)
|
||||||
tcsetpgrp(ttyfd, pgrp);
|
tcsetpgrp(ttyfd, pgrp);
|
||||||
restartjob(jp);
|
restartjob(jp);
|
||||||
jp->foreground = 1;
|
jp->foreground = 1;
|
||||||
@@ -347,13 +373,13 @@ showjob(struct job *jp, int mode)
|
|||||||
strcat(statestr, " (core dumped)");
|
strcat(statestr, " (core dumped)");
|
||||||
}
|
}
|
||||||
|
|
||||||
for (ps = jp->ps ; ; ps++) { /* for each process */
|
for (ps = jp->ps ; procno > 0 ; ps++, procno--) { /* for each process */
|
||||||
if (mode == SHOWJOBS_PIDS || mode == SHOWJOBS_PGIDS) {
|
if (mode == SHOWJOBS_PIDS || mode == SHOWJOBS_PGIDS) {
|
||||||
out1fmt("%d\n", (int)ps->pid);
|
out1fmt("%d\n", (int)ps->pid);
|
||||||
goto skip;
|
continue;
|
||||||
}
|
}
|
||||||
if (mode != SHOWJOBS_VERBOSE && ps != jp->ps)
|
if (mode != SHOWJOBS_VERBOSE && ps != jp->ps)
|
||||||
goto skip;
|
continue;
|
||||||
if (jobno == curr && ps == jp->ps)
|
if (jobno == curr && ps == jp->ps)
|
||||||
c = '+';
|
c = '+';
|
||||||
else if (jobno == prev && ps == jp->ps)
|
else if (jobno == prev && ps == jp->ps)
|
||||||
@@ -384,8 +410,6 @@ showjob(struct job *jp, int mode)
|
|||||||
out1c('\n');
|
out1c('\n');
|
||||||
} else
|
} else
|
||||||
printjobcmd(jp);
|
printjobcmd(jp);
|
||||||
skip: if (--procno <= 0)
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -568,23 +592,23 @@ getjob_nonotfound(const char *name)
|
|||||||
|
|
||||||
if (name == NULL) {
|
if (name == NULL) {
|
||||||
#if JOBS
|
#if JOBS
|
||||||
currentjob: if ((jp = getcurjob(NULL)) == NULL)
|
name = "%+";
|
||||||
error("No current job");
|
|
||||||
return (jp);
|
|
||||||
#else
|
#else
|
||||||
error("No current job");
|
error("No current job");
|
||||||
#endif
|
#endif
|
||||||
} else if (name[0] == '%') {
|
}
|
||||||
|
if (name[0] == '%') {
|
||||||
if (is_digit(name[1])) {
|
if (is_digit(name[1])) {
|
||||||
jobno = number(name + 1);
|
jobno = number(name + 1);
|
||||||
if (jobno > 0 && jobno <= njobs
|
if (jobno > 0 && jobno <= njobs
|
||||||
&& jobtab[jobno - 1].used != 0)
|
&& jobtab[jobno - 1].used != 0)
|
||||||
return &jobtab[jobno - 1];
|
return &jobtab[jobno - 1];
|
||||||
#if JOBS
|
#if JOBS
|
||||||
} else if (name[1] == '%' && name[2] == '\0') {
|
} else if ((name[1] == '%' || name[1] == '+') &&
|
||||||
goto currentjob;
|
name[2] == '\0') {
|
||||||
} else if (name[1] == '+' && name[2] == '\0') {
|
if ((jp = getcurjob(NULL)) == NULL)
|
||||||
goto currentjob;
|
error("No current job");
|
||||||
|
return (jp);
|
||||||
} else if (name[1] == '-' && name[2] == '\0') {
|
} else if (name[1] == '-' && name[2] == '\0') {
|
||||||
if ((jp = getcurjob(NULL)) == NULL ||
|
if ((jp = getcurjob(NULL)) == NULL ||
|
||||||
(jp = getcurjob(jp)) == NULL)
|
(jp = getcurjob(jp)) == NULL)
|
||||||
@@ -847,7 +871,8 @@ forkshell(struct job *jp, union node *n, int mode)
|
|||||||
pgrp = getpid();
|
pgrp = getpid();
|
||||||
else
|
else
|
||||||
pgrp = jp->ps[0].pid;
|
pgrp = jp->ps[0].pid;
|
||||||
if (setpgid(0, pgrp) == 0 && mode == FORK_FG) {
|
if (setpgid(0, pgrp) == 0 && mode == FORK_FG &&
|
||||||
|
ttyfd >= 0) {
|
||||||
/*** this causes superfluous TIOCSPGRPS ***/
|
/*** this causes superfluous TIOCSPGRPS ***/
|
||||||
if (tcsetpgrp(ttyfd, pgrp) < 0)
|
if (tcsetpgrp(ttyfd, pgrp) < 0)
|
||||||
error("tcsetpgrp failed, errno=%d", errno);
|
error("tcsetpgrp failed, errno=%d", errno);
|
||||||
@@ -1007,7 +1032,7 @@ waitforjob(struct job *jp, int *origstatus)
|
|||||||
dotrap();
|
dotrap();
|
||||||
#if JOBS
|
#if JOBS
|
||||||
if (jp->jobctl) {
|
if (jp->jobctl) {
|
||||||
if (tcsetpgrp(ttyfd, rootpid) < 0)
|
if (ttyfd >= 0 && tcsetpgrp(ttyfd, rootpid) < 0)
|
||||||
error("tcsetpgrp failed, errno=%d\n", errno);
|
error("tcsetpgrp failed, errno=%d\n", errno);
|
||||||
}
|
}
|
||||||
if (jp->state == JOBSTOPPED)
|
if (jp->state == JOBSTOPPED)
|
||||||
@@ -1262,14 +1287,44 @@ commandtext(union node *n)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
cmdtxtdogroup(union node *n)
|
||||||
|
{
|
||||||
|
cmdputs("; do ");
|
||||||
|
cmdtxt(n);
|
||||||
|
cmdputs("; done");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
cmdtxtredir(union node *n, const char *op, int deffd)
|
||||||
|
{
|
||||||
|
char s[2];
|
||||||
|
|
||||||
|
if (n->nfile.fd != deffd) {
|
||||||
|
s[0] = n->nfile.fd + '0';
|
||||||
|
s[1] = '\0';
|
||||||
|
cmdputs(s);
|
||||||
|
}
|
||||||
|
cmdputs(op);
|
||||||
|
if (n->type == NTOFD || n->type == NFROMFD) {
|
||||||
|
if (n->ndup.dupfd >= 0)
|
||||||
|
s[0] = n->ndup.dupfd + '0';
|
||||||
|
else
|
||||||
|
s[0] = '-';
|
||||||
|
s[1] = '\0';
|
||||||
|
cmdputs(s);
|
||||||
|
} else {
|
||||||
|
cmdtxt(n->nfile.fname);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
cmdtxt(union node *n)
|
cmdtxt(union node *n)
|
||||||
{
|
{
|
||||||
union node *np;
|
union node *np;
|
||||||
struct nodelist *lp;
|
struct nodelist *lp;
|
||||||
const char *p;
|
|
||||||
int i;
|
|
||||||
char s[2];
|
|
||||||
|
|
||||||
if (n == NULL)
|
if (n == NULL)
|
||||||
return;
|
return;
|
||||||
@@ -1314,14 +1369,13 @@ cmdtxt(union node *n)
|
|||||||
break;
|
break;
|
||||||
case NWHILE:
|
case NWHILE:
|
||||||
cmdputs("while ");
|
cmdputs("while ");
|
||||||
goto until;
|
cmdtxt(n->nbinary.ch1);
|
||||||
|
cmdtxtdogroup(n->nbinary.ch2);
|
||||||
|
break;
|
||||||
case NUNTIL:
|
case NUNTIL:
|
||||||
cmdputs("until ");
|
cmdputs("until ");
|
||||||
until:
|
|
||||||
cmdtxt(n->nbinary.ch1);
|
cmdtxt(n->nbinary.ch1);
|
||||||
cmdputs("; do ");
|
cmdtxtdogroup(n->nbinary.ch2);
|
||||||
cmdtxt(n->nbinary.ch2);
|
|
||||||
cmdputs("; done");
|
|
||||||
break;
|
break;
|
||||||
case NFOR:
|
case NFOR:
|
||||||
cmdputs("for ");
|
cmdputs("for ");
|
||||||
@@ -1356,36 +1410,25 @@ cmdtxt(union node *n)
|
|||||||
cmdputs(n->narg.text);
|
cmdputs(n->narg.text);
|
||||||
break;
|
break;
|
||||||
case NTO:
|
case NTO:
|
||||||
p = ">"; i = 1; goto redir;
|
cmdtxtredir(n, ">", 1);
|
||||||
|
break;
|
||||||
case NAPPEND:
|
case NAPPEND:
|
||||||
p = ">>"; i = 1; goto redir;
|
cmdtxtredir(n, ">>", 1);
|
||||||
|
break;
|
||||||
case NTOFD:
|
case NTOFD:
|
||||||
p = ">&"; i = 1; goto redir;
|
cmdtxtredir(n, ">&", 1);
|
||||||
|
break;
|
||||||
case NCLOBBER:
|
case NCLOBBER:
|
||||||
p = ">|"; i = 1; goto redir;
|
cmdtxtredir(n, ">|", 1);
|
||||||
|
break;
|
||||||
case NFROM:
|
case NFROM:
|
||||||
p = "<"; i = 0; goto redir;
|
cmdtxtredir(n, "<", 0);
|
||||||
|
break;
|
||||||
case NFROMTO:
|
case NFROMTO:
|
||||||
p = "<>"; i = 0; goto redir;
|
cmdtxtredir(n, "<>", 0);
|
||||||
|
break;
|
||||||
case NFROMFD:
|
case NFROMFD:
|
||||||
p = "<&"; i = 0; goto redir;
|
cmdtxtredir(n, "<&", 0);
|
||||||
redir:
|
|
||||||
if (n->nfile.fd != i) {
|
|
||||||
s[0] = n->nfile.fd + '0';
|
|
||||||
s[1] = '\0';
|
|
||||||
cmdputs(s);
|
|
||||||
}
|
|
||||||
cmdputs(p);
|
|
||||||
if (n->type == NTOFD || n->type == NFROMFD) {
|
|
||||||
if (n->ndup.dupfd >= 0)
|
|
||||||
s[0] = n->ndup.dupfd + '0';
|
|
||||||
else
|
|
||||||
s[0] = '-';
|
|
||||||
s[1] = '\0';
|
|
||||||
cmdputs(s);
|
|
||||||
} else {
|
|
||||||
cmdtxt(n->nfile.fname);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case NHERE:
|
case NHERE:
|
||||||
case NXHERE:
|
case NXHERE:
|
||||||
|
|||||||
+11
-3
@@ -82,9 +82,17 @@ number(const char *s)
|
|||||||
int
|
int
|
||||||
is_number(const char *p)
|
is_number(const char *p)
|
||||||
{
|
{
|
||||||
do {
|
const char *q;
|
||||||
if (! is_digit(*p))
|
|
||||||
|
if (*p == '\0')
|
||||||
|
return 0;
|
||||||
|
while (*p == '0')
|
||||||
|
p++;
|
||||||
|
for (q = p; *q != '\0'; q++)
|
||||||
|
if (! is_digit(*q))
|
||||||
|
return 0;
|
||||||
|
if (q - p > 10 ||
|
||||||
|
(q - p == 10 && memcmp(p, "2147483647", 10) > 0))
|
||||||
return 0;
|
return 0;
|
||||||
} while (*++p != '\0');
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|||||||
+25
-6
@@ -325,6 +325,7 @@ setparam(char **argv)
|
|||||||
shellparam.malloc = 1;
|
shellparam.malloc = 1;
|
||||||
shellparam.nparam = nparam;
|
shellparam.nparam = nparam;
|
||||||
shellparam.p = newparam;
|
shellparam.p = newparam;
|
||||||
|
shellparam.optp = NULL;
|
||||||
shellparam.reset = 1;
|
shellparam.reset = 1;
|
||||||
shellparam.optnext = NULL;
|
shellparam.optnext = NULL;
|
||||||
}
|
}
|
||||||
@@ -344,6 +345,11 @@ freeparam(struct shparam *param)
|
|||||||
ckfree(*ap);
|
ckfree(*ap);
|
||||||
ckfree(param->p);
|
ckfree(param->p);
|
||||||
}
|
}
|
||||||
|
if (param->optp) {
|
||||||
|
for (ap = param->optp ; *ap ; ap++)
|
||||||
|
ckfree(*ap);
|
||||||
|
ckfree(param->optp);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -417,20 +423,33 @@ getoptsreset(const char *value)
|
|||||||
int
|
int
|
||||||
getoptscmd(int argc, char **argv)
|
getoptscmd(int argc, char **argv)
|
||||||
{
|
{
|
||||||
char **optbase = NULL;
|
char **optbase = NULL, **ap;
|
||||||
|
int i;
|
||||||
|
|
||||||
if (argc < 3)
|
if (argc < 3)
|
||||||
error("usage: getopts optstring var [arg]");
|
error("usage: getopts optstring var [arg]");
|
||||||
else if (argc == 3)
|
|
||||||
optbase = shellparam.p;
|
|
||||||
else
|
|
||||||
optbase = &argv[3];
|
|
||||||
|
|
||||||
if (shellparam.reset == 1) {
|
if (shellparam.reset == 1) {
|
||||||
|
INTOFF;
|
||||||
|
if (shellparam.optp) {
|
||||||
|
for (ap = shellparam.optp ; *ap ; ap++)
|
||||||
|
ckfree(*ap);
|
||||||
|
ckfree(shellparam.optp);
|
||||||
|
shellparam.optp = NULL;
|
||||||
|
}
|
||||||
|
if (argc > 3) {
|
||||||
|
shellparam.optp = ckmalloc((argc - 2) * sizeof *ap);
|
||||||
|
memset(shellparam.optp, '\0', (argc - 2) * sizeof *ap);
|
||||||
|
for (i = 0; i < argc - 3; i++)
|
||||||
|
shellparam.optp[i] = savestr(argv[i + 3]);
|
||||||
|
}
|
||||||
|
INTON;
|
||||||
|
optbase = argc == 3 ? shellparam.p : shellparam.optp;
|
||||||
shellparam.optnext = optbase;
|
shellparam.optnext = optbase;
|
||||||
shellparam.optptr = NULL;
|
shellparam.optptr = NULL;
|
||||||
shellparam.reset = 0;
|
shellparam.reset = 0;
|
||||||
}
|
} else
|
||||||
|
optbase = shellparam.optp ? shellparam.optp : shellparam.p;
|
||||||
|
|
||||||
return getopts(argv[1], argv[2], optbase, &shellparam.optnext,
|
return getopts(argv[1], argv[2], optbase, &shellparam.optnext,
|
||||||
&shellparam.optptr);
|
&shellparam.optptr);
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ struct shparam {
|
|||||||
unsigned char malloc; /* if parameter list dynamically allocated */
|
unsigned char malloc; /* if parameter list dynamically allocated */
|
||||||
unsigned char reset; /* if getopts has been reset */
|
unsigned char reset; /* if getopts has been reset */
|
||||||
char **p; /* parameter list */
|
char **p; /* parameter list */
|
||||||
|
char **optp; /* parameter list for getopts */
|
||||||
char **optnext; /* next parameter to be processed by getopts */
|
char **optnext; /* next parameter to be processed by getopts */
|
||||||
char *optptr; /* used by getopts */
|
char *optptr; /* used by getopts */
|
||||||
};
|
};
|
||||||
|
|||||||
+152
-139
@@ -66,7 +66,6 @@ __FBSDID("$FreeBSD$");
|
|||||||
* Shell command parser.
|
* Shell command parser.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define EOFMARKLEN 79
|
|
||||||
#define PROMPTLEN 128
|
#define PROMPTLEN 128
|
||||||
|
|
||||||
/* values of checkkwd variable */
|
/* values of checkkwd variable */
|
||||||
@@ -126,6 +125,7 @@ static void consumetoken(int);
|
|||||||
static void synexpect(int) __dead2;
|
static void synexpect(int) __dead2;
|
||||||
static void synerror(const char *) __dead2;
|
static void synerror(const char *) __dead2;
|
||||||
static void setprompt(int);
|
static void setprompt(int);
|
||||||
|
static int pgetc_linecont(void);
|
||||||
|
|
||||||
|
|
||||||
static void *
|
static void *
|
||||||
@@ -718,7 +718,6 @@ parsefname(void)
|
|||||||
if (n->type == NHERE) {
|
if (n->type == NHERE) {
|
||||||
struct heredoc *here = heredoc;
|
struct heredoc *here = heredoc;
|
||||||
struct heredoc *p;
|
struct heredoc *p;
|
||||||
int i;
|
|
||||||
|
|
||||||
if (quoteflag == 0)
|
if (quoteflag == 0)
|
||||||
n->type = NXHERE;
|
n->type = NXHERE;
|
||||||
@@ -727,7 +726,7 @@ parsefname(void)
|
|||||||
while (*wordtext == '\t')
|
while (*wordtext == '\t')
|
||||||
wordtext++;
|
wordtext++;
|
||||||
}
|
}
|
||||||
if (! noexpand(wordtext) || (i = strlen(wordtext)) == 0 || i > EOFMARKLEN)
|
if (! noexpand(wordtext))
|
||||||
synerror("Illegal eof marker for << redirection");
|
synerror("Illegal eof marker for << redirection");
|
||||||
rmescapes(wordtext);
|
rmescapes(wordtext);
|
||||||
here->eofmark = wordtext;
|
here->eofmark = wordtext;
|
||||||
@@ -891,7 +890,9 @@ xxreadtoken(void)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
pungetc();
|
pungetc();
|
||||||
goto breakloop;
|
/* FALLTHROUGH */
|
||||||
|
default:
|
||||||
|
return readtoken1(c, BASESYNTAX, (char *)NULL, 0);
|
||||||
case '\n':
|
case '\n':
|
||||||
plinno++;
|
plinno++;
|
||||||
needprompt = doprompt;
|
needprompt = doprompt;
|
||||||
@@ -899,17 +900,17 @@ xxreadtoken(void)
|
|||||||
case PEOF:
|
case PEOF:
|
||||||
RETURN(TEOF);
|
RETURN(TEOF);
|
||||||
case '&':
|
case '&':
|
||||||
if (pgetc() == '&')
|
if (pgetc_linecont() == '&')
|
||||||
RETURN(TAND);
|
RETURN(TAND);
|
||||||
pungetc();
|
pungetc();
|
||||||
RETURN(TBACKGND);
|
RETURN(TBACKGND);
|
||||||
case '|':
|
case '|':
|
||||||
if (pgetc() == '|')
|
if (pgetc_linecont() == '|')
|
||||||
RETURN(TOR);
|
RETURN(TOR);
|
||||||
pungetc();
|
pungetc();
|
||||||
RETURN(TPIPE);
|
RETURN(TPIPE);
|
||||||
case ';':
|
case ';':
|
||||||
c = pgetc();
|
c = pgetc_linecont();
|
||||||
if (c == ';')
|
if (c == ';')
|
||||||
RETURN(TENDCASE);
|
RETURN(TENDCASE);
|
||||||
else if (c == '&')
|
else if (c == '&')
|
||||||
@@ -920,12 +921,8 @@ xxreadtoken(void)
|
|||||||
RETURN(TLP);
|
RETURN(TLP);
|
||||||
case ')':
|
case ')':
|
||||||
RETURN(TRP);
|
RETURN(TRP);
|
||||||
default:
|
|
||||||
goto breakloop;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
breakloop:
|
|
||||||
return readtoken1(c, BASESYNTAX, (char *)NULL, 0);
|
|
||||||
#undef RETURN
|
#undef RETURN
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -945,6 +942,98 @@ struct tokenstate
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Check to see whether we are at the end of the here document. When this
|
||||||
|
* is called, c is set to the first character of the next input line. If
|
||||||
|
* we are at the end of the here document, this routine sets the c to PEOF.
|
||||||
|
* The new value of c is returned.
|
||||||
|
*/
|
||||||
|
|
||||||
|
static int
|
||||||
|
checkend(int c, const char *eofmark, int striptabs)
|
||||||
|
{
|
||||||
|
if (striptabs) {
|
||||||
|
while (c == '\t')
|
||||||
|
c = pgetc();
|
||||||
|
}
|
||||||
|
if (c == *eofmark) {
|
||||||
|
int c2;
|
||||||
|
const char *q;
|
||||||
|
|
||||||
|
for (q = eofmark + 1; c2 = pgetc(), *q != '\0' && c2 == *q; q++)
|
||||||
|
;
|
||||||
|
if ((c2 == PEOF || c2 == '\n') && *q == '\0') {
|
||||||
|
c = PEOF;
|
||||||
|
if (c2 == '\n') {
|
||||||
|
plinno++;
|
||||||
|
needprompt = doprompt;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
pungetc();
|
||||||
|
pushstring(eofmark + 1, q - (eofmark + 1), NULL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return (c);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Parse a redirection operator. The variable "out" points to a string
|
||||||
|
* specifying the fd to be redirected. The variable "c" contains the
|
||||||
|
* first character of the redirection operator.
|
||||||
|
*/
|
||||||
|
|
||||||
|
static void
|
||||||
|
parseredir(char *out, int c)
|
||||||
|
{
|
||||||
|
char fd = *out;
|
||||||
|
union node *np;
|
||||||
|
|
||||||
|
np = (union node *)stalloc(sizeof (struct nfile));
|
||||||
|
if (c == '>') {
|
||||||
|
np->nfile.fd = 1;
|
||||||
|
c = pgetc_linecont();
|
||||||
|
if (c == '>')
|
||||||
|
np->type = NAPPEND;
|
||||||
|
else if (c == '&')
|
||||||
|
np->type = NTOFD;
|
||||||
|
else if (c == '|')
|
||||||
|
np->type = NCLOBBER;
|
||||||
|
else {
|
||||||
|
np->type = NTO;
|
||||||
|
pungetc();
|
||||||
|
}
|
||||||
|
} else { /* c == '<' */
|
||||||
|
np->nfile.fd = 0;
|
||||||
|
c = pgetc_linecont();
|
||||||
|
if (c == '<') {
|
||||||
|
if (sizeof (struct nfile) != sizeof (struct nhere)) {
|
||||||
|
np = (union node *)stalloc(sizeof (struct nhere));
|
||||||
|
np->nfile.fd = 0;
|
||||||
|
}
|
||||||
|
np->type = NHERE;
|
||||||
|
heredoc = (struct heredoc *)stalloc(sizeof (struct heredoc));
|
||||||
|
heredoc->here = np;
|
||||||
|
if ((c = pgetc_linecont()) == '-') {
|
||||||
|
heredoc->striptabs = 1;
|
||||||
|
} else {
|
||||||
|
heredoc->striptabs = 0;
|
||||||
|
pungetc();
|
||||||
|
}
|
||||||
|
} else if (c == '&')
|
||||||
|
np->type = NFROMFD;
|
||||||
|
else if (c == '>')
|
||||||
|
np->type = NFROMTO;
|
||||||
|
else {
|
||||||
|
np->type = NFROM;
|
||||||
|
pungetc();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (fd != '\0')
|
||||||
|
np->nfile.fd = digit_val(fd);
|
||||||
|
redirnode = np;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Called to parse command substitutions.
|
* Called to parse command substitutions.
|
||||||
*/
|
*/
|
||||||
@@ -1006,25 +1095,12 @@ parsebackq(char *out, struct nodelist **pbqlist,
|
|||||||
needprompt = 0;
|
needprompt = 0;
|
||||||
}
|
}
|
||||||
CHECKSTRSPACE(2, oout);
|
CHECKSTRSPACE(2, oout);
|
||||||
switch (c = pgetc()) {
|
c = pgetc_linecont();
|
||||||
case '`':
|
if (c == '`')
|
||||||
goto done;
|
break;
|
||||||
|
switch (c) {
|
||||||
case '\\':
|
case '\\':
|
||||||
if ((c = pgetc()) == '\n') {
|
c = pgetc();
|
||||||
plinno++;
|
|
||||||
if (doprompt)
|
|
||||||
setprompt(2);
|
|
||||||
else
|
|
||||||
setprompt(0);
|
|
||||||
/*
|
|
||||||
* If eating a newline, avoid putting
|
|
||||||
* the newline into the new character
|
|
||||||
* stream (via the USTPUTC after the
|
|
||||||
* switch).
|
|
||||||
*/
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (c != '\\' && c != '`' && c != '$'
|
if (c != '\\' && c != '`' && c != '$'
|
||||||
&& (!dblquote || c != '"'))
|
&& (!dblquote || c != '"'))
|
||||||
USTPUTC('\\', oout);
|
USTPUTC('\\', oout);
|
||||||
@@ -1045,7 +1121,6 @@ parsebackq(char *out, struct nodelist **pbqlist,
|
|||||||
}
|
}
|
||||||
USTPUTC(c, oout);
|
USTPUTC(c, oout);
|
||||||
}
|
}
|
||||||
done:
|
|
||||||
USTPUTC('\0', oout);
|
USTPUTC('\0', oout);
|
||||||
olen = oout - stackblock();
|
olen = oout - stackblock();
|
||||||
INTOFF;
|
INTOFF;
|
||||||
@@ -1246,6 +1321,13 @@ readcstyleesc(char *out)
|
|||||||
c = pgetc();
|
c = pgetc();
|
||||||
if (c == PEOF)
|
if (c == PEOF)
|
||||||
synerror("Unterminated quoted string");
|
synerror("Unterminated quoted string");
|
||||||
|
if (c == '\n') {
|
||||||
|
plinno++;
|
||||||
|
if (doprompt)
|
||||||
|
setprompt(2);
|
||||||
|
else
|
||||||
|
setprompt(0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
pungetc();
|
pungetc();
|
||||||
return out;
|
return out;
|
||||||
@@ -1269,8 +1351,6 @@ readcstyleesc(char *out)
|
|||||||
* will run code that appears at the end of readtoken1.
|
* will run code that appears at the end of readtoken1.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define CHECKEND() {goto checkend; checkend_return:;}
|
|
||||||
#define PARSEREDIR() {goto parseredir; parseredir_return:;}
|
|
||||||
#define PARSESUB() {goto parsesub; parsesub_return:;}
|
#define PARSESUB() {goto parsesub; parsesub_return:;}
|
||||||
#define PARSEARITH() {goto parsearith; parsearith_return:;}
|
#define PARSEARITH() {goto parsearith; parsearith_return:;}
|
||||||
|
|
||||||
@@ -1281,7 +1361,6 @@ readtoken1(int firstc, char const *initialsyntax, const char *eofmark,
|
|||||||
int c = firstc;
|
int c = firstc;
|
||||||
char *out;
|
char *out;
|
||||||
int len;
|
int len;
|
||||||
char line[EOFMARKLEN + 1];
|
|
||||||
struct nodelist *bqlist;
|
struct nodelist *bqlist;
|
||||||
int quotef;
|
int quotef;
|
||||||
int newvarnest;
|
int newvarnest;
|
||||||
@@ -1303,7 +1382,9 @@ readtoken1(int firstc, char const *initialsyntax, const char *eofmark,
|
|||||||
|
|
||||||
STARTSTACKSTR(out);
|
STARTSTACKSTR(out);
|
||||||
loop: { /* for each line, until end of word */
|
loop: { /* for each line, until end of word */
|
||||||
CHECKEND(); /* set c to PEOF if at end of here document */
|
if (eofmark)
|
||||||
|
/* set c to PEOF if at end of here document */
|
||||||
|
c = checkend(c, eofmark, striptabs);
|
||||||
for (;;) { /* until end of line or end of word */
|
for (;;) { /* until end of line or end of word */
|
||||||
CHECKSTRSPACE(4, out); /* permit 4 calls to USTPUTC */
|
CHECKSTRSPACE(4, out); /* permit 4 calls to USTPUTC */
|
||||||
|
|
||||||
@@ -1414,7 +1495,7 @@ readtoken1(int firstc, char const *initialsyntax, const char *eofmark,
|
|||||||
USTPUTC(c, out);
|
USTPUTC(c, out);
|
||||||
--state[level].parenlevel;
|
--state[level].parenlevel;
|
||||||
} else {
|
} else {
|
||||||
if (pgetc() == ')') {
|
if (pgetc_linecont() == ')') {
|
||||||
if (level > 0 &&
|
if (level > 0 &&
|
||||||
state[level].category == TSTATE_ARITH) {
|
state[level].category == TSTATE_ARITH) {
|
||||||
level--;
|
level--;
|
||||||
@@ -1469,7 +1550,7 @@ readtoken1(int firstc, char const *initialsyntax, const char *eofmark,
|
|||||||
&& quotef == 0
|
&& quotef == 0
|
||||||
&& len <= 2
|
&& len <= 2
|
||||||
&& (*out == '\0' || is_digit(*out))) {
|
&& (*out == '\0' || is_digit(*out))) {
|
||||||
PARSEREDIR();
|
parseredir(out, c);
|
||||||
return lasttoken = TREDIR;
|
return lasttoken = TREDIR;
|
||||||
} else {
|
} else {
|
||||||
pungetc();
|
pungetc();
|
||||||
@@ -1483,97 +1564,6 @@ readtoken1(int firstc, char const *initialsyntax, const char *eofmark,
|
|||||||
/* end of readtoken routine */
|
/* end of readtoken routine */
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Check to see whether we are at the end of the here document. When this
|
|
||||||
* is called, c is set to the first character of the next input line. If
|
|
||||||
* we are at the end of the here document, this routine sets the c to PEOF.
|
|
||||||
*/
|
|
||||||
|
|
||||||
checkend: {
|
|
||||||
if (eofmark) {
|
|
||||||
if (striptabs) {
|
|
||||||
while (c == '\t')
|
|
||||||
c = pgetc();
|
|
||||||
}
|
|
||||||
if (c == *eofmark) {
|
|
||||||
if (pfgets(line, sizeof line) != NULL) {
|
|
||||||
const char *p, *q;
|
|
||||||
|
|
||||||
p = line;
|
|
||||||
for (q = eofmark + 1 ; *q && *p == *q ; p++, q++);
|
|
||||||
if ((*p == '\0' || *p == '\n') && *q == '\0') {
|
|
||||||
c = PEOF;
|
|
||||||
if (*p == '\n') {
|
|
||||||
plinno++;
|
|
||||||
needprompt = doprompt;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
pushstring(line, strlen(line), NULL);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
goto checkend_return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Parse a redirection operator. The variable "out" points to a string
|
|
||||||
* specifying the fd to be redirected. The variable "c" contains the
|
|
||||||
* first character of the redirection operator.
|
|
||||||
*/
|
|
||||||
|
|
||||||
parseredir: {
|
|
||||||
char fd = *out;
|
|
||||||
union node *np;
|
|
||||||
|
|
||||||
np = (union node *)stalloc(sizeof (struct nfile));
|
|
||||||
if (c == '>') {
|
|
||||||
np->nfile.fd = 1;
|
|
||||||
c = pgetc();
|
|
||||||
if (c == '>')
|
|
||||||
np->type = NAPPEND;
|
|
||||||
else if (c == '&')
|
|
||||||
np->type = NTOFD;
|
|
||||||
else if (c == '|')
|
|
||||||
np->type = NCLOBBER;
|
|
||||||
else {
|
|
||||||
np->type = NTO;
|
|
||||||
pungetc();
|
|
||||||
}
|
|
||||||
} else { /* c == '<' */
|
|
||||||
np->nfile.fd = 0;
|
|
||||||
c = pgetc();
|
|
||||||
if (c == '<') {
|
|
||||||
if (sizeof (struct nfile) != sizeof (struct nhere)) {
|
|
||||||
np = (union node *)stalloc(sizeof (struct nhere));
|
|
||||||
np->nfile.fd = 0;
|
|
||||||
}
|
|
||||||
np->type = NHERE;
|
|
||||||
heredoc = (struct heredoc *)stalloc(sizeof (struct heredoc));
|
|
||||||
heredoc->here = np;
|
|
||||||
if ((c = pgetc()) == '-') {
|
|
||||||
heredoc->striptabs = 1;
|
|
||||||
} else {
|
|
||||||
heredoc->striptabs = 0;
|
|
||||||
pungetc();
|
|
||||||
}
|
|
||||||
} else if (c == '&')
|
|
||||||
np->type = NFROMFD;
|
|
||||||
else if (c == '>')
|
|
||||||
np->type = NFROMTO;
|
|
||||||
else {
|
|
||||||
np->type = NFROM;
|
|
||||||
pungetc();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (fd != '\0')
|
|
||||||
np->nfile.fd = digit_val(fd);
|
|
||||||
redirnode = np;
|
|
||||||
goto parseredir_return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Parse a substitution. At this point, we have read the dollar sign
|
* Parse a substitution. At this point, we have read the dollar sign
|
||||||
* and nothing else.
|
* and nothing else.
|
||||||
@@ -1591,9 +1581,9 @@ parsesub: {
|
|||||||
int length;
|
int length;
|
||||||
int c1;
|
int c1;
|
||||||
|
|
||||||
c = pgetc();
|
c = pgetc_linecont();
|
||||||
if (c == '(') { /* $(command) or $((arith)) */
|
if (c == '(') { /* $(command) or $((arith)) */
|
||||||
if (pgetc() == '(') {
|
if (pgetc_linecont() == '(') {
|
||||||
PARSEARITH();
|
PARSEARITH();
|
||||||
} else {
|
} else {
|
||||||
pungetc();
|
pungetc();
|
||||||
@@ -1611,7 +1601,7 @@ parsesub: {
|
|||||||
flags = 0;
|
flags = 0;
|
||||||
if (c == '{') {
|
if (c == '{') {
|
||||||
bracketed_name = 1;
|
bracketed_name = 1;
|
||||||
c = pgetc();
|
c = pgetc_linecont();
|
||||||
subtype = 0;
|
subtype = 0;
|
||||||
}
|
}
|
||||||
varname:
|
varname:
|
||||||
@@ -1619,7 +1609,7 @@ parsesub: {
|
|||||||
length = 0;
|
length = 0;
|
||||||
do {
|
do {
|
||||||
STPUTC(c, out);
|
STPUTC(c, out);
|
||||||
c = pgetc();
|
c = pgetc_linecont();
|
||||||
length++;
|
length++;
|
||||||
} while (!is_eof(c) && is_in_name(c));
|
} while (!is_eof(c) && is_in_name(c));
|
||||||
if (length == 6 &&
|
if (length == 6 &&
|
||||||
@@ -1638,22 +1628,22 @@ parsesub: {
|
|||||||
if (bracketed_name) {
|
if (bracketed_name) {
|
||||||
do {
|
do {
|
||||||
STPUTC(c, out);
|
STPUTC(c, out);
|
||||||
c = pgetc();
|
c = pgetc_linecont();
|
||||||
} while (is_digit(c));
|
} while (is_digit(c));
|
||||||
} else {
|
} else {
|
||||||
STPUTC(c, out);
|
STPUTC(c, out);
|
||||||
c = pgetc();
|
c = pgetc_linecont();
|
||||||
}
|
}
|
||||||
} else if (is_special(c)) {
|
} else if (is_special(c)) {
|
||||||
c1 = c;
|
c1 = c;
|
||||||
c = pgetc();
|
c = pgetc_linecont();
|
||||||
if (subtype == 0 && c1 == '#') {
|
if (subtype == 0 && c1 == '#') {
|
||||||
subtype = VSLENGTH;
|
subtype = VSLENGTH;
|
||||||
if (strchr(types, c) == NULL && c != ':' &&
|
if (strchr(types, c) == NULL && c != ':' &&
|
||||||
c != '#' && c != '%')
|
c != '#' && c != '%')
|
||||||
goto varname;
|
goto varname;
|
||||||
c1 = c;
|
c1 = c;
|
||||||
c = pgetc();
|
c = pgetc_linecont();
|
||||||
if (c1 != '}' && c == '}') {
|
if (c1 != '}' && c == '}') {
|
||||||
pungetc();
|
pungetc();
|
||||||
c = c1;
|
c = c1;
|
||||||
@@ -1678,7 +1668,7 @@ parsesub: {
|
|||||||
switch (c) {
|
switch (c) {
|
||||||
case ':':
|
case ':':
|
||||||
flags |= VSNUL;
|
flags |= VSNUL;
|
||||||
c = pgetc();
|
c = pgetc_linecont();
|
||||||
/*FALLTHROUGH*/
|
/*FALLTHROUGH*/
|
||||||
default:
|
default:
|
||||||
p = strchr(types, c);
|
p = strchr(types, c);
|
||||||
@@ -1698,7 +1688,7 @@ parsesub: {
|
|||||||
int cc = c;
|
int cc = c;
|
||||||
subtype = c == '#' ? VSTRIMLEFT :
|
subtype = c == '#' ? VSTRIMLEFT :
|
||||||
VSTRIMRIGHT;
|
VSTRIMRIGHT;
|
||||||
c = pgetc();
|
c = pgetc_linecont();
|
||||||
if (c == cc)
|
if (c == cc)
|
||||||
subtype++;
|
subtype++;
|
||||||
else
|
else
|
||||||
@@ -1907,6 +1897,29 @@ setprompt(int which)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
pgetc_linecont(void)
|
||||||
|
{
|
||||||
|
int c;
|
||||||
|
|
||||||
|
while ((c = pgetc_macro()) == '\\') {
|
||||||
|
c = pgetc();
|
||||||
|
if (c == '\n') {
|
||||||
|
plinno++;
|
||||||
|
if (doprompt)
|
||||||
|
setprompt(2);
|
||||||
|
else
|
||||||
|
setprompt(0);
|
||||||
|
} else {
|
||||||
|
pungetc();
|
||||||
|
/* Allow the backslash to be pushed back. */
|
||||||
|
pushstring("\\", 1, NULL);
|
||||||
|
return (pgetc());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return (c);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* called by editline -- any expansions to the prompt
|
* called by editline -- any expansions to the prompt
|
||||||
* should be added here.
|
* should be added here.
|
||||||
@@ -1915,7 +1928,7 @@ char *
|
|||||||
getprompt(void *unused __unused)
|
getprompt(void *unused __unused)
|
||||||
{
|
{
|
||||||
static char ps[PROMPTLEN];
|
static char ps[PROMPTLEN];
|
||||||
char *fmt;
|
const char *fmt;
|
||||||
const char *pwd;
|
const char *pwd;
|
||||||
int i, trim;
|
int i, trim;
|
||||||
static char internal_error[] = "??";
|
static char internal_error[] = "??";
|
||||||
@@ -2029,7 +2042,7 @@ expandstr(const char *ps)
|
|||||||
parser_temp = NULL;
|
parser_temp = NULL;
|
||||||
setinputstring(ps, 1);
|
setinputstring(ps, 1);
|
||||||
doprompt = 0;
|
doprompt = 0;
|
||||||
readtoken1(pgetc(), DQSYNTAX, "\n\n", 0);
|
readtoken1(pgetc(), DQSYNTAX, "", 0);
|
||||||
if (backquotelist != NULL)
|
if (backquotelist != NULL)
|
||||||
error("Command substitution not allowed here");
|
error("Command substitution not allowed here");
|
||||||
|
|
||||||
|
|||||||
+14
-15
@@ -173,21 +173,12 @@ openredirect(union node *redir, char memory[10])
|
|||||||
fname = redir->nfile.expfname;
|
fname = redir->nfile.expfname;
|
||||||
if ((f = open(fname, O_RDONLY)) < 0)
|
if ((f = open(fname, O_RDONLY)) < 0)
|
||||||
error("cannot open %s: %s", fname, strerror(errno));
|
error("cannot open %s: %s", fname, strerror(errno));
|
||||||
movefd:
|
|
||||||
if (f != fd) {
|
|
||||||
if (dup2(f, fd) == -1) {
|
|
||||||
e = errno;
|
|
||||||
close(f);
|
|
||||||
error("%d: %s", fd, strerror(e));
|
|
||||||
}
|
|
||||||
close(f);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case NFROMTO:
|
case NFROMTO:
|
||||||
fname = redir->nfile.expfname;
|
fname = redir->nfile.expfname;
|
||||||
if ((f = open(fname, O_RDWR|O_CREAT, 0666)) < 0)
|
if ((f = open(fname, O_RDWR|O_CREAT, 0666)) < 0)
|
||||||
error("cannot create %s: %s", fname, strerror(errno));
|
error("cannot create %s: %s", fname, strerror(errno));
|
||||||
goto movefd;
|
break;
|
||||||
case NTO:
|
case NTO:
|
||||||
if (Cflag) {
|
if (Cflag) {
|
||||||
fname = redir->nfile.expfname;
|
fname = redir->nfile.expfname;
|
||||||
@@ -205,19 +196,19 @@ openredirect(union node *redir, char memory[10])
|
|||||||
} else
|
} else
|
||||||
error("cannot create %s: %s", fname,
|
error("cannot create %s: %s", fname,
|
||||||
strerror(EEXIST));
|
strerror(EEXIST));
|
||||||
goto movefd;
|
break;
|
||||||
}
|
}
|
||||||
/* FALLTHROUGH */
|
/* FALLTHROUGH */
|
||||||
case NCLOBBER:
|
case NCLOBBER:
|
||||||
fname = redir->nfile.expfname;
|
fname = redir->nfile.expfname;
|
||||||
if ((f = open(fname, O_WRONLY|O_CREAT|O_TRUNC, 0666)) < 0)
|
if ((f = open(fname, O_WRONLY|O_CREAT|O_TRUNC, 0666)) < 0)
|
||||||
error("cannot create %s: %s", fname, strerror(errno));
|
error("cannot create %s: %s", fname, strerror(errno));
|
||||||
goto movefd;
|
break;
|
||||||
case NAPPEND:
|
case NAPPEND:
|
||||||
fname = redir->nfile.expfname;
|
fname = redir->nfile.expfname;
|
||||||
if ((f = open(fname, O_WRONLY|O_CREAT|O_APPEND, 0666)) < 0)
|
if ((f = open(fname, O_WRONLY|O_CREAT|O_APPEND, 0666)) < 0)
|
||||||
error("cannot create %s: %s", fname, strerror(errno));
|
error("cannot create %s: %s", fname, strerror(errno));
|
||||||
goto movefd;
|
break;
|
||||||
case NTOFD:
|
case NTOFD:
|
||||||
case NFROMFD:
|
case NFROMFD:
|
||||||
if (redir->ndup.dupfd >= 0) { /* if not ">&-" */
|
if (redir->ndup.dupfd >= 0) { /* if not ">&-" */
|
||||||
@@ -231,14 +222,22 @@ openredirect(union node *redir, char memory[10])
|
|||||||
} else {
|
} else {
|
||||||
close(fd);
|
close(fd);
|
||||||
}
|
}
|
||||||
break;
|
return;
|
||||||
case NHERE:
|
case NHERE:
|
||||||
case NXHERE:
|
case NXHERE:
|
||||||
f = openhere(redir);
|
f = openhere(redir);
|
||||||
goto movefd;
|
break;
|
||||||
default:
|
default:
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
|
if (f != fd) {
|
||||||
|
if (dup2(f, fd) == -1) {
|
||||||
|
e = errno;
|
||||||
|
close(f);
|
||||||
|
error("%d: %s", fd, strerror(e));
|
||||||
|
}
|
||||||
|
close(f);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+34
-12
@@ -32,7 +32,7 @@
|
|||||||
.\" from: @(#)sh.1 8.6 (Berkeley) 5/4/95
|
.\" from: @(#)sh.1 8.6 (Berkeley) 5/4/95
|
||||||
.\" $FreeBSD$
|
.\" $FreeBSD$
|
||||||
.\"
|
.\"
|
||||||
.Dd January 26, 2014
|
.Dd November 14, 2014
|
||||||
.Dt SH 1
|
.Dt SH 1
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
@@ -259,6 +259,12 @@ from input when in interactive mode.
|
|||||||
Force the shell to behave interactively.
|
Force the shell to behave interactively.
|
||||||
.It Fl m Li monitor
|
.It Fl m Li monitor
|
||||||
Turn on job control (set automatically when interactive).
|
Turn on job control (set automatically when interactive).
|
||||||
|
A new process group is created for each pipeline (called a job).
|
||||||
|
It is possible to suspend jobs or to have them run in the foreground or
|
||||||
|
in the background.
|
||||||
|
In a non-interactive shell,
|
||||||
|
this option can be set even if no terminal is available
|
||||||
|
and is useful to place processes in separate process groups.
|
||||||
.It Fl n Li noexec
|
.It Fl n Li noexec
|
||||||
If not interactive, read commands but do not
|
If not interactive, read commands but do not
|
||||||
execute them.
|
execute them.
|
||||||
@@ -584,7 +590,8 @@ the following actions:
|
|||||||
Leading words of the form
|
Leading words of the form
|
||||||
.Dq Li name=value
|
.Dq Li name=value
|
||||||
are stripped off and assigned to the environment of
|
are stripped off and assigned to the environment of
|
||||||
the simple command.
|
the simple command
|
||||||
|
(they do not affect expansions).
|
||||||
Redirection operators and
|
Redirection operators and
|
||||||
their arguments (as described below) are stripped
|
their arguments (as described below) are stripped
|
||||||
off and saved for processing.
|
off and saved for processing.
|
||||||
@@ -788,10 +795,13 @@ should indicate the various exit codes and what they mean.
|
|||||||
Additionally, the built-in commands return exit codes, as does
|
Additionally, the built-in commands return exit codes, as does
|
||||||
an executed shell function.
|
an executed shell function.
|
||||||
.Pp
|
.Pp
|
||||||
If a command is terminated by a signal, its exit status is 128 plus
|
If a command is terminated by a signal, its exit status is greater than 128.
|
||||||
the signal number.
|
The signal name can be found by passing the exit status to
|
||||||
Signal numbers are defined in the header file
|
.Li kill -l .
|
||||||
.In sys/signal.h .
|
.Pp
|
||||||
|
If there is no command word,
|
||||||
|
the exit status is the exit status of the last command substitution executed,
|
||||||
|
or zero if the command does not contain any command substitutions.
|
||||||
.Ss Complex Commands
|
.Ss Complex Commands
|
||||||
Complex commands are combinations of simple commands
|
Complex commands are combinations of simple commands
|
||||||
with control operators or keywords, together creating a larger complex
|
with control operators or keywords, together creating a larger complex
|
||||||
@@ -811,7 +821,8 @@ function definition
|
|||||||
.El
|
.El
|
||||||
.Pp
|
.Pp
|
||||||
Unless otherwise stated, the exit status of a command is
|
Unless otherwise stated, the exit status of a command is
|
||||||
that of the last simple command executed by the command.
|
that of the last simple command executed by the command,
|
||||||
|
or zero if no simple command was executed.
|
||||||
.Ss Pipelines
|
.Ss Pipelines
|
||||||
A pipeline is a sequence of one or more commands separated
|
A pipeline is a sequence of one or more commands separated
|
||||||
by the control operator
|
by the control operator
|
||||||
@@ -895,6 +906,8 @@ The format for running a command in background is:
|
|||||||
If the shell is not interactive, the standard input of an
|
If the shell is not interactive, the standard input of an
|
||||||
asynchronous command is set to
|
asynchronous command is set to
|
||||||
.Pa /dev/null .
|
.Pa /dev/null .
|
||||||
|
.Pp
|
||||||
|
The exit status is zero.
|
||||||
.Ss Lists (Generally Speaking)
|
.Ss Lists (Generally Speaking)
|
||||||
A list is a sequence of zero or more commands separated by
|
A list is a sequence of zero or more commands separated by
|
||||||
newlines, semicolons, or ampersands,
|
newlines, semicolons, or ampersands,
|
||||||
@@ -933,6 +946,13 @@ command is:
|
|||||||
.Ic fi
|
.Ic fi
|
||||||
.Ed
|
.Ed
|
||||||
.Pp
|
.Pp
|
||||||
|
The exit status is that of selected
|
||||||
|
.Ic then
|
||||||
|
or
|
||||||
|
.Ic else
|
||||||
|
list,
|
||||||
|
or zero if no list was selected.
|
||||||
|
.Pp
|
||||||
The syntax of the
|
The syntax of the
|
||||||
.Ic while
|
.Ic while
|
||||||
command is:
|
command is:
|
||||||
@@ -953,6 +973,9 @@ in place of
|
|||||||
which causes it to
|
which causes it to
|
||||||
repeat until the exit status of the first list is zero.
|
repeat until the exit status of the first list is zero.
|
||||||
.Pp
|
.Pp
|
||||||
|
The exit status is that of the last execution of the second list,
|
||||||
|
or zero if it was never executed.
|
||||||
|
.Pp
|
||||||
The syntax of the
|
The syntax of the
|
||||||
.Ic for
|
.Ic for
|
||||||
command is:
|
command is:
|
||||||
@@ -1033,10 +1056,6 @@ continuing until a list terminated with
|
|||||||
or the end of the
|
or the end of the
|
||||||
.Ic case
|
.Ic case
|
||||||
command.
|
command.
|
||||||
The exit code of the
|
|
||||||
.Ic case
|
|
||||||
command is the exit code of the last command executed in the list or
|
|
||||||
zero if no patterns were matched.
|
|
||||||
.Ss Grouping Commands Together
|
.Ss Grouping Commands Together
|
||||||
Commands may be grouped by writing either
|
Commands may be grouped by writing either
|
||||||
.Pp
|
.Pp
|
||||||
@@ -1124,6 +1143,8 @@ and the syntax is:
|
|||||||
The
|
The
|
||||||
.Ic local
|
.Ic local
|
||||||
command is implemented as a built-in command.
|
command is implemented as a built-in command.
|
||||||
|
The exit status is zero
|
||||||
|
unless the command is not in a function or a variable name is invalid.
|
||||||
.Pp
|
.Pp
|
||||||
When a variable is made local, it inherits the initial
|
When a variable is made local, it inherits the initial
|
||||||
value and exported and readonly flags from the variable
|
value and exported and readonly flags from the variable
|
||||||
@@ -2515,7 +2536,8 @@ and so on,
|
|||||||
decreasing the value of
|
decreasing the value of
|
||||||
.Li $#
|
.Li $#
|
||||||
by one.
|
by one.
|
||||||
If there are zero positional parameters, shifting does not do anything.
|
For portability, shifting if there are zero positional parameters
|
||||||
|
should be avoided, since the shell may abort.
|
||||||
.It Ic test
|
.It Ic test
|
||||||
A built-in equivalent of
|
A built-in equivalent of
|
||||||
.Xr test 1 .
|
.Xr test 1 .
|
||||||
|
|||||||
+7
-10
@@ -4,15 +4,12 @@
|
|||||||
|
|
||||||
TESTSDIR= ${TESTSBASE}/bin/sh
|
TESTSDIR= ${TESTSBASE}/bin/sh
|
||||||
|
|
||||||
TAP_TESTS_SH= legacy_test
|
TESTS_SUBDIRS+= builtins
|
||||||
TAP_TESTS_SH_SED_legacy_test= -e 's,__SH__,/bin/sh,g'
|
TESTS_SUBDIRS+= errors
|
||||||
# Some tests in here are silently not run when the tests are executed as
|
TESTS_SUBDIRS+= execution
|
||||||
# root. Explicitly tell Kyua to drop privileges.
|
TESTS_SUBDIRS+= expansion
|
||||||
#
|
TESTS_SUBDIRS+= parameters
|
||||||
# TODO(jmmv): Kyua needs to do this by default, not only when explicitly
|
TESTS_SUBDIRS+= parser
|
||||||
# requested. See https://code.google.com/p/kyua/issues/detail?id=6
|
TESTS_SUBDIRS+= set-e
|
||||||
TEST_METADATA.legacy_test+= required_user="unprivileged"
|
|
||||||
|
|
||||||
SUBDIR+= builtins errors execution expansion parameters parser set-e
|
|
||||||
|
|
||||||
.include <bsd.test.mk>
|
.include <bsd.test.mk>
|
||||||
|
|||||||
@@ -1,9 +1,13 @@
|
|||||||
# $FreeBSD$
|
# $FreeBSD$
|
||||||
|
|
||||||
.include <bsd.own.mk>
|
.include <src.opts.mk>
|
||||||
|
|
||||||
FILESDIR= ${TESTSBASE}/bin/sh/builtins
|
TESTSDIR= ${TESTSBASE}/bin/sh/${.CURDIR:T}
|
||||||
KYUAFILE= no
|
|
||||||
|
.PATH: ${.CURDIR:H}
|
||||||
|
ATF_TESTS_SH= functional_test
|
||||||
|
|
||||||
|
FILESDIR= ${TESTSDIR}
|
||||||
|
|
||||||
FILES= alias.0 alias.0.stdout
|
FILES= alias.0 alias.0.stdout
|
||||||
FILES+= alias.1 alias.1.stderr
|
FILES+= alias.1 alias.1.stderr
|
||||||
@@ -68,6 +72,8 @@ FILES+= eval3.0
|
|||||||
FILES+= eval4.0
|
FILES+= eval4.0
|
||||||
FILES+= eval5.0
|
FILES+= eval5.0
|
||||||
FILES+= eval6.0
|
FILES+= eval6.0
|
||||||
|
FILES+= eval7.0
|
||||||
|
FILES+= eval8.7
|
||||||
FILES+= exec1.0
|
FILES+= exec1.0
|
||||||
FILES+= exec2.0
|
FILES+= exec2.0
|
||||||
FILES+= exit1.0
|
FILES+= exit1.0
|
||||||
@@ -96,6 +102,7 @@ FILES+= jobid2.0
|
|||||||
FILES+= kill1.0 kill2.0
|
FILES+= kill1.0 kill2.0
|
||||||
FILES+= lineno.0 lineno.0.stdout
|
FILES+= lineno.0 lineno.0.stdout
|
||||||
FILES+= lineno2.0
|
FILES+= lineno2.0
|
||||||
|
FILES+= lineno3.0 lineno3.0.stdout
|
||||||
FILES+= local1.0
|
FILES+= local1.0
|
||||||
FILES+= local2.0
|
FILES+= local2.0
|
||||||
FILES+= local3.0
|
FILES+= local3.0
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
# $FreeBSD$
|
||||||
|
# Assumes that break can break out of a loop outside eval.
|
||||||
|
|
||||||
|
while :; do
|
||||||
|
eval "break
|
||||||
|
echo bad1"
|
||||||
|
echo bad2
|
||||||
|
exit 3
|
||||||
|
done
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
# $FreeBSD$
|
||||||
|
|
||||||
|
f() {
|
||||||
|
eval "return 7
|
||||||
|
echo bad2"
|
||||||
|
}
|
||||||
|
f
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
# $FreeBSD$
|
||||||
|
|
||||||
|
args='-ab'
|
||||||
|
getopts ab opt $args
|
||||||
|
echo $?:$opt:$OPTARG
|
||||||
|
for dummy in dummy1 dummy2; do
|
||||||
|
getopts ab opt $args
|
||||||
|
echo $?:$opt:$OPTARG
|
||||||
|
done
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
0:a:
|
||||||
|
0:b:
|
||||||
|
1:?:
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
# $FreeBSD$
|
||||||
|
|
||||||
|
echo before: $LINENO
|
||||||
|
dummy=$'a\0
|
||||||
|
'
|
||||||
|
echo after: $LINENO
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
before: 3
|
||||||
|
after: 6
|
||||||
@@ -1,9 +1,11 @@
|
|||||||
# $FreeBSD$
|
# $FreeBSD$
|
||||||
|
|
||||||
.include <bsd.own.mk>
|
TESTSDIR= ${TESTSBASE}/bin/sh/${.CURDIR:T}
|
||||||
|
|
||||||
FILESDIR= ${TESTSBASE}/bin/sh/errors
|
.PATH: ${.CURDIR:H}
|
||||||
KYUAFILE= no
|
ATF_TESTS_SH= functional_test
|
||||||
|
|
||||||
|
FILESDIR= ${TESTSDIR}
|
||||||
|
|
||||||
FILES= assignment-error1.0
|
FILES= assignment-error1.0
|
||||||
FILES+= assignment-error2.0
|
FILES+= assignment-error2.0
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
# $FreeBSD$
|
# $FreeBSD$
|
||||||
${}
|
eval '${}'
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
./errors/bad-parm-exp2.2: ${}: Bad substitution
|
eval: ${}: Bad substitution
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
# $FreeBSD$
|
# $FreeBSD$
|
||||||
${foo/}
|
eval '${foo/}'
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
./errors/bad-parm-exp3.2: ${foo/}: Bad substitution
|
eval: ${foo/}: Bad substitution
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
# $FreeBSD$
|
# $FreeBSD$
|
||||||
${foo:@abc}
|
eval '${foo:@abc}'
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
./errors/bad-parm-exp4.2: ${foo:@...}: Bad substitution
|
eval: ${foo:@...}: Bad substitution
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
# $FreeBSD$
|
# $FreeBSD$
|
||||||
${/}
|
eval '${/}'
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
./errors/bad-parm-exp5.2: ${/}: Bad substitution
|
eval: ${/}: Bad substitution
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
# $FreeBSD$
|
# $FreeBSD$
|
||||||
${#foo^}
|
eval '${#foo^}'
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
./errors/bad-parm-exp6.2: ${foo...}: Bad substitution
|
eval: ${foo...}: Bad substitution
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
# $FreeBSD$
|
# $FreeBSD$
|
||||||
|
|
||||||
.include <bsd.own.mk>
|
TESTSDIR= ${TESTSBASE}/bin/sh/${.CURDIR:T}
|
||||||
|
|
||||||
FILESDIR= ${TESTSBASE}/bin/sh/execution
|
.PATH: ${.CURDIR:H}
|
||||||
KYUAFILE= no
|
ATF_TESTS_SH= functional_test
|
||||||
|
|
||||||
|
FILESDIR= ${TESTSDIR}
|
||||||
|
|
||||||
FILES= bg1.0
|
FILES= bg1.0
|
||||||
FILES+= bg2.0
|
FILES+= bg2.0
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
# $FreeBSD$
|
# $FreeBSD$
|
||||||
|
|
||||||
.include <bsd.own.mk>
|
TESTSDIR= ${TESTSBASE}/bin/sh/${.CURDIR:T}
|
||||||
|
|
||||||
FILESDIR= ${TESTSBASE}/bin/sh/expansion
|
.PATH: ${.CURDIR:H}
|
||||||
KYUAFILE= no
|
ATF_TESTS_SH= functional_test
|
||||||
|
|
||||||
|
FILESDIR= ${TESTSDIR}
|
||||||
|
|
||||||
FILES= arith1.0
|
FILES= arith1.0
|
||||||
FILES+= arith2.0
|
FILES+= arith2.0
|
||||||
@@ -18,6 +20,7 @@ FILES+= arith10.0
|
|||||||
FILES+= arith11.0
|
FILES+= arith11.0
|
||||||
FILES+= arith12.0
|
FILES+= arith12.0
|
||||||
FILES+= arith13.0
|
FILES+= arith13.0
|
||||||
|
FILES+= arith14.0
|
||||||
FILES+= assign1.0
|
FILES+= assign1.0
|
||||||
FILES+= cmdsubst1.0
|
FILES+= cmdsubst1.0
|
||||||
FILES+= cmdsubst2.0
|
FILES+= cmdsubst2.0
|
||||||
@@ -69,6 +72,7 @@ FILES+= plus-minus7.0
|
|||||||
FILES+= plus-minus8.0
|
FILES+= plus-minus8.0
|
||||||
FILES+= question1.0
|
FILES+= question1.0
|
||||||
FILES+= readonly1.0
|
FILES+= readonly1.0
|
||||||
|
FILES+= redir1.0
|
||||||
FILES+= set-u1.0
|
FILES+= set-u1.0
|
||||||
FILES+= set-u2.0
|
FILES+= set-u2.0
|
||||||
FILES+= set-u3.0
|
FILES+= set-u3.0
|
||||||
|
|||||||
@@ -0,0 +1,40 @@
|
|||||||
|
# $FreeBSD$
|
||||||
|
# Check that <</>> use the low bits of the shift count.
|
||||||
|
|
||||||
|
if [ $((1<<16<<16)) = 0 ]; then
|
||||||
|
width=32
|
||||||
|
elif [ $((1<<32<<32)) = 0 ]; then
|
||||||
|
width=64
|
||||||
|
elif [ $((1<<64<<64)) = 0 ]; then
|
||||||
|
width=128
|
||||||
|
elif [ $((1<<64>>64)) = 1 ]; then
|
||||||
|
# Integers are wider than 128 bits; assume arbitrary precision.
|
||||||
|
# Nothing to test here.
|
||||||
|
exit 0
|
||||||
|
else
|
||||||
|
echo "Cannot determine integer width"
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
|
||||||
|
twowidth=$((width * 2))
|
||||||
|
j=43 k=$((1 << (width - 2))) r=0
|
||||||
|
|
||||||
|
i=0
|
||||||
|
while [ $i -lt $twowidth ]; do
|
||||||
|
if [ "$((j << i))" != "$((j << (i + width)))" ]; then
|
||||||
|
echo "Problem with $j << $i"
|
||||||
|
r=2
|
||||||
|
fi
|
||||||
|
i=$((i + 1))
|
||||||
|
done
|
||||||
|
|
||||||
|
i=0
|
||||||
|
while [ $i -lt $twowidth ]; do
|
||||||
|
if [ "$((k >> i))" != "$((k >> (i + width)))" ]; then
|
||||||
|
echo "Problem with $k >> $i"
|
||||||
|
r=2
|
||||||
|
fi
|
||||||
|
i=$((i + 1))
|
||||||
|
done
|
||||||
|
|
||||||
|
exit $r
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
# $FreeBSD$
|
||||||
|
|
||||||
|
bad=0
|
||||||
|
for i in 0 1 2 3; do
|
||||||
|
for j in 0 1 2 3 4 5 6 7; do
|
||||||
|
for k in 0 1 2 3 4 5 6 7; do
|
||||||
|
case $i$j$k in
|
||||||
|
000) continue ;;
|
||||||
|
esac
|
||||||
|
set -- "$(printf \\$i$j$k@)"
|
||||||
|
set -- "${1%@}"
|
||||||
|
ff=
|
||||||
|
for f in /dev/null /dev/zero /; do
|
||||||
|
if [ -e "$f" ] && [ ! -e "$f$1" ]; then
|
||||||
|
ff=$f
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
[ -n "$ff" ] || continue
|
||||||
|
if { true <$ff$1; } 2>/dev/null; then
|
||||||
|
echo "Bad: $i$j$k ($ff)" >&2
|
||||||
|
: $((bad += 1))
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
done
|
||||||
|
done
|
||||||
|
exit $((bad ? 2 : 0))
|
||||||
Executable
+72
@@ -0,0 +1,72 @@
|
|||||||
|
#
|
||||||
|
# Copyright 2014 EMC Corp.
|
||||||
|
# All rights reserved.
|
||||||
|
#
|
||||||
|
# Redistribution and use in source and binary forms, with or without
|
||||||
|
# modification, are permitted provided that the following conditions are
|
||||||
|
# met:
|
||||||
|
#
|
||||||
|
# * Redistributions of source code must retain the above copyright
|
||||||
|
# notice, this list of conditions and the following disclaimer.
|
||||||
|
# * Redistributions in binary form must reproduce the above copyright
|
||||||
|
# notice, this list of conditions and the following disclaimer in the
|
||||||
|
# documentation and/or other materials provided with the distribution.
|
||||||
|
#
|
||||||
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
|
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
|
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
#
|
||||||
|
# $FreeBSD$
|
||||||
|
|
||||||
|
SRCDIR=$(atf_get_srcdir)
|
||||||
|
|
||||||
|
check()
|
||||||
|
{
|
||||||
|
local tc=${1}; shift
|
||||||
|
|
||||||
|
export SH=$(atf_config_get bin.sh.test_shell /bin/sh)
|
||||||
|
|
||||||
|
local err_file="${SRCDIR}/${tc}.stderr"
|
||||||
|
[ -f "${err_file}" ] && err_flag="-e file:${err_file}"
|
||||||
|
local out_file="${SRCDIR}/${tc}.stdout"
|
||||||
|
[ -f "${out_file}" ] && out_flag="-o file:${out_file}"
|
||||||
|
|
||||||
|
atf_check -s exit:${tc##*.} ${err_flag} ${out_flag} ${SH} "${SRCDIR}/${tc}"
|
||||||
|
}
|
||||||
|
|
||||||
|
add_testcase()
|
||||||
|
{
|
||||||
|
local tc=${1}
|
||||||
|
local tc_escaped word
|
||||||
|
|
||||||
|
case "${tc%.*}" in
|
||||||
|
*-*)
|
||||||
|
local IFS="-"
|
||||||
|
for word in ${tc%.*}; do
|
||||||
|
tc_escaped="${tc_escaped:+${tc_escaped}_}${word}"
|
||||||
|
done
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
tc_escaped=${tc%.*}
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
atf_test_case ${tc_escaped}
|
||||||
|
eval "${tc_escaped}_body() { check ${tc}; }"
|
||||||
|
atf_add_test_case ${tc_escaped}
|
||||||
|
}
|
||||||
|
|
||||||
|
atf_init_test_cases()
|
||||||
|
{
|
||||||
|
for path in $(find -Es "${SRCDIR}" -regex '.*\.[0-9]+$'); do
|
||||||
|
add_testcase ${path##*/}
|
||||||
|
done
|
||||||
|
}
|
||||||
@@ -1,46 +0,0 @@
|
|||||||
# $FreeBSD$
|
|
||||||
|
|
||||||
: ${SH:="__SH__"}
|
|
||||||
export SH
|
|
||||||
|
|
||||||
# TODO(jmmv): The Kyua TAP interface should be passing us the value of
|
|
||||||
# "srcdir" as an environment variable, just as it does with the ATF
|
|
||||||
# interface in the form of a configuration variable. For now, just try
|
|
||||||
# to guess this.
|
|
||||||
: ${TESTS_DATA:=$(dirname ${0})}
|
|
||||||
|
|
||||||
COUNTER=1
|
|
||||||
|
|
||||||
do_test() {
|
|
||||||
c=${COUNTER}
|
|
||||||
COUNTER=$((COUNTER+1))
|
|
||||||
${SH} $1 > tmp.stdout 2> tmp.stderr
|
|
||||||
if [ $? -ne $2 ]; then
|
|
||||||
echo "not ok ${c} - ${1} # wrong exit status"
|
|
||||||
rm tmp.stdout tmp.stderr
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
sed -I '' -e "s|^${TESTS_DATA}|.|" tmp.stderr
|
|
||||||
for i in stdout stderr; do
|
|
||||||
if [ -f ${1}.${i} ]; then
|
|
||||||
if ! cmp -s tmp.${i} ${1}.${i}; then
|
|
||||||
echo "not ok ${c} - ${1} # wrong output on ${i}"
|
|
||||||
rm tmp.stdout tmp.stderr
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
elif [ -s tmp.${i} ]; then
|
|
||||||
echo "not ok ${c} - ${1} # wrong output on ${i}"
|
|
||||||
rm tmp.stdout tmp.stderr
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
echo "ok ${c} - ${1}"
|
|
||||||
rm tmp.stdout tmp.stderr
|
|
||||||
}
|
|
||||||
|
|
||||||
TESTS=$(find -Es ${TESTS_DATA} -regex ".*\.[0-9]+")
|
|
||||||
printf "1..%d\n" $(echo ${TESTS} | wc -w)
|
|
||||||
|
|
||||||
for i in ${TESTS} ; do
|
|
||||||
do_test ${i} ${i##*.}
|
|
||||||
done
|
|
||||||
@@ -1,9 +1,11 @@
|
|||||||
# $FreeBSD$
|
# $FreeBSD$
|
||||||
|
|
||||||
.include <bsd.own.mk>
|
TESTSDIR= ${TESTSBASE}/bin/sh/${.CURDIR:T}
|
||||||
|
|
||||||
FILESDIR= ${TESTSBASE}/bin/sh/parameters
|
.PATH: ${.CURDIR:H}
|
||||||
KYUAFILE= no
|
ATF_TESTS_SH= functional_test
|
||||||
|
|
||||||
|
FILESDIR= ${TESTSDIR}
|
||||||
|
|
||||||
FILES= env1.0
|
FILES= env1.0
|
||||||
FILES+= exitstatus1.0
|
FILES+= exitstatus1.0
|
||||||
@@ -16,6 +18,8 @@ FILES+= positional2.0
|
|||||||
FILES+= positional3.0
|
FILES+= positional3.0
|
||||||
FILES+= positional4.0
|
FILES+= positional4.0
|
||||||
FILES+= positional5.0
|
FILES+= positional5.0
|
||||||
|
FILES+= positional6.0
|
||||||
|
FILES+= positional7.0
|
||||||
FILES+= pwd1.0
|
FILES+= pwd1.0
|
||||||
FILES+= pwd2.0
|
FILES+= pwd2.0
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,7 @@
|
|||||||
|
# $FreeBSD$
|
||||||
|
|
||||||
|
IFS=?
|
||||||
|
set p r
|
||||||
|
v=pqrs
|
||||||
|
r=${v#"$*"}
|
||||||
|
[ "$r" = pqrs ]
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
# $FreeBSD$
|
||||||
|
|
||||||
|
set -- / ''
|
||||||
|
IFS=*
|
||||||
|
set -- "$*"
|
||||||
|
IFS=:
|
||||||
|
args="$*"
|
||||||
|
[ "$#:$args" = "1:/*" ]
|
||||||
@@ -1,9 +1,11 @@
|
|||||||
# $FreeBSD$
|
# $FreeBSD$
|
||||||
|
|
||||||
.include <bsd.own.mk>
|
TESTSDIR= ${TESTSBASE}/bin/sh/${.CURDIR:T}
|
||||||
|
|
||||||
FILESDIR= ${TESTSBASE}/bin/sh/parser
|
.PATH: ${.CURDIR:H}
|
||||||
KYUAFILE= no
|
ATF_TESTS_SH= functional_test
|
||||||
|
|
||||||
|
FILESDIR= ${TESTSDIR}
|
||||||
|
|
||||||
FILES= alias1.0
|
FILES= alias1.0
|
||||||
FILES+= alias2.0
|
FILES+= alias2.0
|
||||||
@@ -52,6 +54,18 @@ FILES+= heredoc8.0
|
|||||||
FILES+= heredoc9.0
|
FILES+= heredoc9.0
|
||||||
FILES+= heredoc10.0
|
FILES+= heredoc10.0
|
||||||
FILES+= heredoc11.0
|
FILES+= heredoc11.0
|
||||||
|
FILES+= heredoc12.0
|
||||||
|
FILES+= line-cont1.0
|
||||||
|
FILES+= line-cont2.0
|
||||||
|
FILES+= line-cont3.0
|
||||||
|
FILES+= line-cont4.0
|
||||||
|
FILES+= line-cont5.0
|
||||||
|
FILES+= line-cont6.0
|
||||||
|
FILES+= line-cont7.0
|
||||||
|
FILES+= line-cont8.0
|
||||||
|
FILES+= line-cont9.0
|
||||||
|
FILES+= line-cont10.0
|
||||||
|
FILES+= line-cont11.0
|
||||||
FILES+= no-space1.0
|
FILES+= no-space1.0
|
||||||
FILES+= no-space2.0
|
FILES+= no-space2.0
|
||||||
FILES+= only-redir1.0
|
FILES+= only-redir1.0
|
||||||
|
|||||||
@@ -0,0 +1,47 @@
|
|||||||
|
# $FreeBSD$
|
||||||
|
|
||||||
|
failures=0
|
||||||
|
|
||||||
|
check() {
|
||||||
|
if ! eval "[ $* ]"; then
|
||||||
|
echo "Failed: $*"
|
||||||
|
: $((failures += 1))
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
longmark=`printf %01000d 4`
|
||||||
|
longmarkstripped=`printf %0999d 0`
|
||||||
|
|
||||||
|
check '"$(cat <<'"$longmark
|
||||||
|
$longmark"'
|
||||||
|
echo yes)" = "yes"'
|
||||||
|
|
||||||
|
check '"$(cat <<\'"$longmark
|
||||||
|
$longmark"'
|
||||||
|
echo yes)" = "yes"'
|
||||||
|
|
||||||
|
check '"$(cat <<'"$longmark
|
||||||
|
yes
|
||||||
|
$longmark"'
|
||||||
|
)" = "yes"'
|
||||||
|
|
||||||
|
check '"$(cat <<\'"$longmark
|
||||||
|
yes
|
||||||
|
$longmark"'
|
||||||
|
)" = "yes"'
|
||||||
|
|
||||||
|
check '"$(cat <<'"$longmark
|
||||||
|
$longmarkstripped
|
||||||
|
$longmark.
|
||||||
|
$longmark"'
|
||||||
|
)" = "'"$longmarkstripped
|
||||||
|
$longmark."'"'
|
||||||
|
|
||||||
|
check '"$(cat <<\'"$longmark
|
||||||
|
$longmarkstripped
|
||||||
|
$longmark.
|
||||||
|
$longmark"'
|
||||||
|
)" = "'"$longmarkstripped
|
||||||
|
$longmark."'"'
|
||||||
|
|
||||||
|
exit $((failures != 0))
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
# $FreeBSD$
|
||||||
|
|
||||||
|
i\
|
||||||
|
f
|
||||||
|
t\
|
||||||
|
r\
|
||||||
|
u\
|
||||||
|
e
|
||||||
|
t\
|
||||||
|
h\
|
||||||
|
e\
|
||||||
|
n
|
||||||
|
:
|
||||||
|
\
|
||||||
|
f\
|
||||||
|
i
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
# $FreeBSD$
|
||||||
|
|
||||||
|
v=XaaaXbbbX
|
||||||
|
[ "${v\
|
||||||
|
#\
|
||||||
|
*\
|
||||||
|
a}.${v\
|
||||||
|
#\
|
||||||
|
#\
|
||||||
|
*\
|
||||||
|
a}.${v\
|
||||||
|
%\
|
||||||
|
b\
|
||||||
|
*}.${v\
|
||||||
|
%\
|
||||||
|
%\
|
||||||
|
b\
|
||||||
|
*}" = aaXbbbX.XbbbX.XaaaXbb.XaaaX ]
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
# $FreeBSD$
|
||||||
|
|
||||||
|
T=$(mktemp "${TMPDIR:-/tmp}/sh-test.XXXXXXXX") || exit
|
||||||
|
trap 'rm -f -- "$T"' 0
|
||||||
|
w='#A'
|
||||||
|
# A naive pgetc_linecont() would push back two characters here, which
|
||||||
|
# fails if a new buffer is read between the two characters.
|
||||||
|
c='${w#\#}'
|
||||||
|
c=$c$c$c$c
|
||||||
|
c=$c$c$c$c
|
||||||
|
c=$c$c$c$c
|
||||||
|
c=$c$c$c$c
|
||||||
|
c=$c$c$c$c
|
||||||
|
c=$c$c$c$c
|
||||||
|
printf 'v=%s\n' "$c" >"$T"
|
||||||
|
. "$T"
|
||||||
|
if [ "${#v}" != 4096 ]; then
|
||||||
|
echo "Length is bad (${#v})"
|
||||||
|
exit 3
|
||||||
|
fi
|
||||||
|
case $v in
|
||||||
|
*[!A]*) echo "Content is bad"; exit 3 ;;
|
||||||
|
esac
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
# $FreeBSD$
|
||||||
|
|
||||||
|
[ "a\
|
||||||
|
b" = ab ]
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
# $FreeBSD$
|
||||||
|
|
||||||
|
v=`printf %s 'a\
|
||||||
|
b'`
|
||||||
|
w="`printf %s 'c\
|
||||||
|
d'`"
|
||||||
|
[ "$v$w" = abcd ]
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
# $FreeBSD$
|
||||||
|
|
||||||
|
v=abcd
|
||||||
|
[ "$\
|
||||||
|
v.$\
|
||||||
|
{v}.${\
|
||||||
|
v}.${v\
|
||||||
|
}" = abcd.abcd.abcd.abcd ]
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
# $FreeBSD$
|
||||||
|
|
||||||
|
bad=1
|
||||||
|
case x in
|
||||||
|
x\
|
||||||
|
) ;\
|
||||||
|
; *) exit 7
|
||||||
|
esac &\
|
||||||
|
& bad= &\
|
||||||
|
& : >\
|
||||||
|
>/dev/null
|
||||||
|
|
||||||
|
false |\
|
||||||
|
| [ -z "$bad" ]
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
# $FreeBSD$
|
||||||
|
|
||||||
|
v0\
|
||||||
|
=abc
|
||||||
|
|
||||||
|
v=$(cat <\
|
||||||
|
<\
|
||||||
|
E\
|
||||||
|
O\
|
||||||
|
F
|
||||||
|
${v0}d
|
||||||
|
EOF
|
||||||
|
)
|
||||||
|
|
||||||
|
w=$(cat <\
|
||||||
|
<\
|
||||||
|
-\
|
||||||
|
EOF
|
||||||
|
efgh
|
||||||
|
EOF
|
||||||
|
)
|
||||||
|
|
||||||
|
[ "$v.$w" = "abcd.efgh" ]
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
# $FreeBSD$
|
||||||
|
|
||||||
|
[ "$(\
|
||||||
|
(
|
||||||
|
1\
|
||||||
|
+ 1)\
|
||||||
|
)" = 2 ]
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
# $FreeBSD$
|
||||||
|
|
||||||
|
set -- a b c d e f g h i j
|
||||||
|
[ "${1\
|
||||||
|
0\
|
||||||
|
}" = j ]
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
# $FreeBSD$
|
||||||
|
|
||||||
|
[ "${$\
|
||||||
|
:\
|
||||||
|
+\
|
||||||
|
xyz}" = xyz ]
|
||||||
@@ -1,9 +1,11 @@
|
|||||||
# $FreeBSD$
|
# $FreeBSD$
|
||||||
|
|
||||||
.include <bsd.own.mk>
|
TESTSDIR= ${TESTSBASE}/bin/sh/${.CURDIR:T}
|
||||||
|
|
||||||
FILESDIR= ${TESTSBASE}/bin/sh/set-e
|
.PATH: ${.CURDIR:H}
|
||||||
KYUAFILE= no
|
ATF_TESTS_SH= functional_test
|
||||||
|
|
||||||
|
FILESDIR= ${TESTSDIR}
|
||||||
|
|
||||||
FILES= and1.0
|
FILES= and1.0
|
||||||
FILES+= and2.1
|
FILES+= and2.1
|
||||||
|
|||||||
+5
-8
@@ -510,12 +510,7 @@ exitshell_savedstatus(void)
|
|||||||
exiting_exitstatus = oexitstatus;
|
exiting_exitstatus = oexitstatus;
|
||||||
}
|
}
|
||||||
exitstatus = oexitstatus = exiting_exitstatus;
|
exitstatus = oexitstatus = exiting_exitstatus;
|
||||||
if (setjmp(loc1.loc)) {
|
if (!setjmp(loc1.loc)) {
|
||||||
goto l1;
|
|
||||||
}
|
|
||||||
if (setjmp(loc2.loc)) {
|
|
||||||
goto l2;
|
|
||||||
}
|
|
||||||
handler = &loc1;
|
handler = &loc1;
|
||||||
if ((p = trap[0]) != NULL && *p != '\0') {
|
if ((p = trap[0]) != NULL && *p != '\0') {
|
||||||
/*
|
/*
|
||||||
@@ -526,12 +521,14 @@ exitshell_savedstatus(void)
|
|||||||
trap[0] = NULL;
|
trap[0] = NULL;
|
||||||
evalstring(p, 0);
|
evalstring(p, 0);
|
||||||
}
|
}
|
||||||
l1: handler = &loc2; /* probably unnecessary */
|
}
|
||||||
|
if (!setjmp(loc2.loc)) {
|
||||||
|
handler = &loc2; /* probably unnecessary */
|
||||||
flushall();
|
flushall();
|
||||||
#if JOBS
|
#if JOBS
|
||||||
setjobctl(0);
|
setjobctl(0);
|
||||||
#endif
|
#endif
|
||||||
l2:
|
}
|
||||||
if (sig != 0 && sig != SIGSTOP && sig != SIGTSTP && sig != SIGTTIN &&
|
if (sig != 0 && sig != SIGSTOP && sig != SIGTSTP && sig != SIGTTIN &&
|
||||||
sig != SIGTTOU) {
|
sig != SIGTTOU) {
|
||||||
signal(sig, SIG_DFL);
|
signal(sig, SIG_DFL);
|
||||||
|
|||||||
@@ -1,6 +1,12 @@
|
|||||||
# @(#)Makefile 8.1 (Berkeley) 5/31/93
|
# @(#)Makefile 8.1 (Berkeley) 5/31/93
|
||||||
# $FreeBSD$
|
# $FreeBSD$
|
||||||
|
|
||||||
|
.include <src.opts.mk>
|
||||||
|
|
||||||
PROG= sleep
|
PROG= sleep
|
||||||
|
|
||||||
|
.if ${MK_TESTS} != "no"
|
||||||
|
SUBDIR+= tests
|
||||||
|
.endif
|
||||||
|
|
||||||
.include <bsd.prog.mk>
|
.include <bsd.prog.mk>
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
# $FreeBSD$
|
||||||
|
|
||||||
|
TESTSRC= ${.CURDIR}/../../../contrib/netbsd-tests/bin/sleep
|
||||||
|
.PATH: ${TESTSRC}
|
||||||
|
|
||||||
|
.include <bsd.own.mk>
|
||||||
|
|
||||||
|
TESTSDIR= ${TESTSBASE}/bin/sleep
|
||||||
|
ATF_TESTS_SH= sleep_test
|
||||||
|
ATF_TESTS_SH_SRC_sleep_test= t_sleep.sh
|
||||||
|
|
||||||
|
.include <bsd.test.mk>
|
||||||
@@ -8,7 +8,6 @@ IGNORE_PRAGMA= YES
|
|||||||
CFLAGS+= -DNEED_SOLARIS_BOOLEAN
|
CFLAGS+= -DNEED_SOLARIS_BOOLEAN
|
||||||
|
|
||||||
WARNS?= 6
|
WARNS?= 6
|
||||||
CSTD?= gnu89
|
|
||||||
|
|
||||||
# Do not lint the CDDL stuff. It is all externally maintained and
|
# Do not lint the CDDL stuff. It is all externally maintained and
|
||||||
# lint output is wasteful noise here.
|
# lint output is wasteful noise here.
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/sh
|
#!/bin/sh
|
||||||
#
|
#
|
||||||
# shellsnoop - A program to print read/write details from shells,
|
# shellsnoop - A program to print read/write details from shells,
|
||||||
# such as keystrokes and command outputs.
|
# such as keystrokes and command outputs.
|
||||||
@@ -140,18 +140,14 @@ dtrace -n '
|
|||||||
/*
|
/*
|
||||||
* Remember this PID is a shell child
|
* Remember this PID is a shell child
|
||||||
*/
|
*/
|
||||||
syscall::exec:entry, syscall::exece:entry
|
syscall::execve:entry
|
||||||
/execname == "sh" || execname == "ksh" || execname == "csh" ||
|
/execname == "sh" || execname == "ksh" || execname == "csh" ||
|
||||||
execname == "tcsh" || execname == "zsh" || execname == "bash"/
|
execname == "tcsh" || execname == "zsh" || execname == "bash"/
|
||||||
{
|
{
|
||||||
child[pid] = 1;
|
child[pid] = 1;
|
||||||
|
|
||||||
/* debug */
|
|
||||||
this->parent = (char *)curthread->t_procp->p_parent->p_user.u_comm;
|
|
||||||
OPT_debug == 1 ? printf("PID %d CMD %s started. (%s)\n",
|
|
||||||
pid, execname, stringof(this->parent)) : 1;
|
|
||||||
}
|
}
|
||||||
syscall::exec:entry, syscall::exece:entry
|
syscall::execve:entry
|
||||||
/(OPT_pid == 1 && PID != ppid) || (OPT_uid == 1 && UID != uid)/
|
/(OPT_pid == 1 && PID != ppid) || (OPT_uid == 1 && UID != uid)/
|
||||||
{
|
{
|
||||||
/* forget if filtered */
|
/* forget if filtered */
|
||||||
@@ -256,12 +252,12 @@ dtrace -n '
|
|||||||
/*
|
/*
|
||||||
* Cleanup
|
* Cleanup
|
||||||
*/
|
*/
|
||||||
syscall::rexit:entry
|
syscall::exit:entry
|
||||||
{
|
{
|
||||||
child[pid] = 0;
|
child[pid] = 0;
|
||||||
|
|
||||||
/* debug */
|
/* debug */
|
||||||
this->parent = (char *)curthread->t_procp->p_parent->p_user.u_comm;
|
this->parent = (char *)curthread->td_proc->p_pptr->p_comm;
|
||||||
OPT_debug == 1 ? printf("PID %d CMD %s exited. (%s)\n",
|
OPT_debug == 1 ? printf("PID %d CMD %s exited. (%s)\n",
|
||||||
pid, execname, stringof(this->parent)) : 1;
|
pid, execname, stringof(this->parent)) : 1;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -277,6 +277,19 @@ Generate a header file containing macros that correspond to probes in the
|
|||||||
specified provider definitions.
|
specified provider definitions.
|
||||||
This option should be used to generate a header file that is included by other
|
This option should be used to generate a header file that is included by other
|
||||||
source files for later use with the
|
source files for later use with the
|
||||||
|
.Fl G
|
||||||
|
option.
|
||||||
|
If the
|
||||||
|
.Fl o
|
||||||
|
option is present, the header file is saved using the pathname specified as the
|
||||||
|
argument for that option.
|
||||||
|
If the
|
||||||
|
.Fl o
|
||||||
|
option is not present and the DTrace program is contained within a file whose
|
||||||
|
name is
|
||||||
|
.Ar filename.d ,
|
||||||
|
then the header file is saved using the name
|
||||||
|
.Ar filename.h .
|
||||||
.It Fl H
|
.It Fl H
|
||||||
Print the pathnames of included files when invoking
|
Print the pathnames of included files when invoking
|
||||||
.Xr cpp 1
|
.Xr cpp 1
|
||||||
@@ -289,20 +302,6 @@ option to each
|
|||||||
.Xr cpp 1
|
.Xr cpp 1
|
||||||
invocation, causing it to display the list of pathnames, one for each line, to
|
invocation, causing it to display the list of pathnames, one for each line, to
|
||||||
standard error.
|
standard error.
|
||||||
.Fl G
|
|
||||||
option.
|
|
||||||
If the
|
|
||||||
.Fl o
|
|
||||||
option
|
|
||||||
is present, the header file is saved using the pathname specified as the
|
|
||||||
argument for that option.
|
|
||||||
If the
|
|
||||||
.Fl o
|
|
||||||
option is not present and the DTrace program is contained with a file whose
|
|
||||||
name is
|
|
||||||
.Ar filename.d ,
|
|
||||||
then the header file is saved using the name
|
|
||||||
.Ar filename.h .
|
|
||||||
.It Fl i Ar probe-id Op Oo Ar predicate Oc Ar action
|
.It Fl i Ar probe-id Op Oo Ar predicate Oc Ar action
|
||||||
Specify probe identifier
|
Specify probe identifier
|
||||||
.Ar ( probe-id )
|
.Ar ( probe-id )
|
||||||
|
|||||||
@@ -710,6 +710,9 @@ list_probe(dtrace_hdl_t *dtp, const dtrace_probedesc_t *pdp, void *arg)
|
|||||||
if (g_verbose && dtrace_probe_info(dtp, pdp, &p) == 0)
|
if (g_verbose && dtrace_probe_info(dtp, pdp, &p) == 0)
|
||||||
print_probe_info(&p);
|
print_probe_info(&p);
|
||||||
|
|
||||||
|
if (g_intr != 0)
|
||||||
|
return (1);
|
||||||
|
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1220,11 +1223,34 @@ intr(int signo)
|
|||||||
g_impatient = 1;
|
g_impatient = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
installsighands(void)
|
||||||
|
{
|
||||||
|
struct sigaction act, oact;
|
||||||
|
|
||||||
|
(void) sigemptyset(&act.sa_mask);
|
||||||
|
act.sa_flags = 0;
|
||||||
|
act.sa_handler = intr;
|
||||||
|
|
||||||
|
if (sigaction(SIGINT, NULL, &oact) == 0 && oact.sa_handler != SIG_IGN)
|
||||||
|
(void) sigaction(SIGINT, &act, NULL);
|
||||||
|
|
||||||
|
if (sigaction(SIGTERM, NULL, &oact) == 0 && oact.sa_handler != SIG_IGN)
|
||||||
|
(void) sigaction(SIGTERM, &act, NULL);
|
||||||
|
|
||||||
|
#if !defined(sun)
|
||||||
|
if (sigaction(SIGPIPE, NULL, &oact) == 0 && oact.sa_handler != SIG_IGN)
|
||||||
|
(void) sigaction(SIGPIPE, &act, NULL);
|
||||||
|
|
||||||
|
if (sigaction(SIGUSR1, NULL, &oact) == 0 && oact.sa_handler != SIG_IGN)
|
||||||
|
(void) sigaction(SIGUSR1, &act, NULL);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
main(int argc, char *argv[])
|
main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
dtrace_bufdesc_t buf;
|
dtrace_bufdesc_t buf;
|
||||||
struct sigaction act, oact;
|
|
||||||
dtrace_status_t status[2];
|
dtrace_status_t status[2];
|
||||||
dtrace_optval_t opt;
|
dtrace_optval_t opt;
|
||||||
dtrace_cmd_t *dcp;
|
dtrace_cmd_t *dcp;
|
||||||
@@ -1776,6 +1802,8 @@ main(int argc, char *argv[])
|
|||||||
if (g_ofile != NULL && (g_ofp = fopen(g_ofile, "a")) == NULL)
|
if (g_ofile != NULL && (g_ofp = fopen(g_ofile, "a")) == NULL)
|
||||||
fatal("failed to open output file '%s'", g_ofile);
|
fatal("failed to open output file '%s'", g_ofile);
|
||||||
|
|
||||||
|
installsighands();
|
||||||
|
|
||||||
oprintf("%5s %10s %17s %33s %s\n",
|
oprintf("%5s %10s %17s %33s %s\n",
|
||||||
"ID", "PROVIDER", "MODULE", "FUNCTION", "NAME");
|
"ID", "PROVIDER", "MODULE", "FUNCTION", "NAME");
|
||||||
|
|
||||||
@@ -1861,20 +1889,7 @@ main(int argc, char *argv[])
|
|||||||
if (opt != DTRACEOPT_UNSET)
|
if (opt != DTRACEOPT_UNSET)
|
||||||
notice("allowing destructive actions\n");
|
notice("allowing destructive actions\n");
|
||||||
|
|
||||||
(void) sigemptyset(&act.sa_mask);
|
installsighands();
|
||||||
act.sa_flags = 0;
|
|
||||||
act.sa_handler = intr;
|
|
||||||
|
|
||||||
if (sigaction(SIGINT, NULL, &oact) == 0 && oact.sa_handler != SIG_IGN)
|
|
||||||
(void) sigaction(SIGINT, &act, NULL);
|
|
||||||
|
|
||||||
if (sigaction(SIGTERM, NULL, &oact) == 0 && oact.sa_handler != SIG_IGN)
|
|
||||||
(void) sigaction(SIGTERM, &act, NULL);
|
|
||||||
|
|
||||||
#if !defined(sun)
|
|
||||||
if (sigaction(SIGUSR1, NULL, &oact) == 0 && oact.sa_handler != SIG_IGN)
|
|
||||||
(void) sigaction(SIGUSR1, &act, NULL);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Now that tracing is active and we are ready to consume trace data,
|
* Now that tracing is active and we are ready to consume trace data,
|
||||||
|
|||||||
@@ -34,14 +34,14 @@
|
|||||||
* leading underscores.
|
* leading underscores.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#pragma weak _go = go
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
go(int a)
|
go(int a)
|
||||||
{
|
{
|
||||||
return (a + 1);
|
return (a + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#pragma weak _go = go
|
||||||
|
|
||||||
static void
|
static void
|
||||||
handle(int sig)
|
handle(int sig)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ dtrace=$1
|
|||||||
t="season_8_mountain_of_madness_t"
|
t="season_8_mountain_of_madness_t"
|
||||||
pid=$$
|
pid=$$
|
||||||
|
|
||||||
rc=`$dtrace -n "BEGIN{ trace(pid$pid`$t)0); }"`
|
$dtrace -n "BEGIN{ trace(pid$pid\`$t)0); }"
|
||||||
|
rc=$?
|
||||||
|
|
||||||
exit $rc
|
exit $rc
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ dtrace=$1
|
|||||||
t="season_8_mountain_of_madness_t"
|
t="season_8_mountain_of_madness_t"
|
||||||
pid=$$
|
pid=$$
|
||||||
|
|
||||||
rc=`$dtrace -n "BEGIN{ trace(pid`$t)0); }"` -p $pid
|
$dtrace -n "BEGIN{ trace(pid$pid\`$t)0); }" -p $pid
|
||||||
|
rc=$?
|
||||||
|
|
||||||
exit $rc
|
exit $rc
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ dtrace=$1
|
|||||||
t="zelda_info_t"
|
t="zelda_info_t"
|
||||||
exe="tst.chasestrings.exe"
|
exe="tst.chasestrings.exe"
|
||||||
|
|
||||||
elfdump "./$exe" | grep -q '.SUNW_ctf'
|
elfdump -c "./$exe" | grep -Fq 'sh_name: .SUNW_ctf'
|
||||||
if [[ $? -ne 0 ]]; then
|
if [[ $? -ne 0 ]]; then
|
||||||
echo "CTF does not exist in $exe, that's a bug" >&2
|
echo "CTF does not exist in $exe, that's a bug" >&2
|
||||||
exit 1
|
exit 1
|
||||||
|
|||||||
@@ -25,10 +25,10 @@ if [ $# != 1 ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
dtrace=$1
|
dtrace=$1
|
||||||
t="season_7_lisa_the_vegetrian_t *"
|
t="season_7_lisa_the_vegetarian_t *"
|
||||||
exe="tst.aouttype.exe"
|
exe="tst.aouttype.exe"
|
||||||
|
|
||||||
elfdump "./$exe" | grep -q '.SUNW_ctf'
|
elfdump -c "./$exe" | grep -Fq 'sh_name: .SUNW_ctf'
|
||||||
if [[ $? -ne 0 ]]; then
|
if [[ $? -ne 0 ]]; then
|
||||||
echo "CTF does not exist in $exe, that's a bug" >&2
|
echo "CTF does not exist in $exe, that's a bug" >&2
|
||||||
exit 1
|
exit 1
|
||||||
@@ -37,7 +37,8 @@ fi
|
|||||||
./$exe &
|
./$exe &
|
||||||
pid=$!
|
pid=$!
|
||||||
|
|
||||||
rc=`$dtrace -n "BEGIN{ trace((pid$pid\`$t)0); exit(0); }"`
|
$dtrace -n "BEGIN{ trace((pid$pid\`$t)0); exit(0); }"
|
||||||
|
rc=$?
|
||||||
|
|
||||||
kill -9 $pid
|
kill -9 $pid
|
||||||
|
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ dtrace=$1
|
|||||||
t="zelda_info_t"
|
t="zelda_info_t"
|
||||||
exe="tst.chasestrings.exe"
|
exe="tst.chasestrings.exe"
|
||||||
|
|
||||||
elfdump "./$exe" | grep -q '.SUNW_ctf'
|
elfdump -c "./$exe" | grep -Fq 'sh_name: .SUNW_ctf'
|
||||||
if [[ $? -ne 0 ]]; then
|
if [[ $? -ne 0 ]]; then
|
||||||
echo "CTF does not exist in $exe, that's a bug" >&2
|
echo "CTF does not exist in $exe, that's a bug" >&2
|
||||||
exit 1
|
exit 1
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ dtrace=$1
|
|||||||
t="int"
|
t="int"
|
||||||
exe="tst.libtype.exe"
|
exe="tst.libtype.exe"
|
||||||
|
|
||||||
elfdump "./$exe" | grep -q '.SUNW_ctf'
|
elfdump -c "./$exe" | grep -Fq 'sh_name: .SUNW_ctf'
|
||||||
if [[ $? -eq 0 ]]; then
|
if [[ $? -eq 0 ]]; then
|
||||||
echo "CTF exists in $exe, that's a bug" >&2
|
echo "CTF exists in $exe, that's a bug" >&2
|
||||||
exit 1
|
exit 1
|
||||||
@@ -38,7 +38,8 @@ fi
|
|||||||
./$exe &
|
./$exe &
|
||||||
pid=$!
|
pid=$!
|
||||||
|
|
||||||
rc=`$dtrace -n "BEGIN{ trace((pid$pid\`$t)0); exit(0); }"`
|
$dtrace -n "BEGIN{ trace((pid$pid\`$t)0); exit(0); }"
|
||||||
|
rc=$?
|
||||||
|
|
||||||
kill -9 $pid
|
kill -9 $pid
|
||||||
|
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ dtrace=$1
|
|||||||
t="final_fantasy_info_t"
|
t="final_fantasy_info_t"
|
||||||
exe="tst.printtype.exe"
|
exe="tst.printtype.exe"
|
||||||
|
|
||||||
elfdump "./$exe" | grep -q '.SUNW_ctf'
|
elfdump -c "./$exe" | grep -Fq 'sh_name: .SUNW_ctf'
|
||||||
if [[ $? -ne 0 ]]; then
|
if [[ $? -ne 0 ]]; then
|
||||||
echo "CTF does not exist in $exe, that's a bug" >&2
|
echo "CTF does not exist in $exe, that's a bug" >&2
|
||||||
exit 1
|
exit 1
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ dtrace=$1
|
|||||||
t="final_fantasy_info_t"
|
t="final_fantasy_info_t"
|
||||||
exe="tst.printtype.exe"
|
exe="tst.printtype.exe"
|
||||||
|
|
||||||
elfdump "./$exe" | grep -q '.SUNW_ctf'
|
elfdump -c "./$exe" | grep -Fq 'sh_name: .SUNW_ctf'
|
||||||
if [[ $? -ne 0 ]]; then
|
if [[ $? -ne 0 ]]; then
|
||||||
echo "CTF does not exist in $exe, that's a bug" >&2
|
echo "CTF does not exist in $exe, that's a bug" >&2
|
||||||
exit 1
|
exit 1
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ dtrace=$1
|
|||||||
t="final_fantasy_info_t"
|
t="final_fantasy_info_t"
|
||||||
exe="tst.printtype.exe"
|
exe="tst.printtype.exe"
|
||||||
|
|
||||||
elfdump "./$exe" | grep -q '.SUNW_ctf'
|
elfdump -c "./$exe" | grep -Fq 'sh_name: .SUNW_ctf'
|
||||||
if [[ $? -ne 0 ]]; then
|
if [[ $? -ne 0 ]]; then
|
||||||
echo "CTF does not exist in $exe, that's a bug" >&2
|
echo "CTF does not exist in $exe, that's a bug" >&2
|
||||||
exit 1
|
exit 1
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ dtrace=$1
|
|||||||
t="final_fantasy_info_t"
|
t="final_fantasy_info_t"
|
||||||
exe="tst.printtype.exe"
|
exe="tst.printtype.exe"
|
||||||
|
|
||||||
elfdump "./$exe" | grep -q '.SUNW_ctf'
|
elfdump -c "./$exe" | grep -Fq 'sh_name: .SUNW_ctf'
|
||||||
if [[ $? -ne 0 ]]; then
|
if [[ $? -ne 0 ]]; then
|
||||||
echo "CTF does not exist in $exe, that's a bug" >&2
|
echo "CTF does not exist in $exe, that's a bug" >&2
|
||||||
exit 1
|
exit 1
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ dtrace=$1
|
|||||||
t="zelda_info_t"
|
t="zelda_info_t"
|
||||||
exe="tst.chasestrings.exe"
|
exe="tst.chasestrings.exe"
|
||||||
|
|
||||||
elfdump "./$exe" | grep -q '.SUNW_ctf'
|
elfdump -c "./$exe" | grep -Fq 'sh_name: .SUNW_ctf'
|
||||||
if [[ $? -ne 0 ]]; then
|
if [[ $? -ne 0 ]]; then
|
||||||
echo "CTF does not exist in $exe, that's a bug" >&2
|
echo "CTF does not exist in $exe, that's a bug" >&2
|
||||||
exit 1
|
exit 1
|
||||||
@@ -38,7 +38,7 @@ fi
|
|||||||
./$exe &
|
./$exe &
|
||||||
pid=$!
|
pid=$!
|
||||||
|
|
||||||
$dtrace -32 -qs /dev/stdin <<EOF
|
$dtrace -qs /dev/stdin <<EOF
|
||||||
typedef struct info {
|
typedef struct info {
|
||||||
char *zi_gamename;
|
char *zi_gamename;
|
||||||
int zi_ndungeons;
|
int zi_ndungeons;
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ fi
|
|||||||
dtrace=$1
|
dtrace=$1
|
||||||
exe="tst.chasestrings.exe"
|
exe="tst.chasestrings.exe"
|
||||||
|
|
||||||
elfdump "./$exe" | grep -q '.SUNW_ctf'
|
elfdump -c "./$exe" | grep -Fq 'sh_name: .SUNW_ctf'
|
||||||
if [[ $? -ne 0 ]]; then
|
if [[ $? -ne 0 ]]; then
|
||||||
echo "CTF does not exist in $exe, that's a bug" >&2
|
echo "CTF does not exist in $exe, that's a bug" >&2
|
||||||
exit 1
|
exit 1
|
||||||
|
|||||||
@@ -1,11 +0,0 @@
|
|||||||
#include <stdlib.h>
|
|
||||||
#include <sys/sdt.h>
|
|
||||||
#include "prov.h"
|
|
||||||
|
|
||||||
int
|
|
||||||
main(int argc, char **argv, char **envp)
|
|
||||||
{
|
|
||||||
envp[0] = (char*)0xff;
|
|
||||||
TESTER_ENTRY();
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
@@ -21,7 +21,7 @@
|
|||||||
.\"
|
.\"
|
||||||
.\" $FreeBSD$
|
.\" $FreeBSD$
|
||||||
.\"
|
.\"
|
||||||
.Dd October 24, 2013
|
.Dd October 8, 2014
|
||||||
.Dt LOCKSTAT 1
|
.Dt LOCKSTAT 1
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
@@ -238,10 +238,11 @@ Average duration of the events in nanoseconds, as appropriate for the event.
|
|||||||
For the profiling event, duration means interrupt latency.
|
For the profiling event, duration means interrupt latency.
|
||||||
.It Lock
|
.It Lock
|
||||||
Address of the lock; displayed symbolically if possible.
|
Address of the lock; displayed symbolically if possible.
|
||||||
.It CPU+PIL
|
.It CPU+Pri_Class
|
||||||
CPU plus processor interrupt level (PIL).
|
CPU plus the priority class of the interrupted thread.
|
||||||
For example, if CPU 4 is interrupted while at PIL 6, this will be reported as
|
For example, if CPU 4 is interrupted while running a timeshare thread, this
|
||||||
cpu[4]+6.
|
will be reported as
|
||||||
|
.Ql cpu[4]+TShar .
|
||||||
.It Caller
|
.It Caller
|
||||||
Address of the caller; displayed symbolically if possible.
|
Address of the caller; displayed symbolically if possible.
|
||||||
.El
|
.El
|
||||||
|
|||||||
@@ -50,6 +50,9 @@
|
|||||||
/* FreeBSD */
|
/* FreeBSD */
|
||||||
#include <sys/elf.h>
|
#include <sys/elf.h>
|
||||||
#include <sys/ksyms.h>
|
#include <sys/ksyms.h>
|
||||||
|
#include <sys/param.h>
|
||||||
|
#include <sys/module.h>
|
||||||
|
#include <sys/linker.h>
|
||||||
#endif
|
#endif
|
||||||
#include <sys/cpuvar.h>
|
#include <sys/cpuvar.h>
|
||||||
|
|
||||||
|
|||||||
@@ -76,8 +76,12 @@
|
|||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
extern boolean_t zfs_recover;
|
extern boolean_t zfs_recover;
|
||||||
|
extern uint64_t zfs_arc_max, zfs_arc_meta_limit;
|
||||||
|
extern int zfs_vdev_async_read_max_active;
|
||||||
#else
|
#else
|
||||||
boolean_t zfs_recover;
|
boolean_t zfs_recover;
|
||||||
|
uint64_t zfs_arc_max, zfs_arc_meta_limit;
|
||||||
|
int zfs_vdev_async_read_max_active;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const char cmdname[] = "zdb";
|
const char cmdname[] = "zdb";
|
||||||
@@ -89,7 +93,7 @@ extern void dump_intent_log(zilog_t *);
|
|||||||
uint64_t *zopt_object = NULL;
|
uint64_t *zopt_object = NULL;
|
||||||
int zopt_objects = 0;
|
int zopt_objects = 0;
|
||||||
libzfs_handle_t *g_zfs;
|
libzfs_handle_t *g_zfs;
|
||||||
uint64_t max_inflight = 200;
|
uint64_t max_inflight = 1000;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* These libumem hooks provide a reasonable set of defaults for the allocator's
|
* These libumem hooks provide a reasonable set of defaults for the allocator's
|
||||||
@@ -1461,6 +1465,11 @@ dump_deadlist(dsl_deadlist_t *dl)
|
|||||||
if (dump_opt['d'] < 3)
|
if (dump_opt['d'] < 3)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (dl->dl_oldfmt) {
|
||||||
|
dump_bpobj(&dl->dl_bpobj, "old-format deadlist", 0);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
zdb_nicenum(dl->dl_phys->dl_used, bytes);
|
zdb_nicenum(dl->dl_phys->dl_used, bytes);
|
||||||
zdb_nicenum(dl->dl_phys->dl_comp, comp);
|
zdb_nicenum(dl->dl_phys->dl_comp, comp);
|
||||||
zdb_nicenum(dl->dl_phys->dl_uncomp, uncomp);
|
zdb_nicenum(dl->dl_phys->dl_uncomp, uncomp);
|
||||||
@@ -2138,6 +2147,8 @@ dump_label(const char *dev)
|
|||||||
(void) close(fd);
|
(void) close(fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static uint64_t num_large_blocks;
|
||||||
|
|
||||||
/*ARGSUSED*/
|
/*ARGSUSED*/
|
||||||
static int
|
static int
|
||||||
dump_one_dir(const char *dsname, void *arg)
|
dump_one_dir(const char *dsname, void *arg)
|
||||||
@@ -2150,6 +2161,8 @@ dump_one_dir(const char *dsname, void *arg)
|
|||||||
(void) printf("Could not open %s, error %d\n", dsname, error);
|
(void) printf("Could not open %s, error %d\n", dsname, error);
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
if (dmu_objset_ds(os)->ds_large_blocks)
|
||||||
|
num_large_blocks++;
|
||||||
dump_dir(os);
|
dump_dir(os);
|
||||||
dmu_objset_disown(os, FTAG);
|
dmu_objset_disown(os, FTAG);
|
||||||
fuid_table_destroy();
|
fuid_table_destroy();
|
||||||
@@ -2160,7 +2173,7 @@ dump_one_dir(const char *dsname, void *arg)
|
|||||||
/*
|
/*
|
||||||
* Block statistics.
|
* Block statistics.
|
||||||
*/
|
*/
|
||||||
#define PSIZE_HISTO_SIZE (SPA_MAXBLOCKSIZE / SPA_MINBLOCKSIZE + 1)
|
#define PSIZE_HISTO_SIZE (SPA_OLD_MAXBLOCKSIZE / SPA_MINBLOCKSIZE + 2)
|
||||||
typedef struct zdb_blkstats {
|
typedef struct zdb_blkstats {
|
||||||
uint64_t zb_asize;
|
uint64_t zb_asize;
|
||||||
uint64_t zb_lsize;
|
uint64_t zb_lsize;
|
||||||
@@ -2225,7 +2238,15 @@ zdb_count_block(zdb_cb_t *zcb, zilog_t *zilog, const blkptr_t *bp,
|
|||||||
zb->zb_lsize += BP_GET_LSIZE(bp);
|
zb->zb_lsize += BP_GET_LSIZE(bp);
|
||||||
zb->zb_psize += BP_GET_PSIZE(bp);
|
zb->zb_psize += BP_GET_PSIZE(bp);
|
||||||
zb->zb_count++;
|
zb->zb_count++;
|
||||||
zb->zb_psize_histogram[BP_GET_PSIZE(bp) >> SPA_MINBLOCKSHIFT]++;
|
|
||||||
|
/*
|
||||||
|
* The histogram is only big enough to record blocks up to
|
||||||
|
* SPA_OLD_MAXBLOCKSIZE; larger blocks go into the last,
|
||||||
|
* "other", bucket.
|
||||||
|
*/
|
||||||
|
int idx = BP_GET_PSIZE(bp) >> SPA_MINBLOCKSHIFT;
|
||||||
|
idx = MIN(idx, SPA_OLD_MAXBLOCKSIZE / SPA_MINBLOCKSIZE + 1);
|
||||||
|
zb->zb_psize_histogram[idx]++;
|
||||||
|
|
||||||
zb->zb_gangs += BP_COUNT_GANG(bp);
|
zb->zb_gangs += BP_COUNT_GANG(bp);
|
||||||
|
|
||||||
@@ -2377,8 +2398,14 @@ zdb_blkptr_cb(spa_t *spa, zilog_t *zilog, const blkptr_t *bp,
|
|||||||
|
|
||||||
zcb->zcb_readfails = 0;
|
zcb->zcb_readfails = 0;
|
||||||
|
|
||||||
if (dump_opt['b'] < 5 && isatty(STDERR_FILENO) &&
|
/* only call gethrtime() every 100 blocks */
|
||||||
gethrtime() > zcb->zcb_lastprint + NANOSEC) {
|
static int iters;
|
||||||
|
if (++iters > 100)
|
||||||
|
iters = 0;
|
||||||
|
else
|
||||||
|
return (0);
|
||||||
|
|
||||||
|
if (dump_opt['b'] < 5 && gethrtime() > zcb->zcb_lastprint + NANOSEC) {
|
||||||
uint64_t now = gethrtime();
|
uint64_t now = gethrtime();
|
||||||
char buf[10];
|
char buf[10];
|
||||||
uint64_t bytes = zcb->zcb_type[ZB_TOTAL][ZDB_OT_TOTAL].zb_asize;
|
uint64_t bytes = zcb->zcb_type[ZB_TOTAL][ZDB_OT_TOTAL].zb_asize;
|
||||||
@@ -2462,9 +2489,9 @@ zdb_leak_init(spa_t *spa, zdb_cb_t *zcb)
|
|||||||
|
|
||||||
if (!dump_opt['L']) {
|
if (!dump_opt['L']) {
|
||||||
vdev_t *rvd = spa->spa_root_vdev;
|
vdev_t *rvd = spa->spa_root_vdev;
|
||||||
for (int c = 0; c < rvd->vdev_children; c++) {
|
for (uint64_t c = 0; c < rvd->vdev_children; c++) {
|
||||||
vdev_t *vd = rvd->vdev_child[c];
|
vdev_t *vd = rvd->vdev_child[c];
|
||||||
for (int m = 0; m < vd->vdev_ms_count; m++) {
|
for (uint64_t m = 0; m < vd->vdev_ms_count; m++) {
|
||||||
metaslab_t *msp = vd->vdev_ms[m];
|
metaslab_t *msp = vd->vdev_ms[m];
|
||||||
mutex_enter(&msp->ms_lock);
|
mutex_enter(&msp->ms_lock);
|
||||||
metaslab_unload(msp);
|
metaslab_unload(msp);
|
||||||
@@ -2477,7 +2504,24 @@ zdb_leak_init(spa_t *spa, zdb_cb_t *zcb)
|
|||||||
* interfaces.
|
* interfaces.
|
||||||
*/
|
*/
|
||||||
if (msp->ms_sm != NULL) {
|
if (msp->ms_sm != NULL) {
|
||||||
|
(void) fprintf(stderr,
|
||||||
|
"\rloading space map for "
|
||||||
|
"vdev %llu of %llu, "
|
||||||
|
"metaslab %llu of %llu ...",
|
||||||
|
(longlong_t)c,
|
||||||
|
(longlong_t)rvd->vdev_children,
|
||||||
|
(longlong_t)m,
|
||||||
|
(longlong_t)vd->vdev_ms_count);
|
||||||
|
|
||||||
msp->ms_ops = &zdb_metaslab_ops;
|
msp->ms_ops = &zdb_metaslab_ops;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* We don't want to spend the CPU
|
||||||
|
* manipulating the size-ordered
|
||||||
|
* tree, so clear the range_tree
|
||||||
|
* ops.
|
||||||
|
*/
|
||||||
|
msp->ms_tree->rt_ops = NULL;
|
||||||
VERIFY0(space_map_load(msp->ms_sm,
|
VERIFY0(space_map_load(msp->ms_sm,
|
||||||
msp->ms_tree, SM_ALLOC));
|
msp->ms_tree, SM_ALLOC));
|
||||||
msp->ms_loaded = B_TRUE;
|
msp->ms_loaded = B_TRUE;
|
||||||
@@ -2485,6 +2529,7 @@ zdb_leak_init(spa_t *spa, zdb_cb_t *zcb)
|
|||||||
mutex_exit(&msp->ms_lock);
|
mutex_exit(&msp->ms_lock);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
(void) fprintf(stderr, "\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
spa_config_enter(spa, SCL_CONFIG, FTAG, RW_READER);
|
spa_config_enter(spa, SCL_CONFIG, FTAG, RW_READER);
|
||||||
@@ -2594,11 +2639,13 @@ dump_block_stats(spa_t *spa)
|
|||||||
* all async I/Os to complete.
|
* all async I/Os to complete.
|
||||||
*/
|
*/
|
||||||
if (dump_opt['c']) {
|
if (dump_opt['c']) {
|
||||||
(void) zio_wait(spa->spa_async_zio_root);
|
for (int i = 0; i < max_ncpus; i++) {
|
||||||
spa->spa_async_zio_root = zio_root(spa, NULL, NULL,
|
(void) zio_wait(spa->spa_async_zio_root[i]);
|
||||||
|
spa->spa_async_zio_root[i] = zio_root(spa, NULL, NULL,
|
||||||
ZIO_FLAG_CANFAIL | ZIO_FLAG_SPECULATIVE |
|
ZIO_FLAG_CANFAIL | ZIO_FLAG_SPECULATIVE |
|
||||||
ZIO_FLAG_GODFATHER);
|
ZIO_FLAG_GODFATHER);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (zcb.zcb_haderrors) {
|
if (zcb.zcb_haderrors) {
|
||||||
(void) printf("\nError counts:\n\n");
|
(void) printf("\nError counts:\n\n");
|
||||||
@@ -2911,6 +2958,7 @@ dump_zpool(spa_t *spa)
|
|||||||
dump_metaslab_groups(spa);
|
dump_metaslab_groups(spa);
|
||||||
|
|
||||||
if (dump_opt['d'] || dump_opt['i']) {
|
if (dump_opt['d'] || dump_opt['i']) {
|
||||||
|
uint64_t refcount;
|
||||||
dump_dir(dp->dp_meta_objset);
|
dump_dir(dp->dp_meta_objset);
|
||||||
if (dump_opt['d'] >= 3) {
|
if (dump_opt['d'] >= 3) {
|
||||||
dump_bpobj(&spa->spa_deferred_bpobj,
|
dump_bpobj(&spa->spa_deferred_bpobj,
|
||||||
@@ -2930,8 +2978,21 @@ dump_zpool(spa_t *spa)
|
|||||||
}
|
}
|
||||||
(void) dmu_objset_find(spa_name(spa), dump_one_dir,
|
(void) dmu_objset_find(spa_name(spa), dump_one_dir,
|
||||||
NULL, DS_FIND_SNAPSHOTS | DS_FIND_CHILDREN);
|
NULL, DS_FIND_SNAPSHOTS | DS_FIND_CHILDREN);
|
||||||
|
|
||||||
|
(void) feature_get_refcount(spa,
|
||||||
|
&spa_feature_table[SPA_FEATURE_LARGE_BLOCKS], &refcount);
|
||||||
|
if (num_large_blocks != refcount) {
|
||||||
|
(void) printf("large_blocks feature refcount mismatch: "
|
||||||
|
"expected %lld != actual %lld\n",
|
||||||
|
(longlong_t)num_large_blocks,
|
||||||
|
(longlong_t)refcount);
|
||||||
|
rc = 2;
|
||||||
|
} else {
|
||||||
|
(void) printf("Verified large_blocks feature refcount "
|
||||||
|
"is correct (%llu)\n", (longlong_t)refcount);
|
||||||
}
|
}
|
||||||
if (dump_opt['b'] || dump_opt['c'])
|
}
|
||||||
|
if (rc == 0 && (dump_opt['b'] || dump_opt['c']))
|
||||||
rc = dump_block_stats(spa);
|
rc = dump_block_stats(spa);
|
||||||
|
|
||||||
if (rc == 0)
|
if (rc == 0)
|
||||||
@@ -3483,6 +3544,19 @@ main(int argc, char **argv)
|
|||||||
usage();
|
usage();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* ZDB does not typically re-read blocks; therefore limit the ARC
|
||||||
|
* to 256 MB, which can be used entirely for metadata.
|
||||||
|
*/
|
||||||
|
zfs_arc_max = zfs_arc_meta_limit = 256 * 1024 * 1024;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* "zdb -c" uses checksum-verifying scrub i/os which are async reads.
|
||||||
|
* "zdb -b" uses traversal prefetch which uses async reads.
|
||||||
|
* For good performance, let several of them be active at once.
|
||||||
|
*/
|
||||||
|
zfs_vdev_async_read_max_active = 10;
|
||||||
|
|
||||||
kernel_init(FREAD);
|
kernel_init(FREAD);
|
||||||
g_zfs = libzfs_init();
|
g_zfs = libzfs_init();
|
||||||
ASSERT(g_zfs != NULL);
|
ASSERT(g_zfs != NULL);
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user