Merge from head
This commit is contained in:
+5
-2
@@ -28,6 +28,7 @@ MAC Framework rwatson Pre-commit review requested.
|
||||
MAC Modules rwatson Pre-commit review requested.
|
||||
contrib/openbsm rwatson Pre-commit review requested.
|
||||
sys/security/audit rwatson Pre-commit review requested.
|
||||
ath(4) adrian Pre-commit review requested, send to freebsd-wireless@freebsd.org
|
||||
ahc(4) gibbs Pre-commit review requested.
|
||||
ahd(4) gibbs Pre-commit review requested.
|
||||
PC Card imp Pre-commit review requested.
|
||||
@@ -63,8 +64,7 @@ procfs des Pre-commit review requested.
|
||||
linprocfs des Pre-commit review requested.
|
||||
lpr gad Pre-commit review requested, particularly for
|
||||
lpd/recvjob.c and lpd/printjob.c.
|
||||
newsyslog(8) gad Heads-up appreciated. I'm going thru the PR's for it.
|
||||
cvs peter Heads-up appreciated, try not to break it.
|
||||
net80211 adrian Pre-commit review requested, send to freebsd-wireless@freebsd.org
|
||||
nvi peter Try not to break it.
|
||||
libz peter Try not to break it.
|
||||
groff ru Recommends pre-commit review.
|
||||
@@ -128,3 +128,6 @@ sysdoc trhodes Pre-commit review preferred.
|
||||
sh(1) jilles Pre-commit review requested. This also applies
|
||||
to kill(1), printf(1) and test(1) which are
|
||||
compiled in as builtins.
|
||||
nvme(4) jimharris Pre-commit review requested.
|
||||
nvd(4) jimharris Pre-commit review requested.
|
||||
nvmecontrol(8) jimharris Pre-commit review requested.
|
||||
|
||||
@@ -32,6 +32,12 @@
|
||||
# targets - Print a list of supported TARGET/TARGET_ARCH pairs
|
||||
# for world and kernel targets.
|
||||
# toolchains - Build a toolchain for all world and kernel targets.
|
||||
#
|
||||
# "quick" way to test all kernel builds:
|
||||
# _jflag=`sysctl -n hw.ncpu`
|
||||
# _jflag=$(($_jflag * 2))
|
||||
# [ $_jflag -gt 12 ] && _jflag=12
|
||||
# make universe -DMAKE_JUST_KERNELS JFLAG=-j${_jflag}
|
||||
#
|
||||
# This makefile is simple by design. The FreeBSD make automatically reads
|
||||
# the /usr/share/mk/sys.mk unless the -m argument is specified on the
|
||||
@@ -65,8 +71,8 @@
|
||||
# 5. `reboot' (in single user mode: boot -s from the loader prompt).
|
||||
# 6. `mergemaster -p'
|
||||
# 7. `make installworld'
|
||||
# 8. `make delete-old'
|
||||
# 9. `mergemaster' (you may wish to use -i, along with -U or -F).
|
||||
# 8. `mergemaster' (you may wish to use -i, along with -U or -F).
|
||||
# 9. `make delete-old'
|
||||
# 10. `reboot'
|
||||
# 11. `make delete-old-libs' (in case no 3rd party program uses them anymore)
|
||||
#
|
||||
@@ -124,11 +130,34 @@ _MAKEOBJDIRPREFIX!= /usr/bin/env -i PATH=${PATH} ${MAKE} \
|
||||
.error MAKEOBJDIRPREFIX can only be set in environment, not as a global\
|
||||
(in make.conf(5)) or command-line variable.
|
||||
.endif
|
||||
MAKEPATH= ${MAKEOBJDIRPREFIX}${.CURDIR}/make.${MACHINE}
|
||||
BINMAKE= \
|
||||
`if [ -x ${MAKEPATH}/make ]; then echo ${MAKEPATH}/make; else echo ${MAKE}; fi` \
|
||||
|
||||
# We often need to use the tree's version of make to build it.
|
||||
# Choices add to complexity though.
|
||||
# We cannot blindly use a make which may not be the one we want
|
||||
# so be exlicit - until all choice is removed.
|
||||
.if !defined(WITHOUT_BMAKE)
|
||||
WANT_MAKE= bmake
|
||||
.else
|
||||
WANT_MAKE= fmake
|
||||
.endif
|
||||
MYMAKE= ${MAKEOBJDIRPREFIX}${.CURDIR}/make.${MACHINE}/${WANT_MAKE}
|
||||
.if defined(.PARSEDIR)
|
||||
HAVE_MAKE= bmake
|
||||
.else
|
||||
HAVE_MAKE= fmake
|
||||
.endif
|
||||
.if exists(${MYMAKE})
|
||||
SUB_MAKE:= ${MYMAKE} -m ${.CURDIR}/share/mk
|
||||
.elif ${WANT_MAKE} != ${HAVE_MAKE} || ${WANT_MAKE} != "bmake"
|
||||
# It may not exist yet but we may cause it to.
|
||||
# In the case of fmake, upgrade_checks may cause a newer version to be built.
|
||||
SUB_MAKE= `test -x ${MYMAKE} && echo ${MYMAKE} || echo ${MAKE}` \
|
||||
-m ${.CURDIR}/share/mk
|
||||
_MAKE= PATH=${PATH} ${BINMAKE} -f Makefile.inc1 TARGET=${_TARGET} TARGET_ARCH=${_TARGET_ARCH}
|
||||
.else
|
||||
SUB_MAKE= ${MAKE} -m ${.CURDIR}/share/mk
|
||||
.endif
|
||||
|
||||
_MAKE= PATH=${PATH} ${SUB_MAKE} -f Makefile.inc1 TARGET=${_TARGET} TARGET_ARCH=${_TARGET_ARCH}
|
||||
|
||||
# Guess machine architecture from machine type, and vice versa.
|
||||
.if !defined(TARGET_ARCH) && defined(TARGET)
|
||||
@@ -209,6 +238,13 @@ cleanworld:
|
||||
# Handle the user-driven targets, using the source relative mk files.
|
||||
#
|
||||
|
||||
.if empty(.MAKEFLAGS:M-n)
|
||||
# skip this for -n to avoid changing previous behavior of
|
||||
# 'make -n buildworld' etc.
|
||||
${TGTS}: .MAKE
|
||||
tinderbox toolchains kernel-toolchains: .MAKE
|
||||
.endif
|
||||
|
||||
${TGTS}:
|
||||
${_+_}@cd ${.CURDIR}; ${_MAKE} ${.TARGET}
|
||||
|
||||
@@ -279,11 +315,13 @@ kernel: buildkernel installkernel
|
||||
# Perform a few tests to determine if the installed tools are adequate
|
||||
# for building the world.
|
||||
#
|
||||
# Note: if we ever need to care about the version of bmake, simply testing
|
||||
# MAKE_VERSION against a required version should suffice.
|
||||
#
|
||||
upgrade_checks:
|
||||
.if !defined(.PARSEDIR)
|
||||
.if defined(WITH_BMAKE)
|
||||
(cd ${.CURDIR} && ${MAKE} bmake)
|
||||
.else
|
||||
.if ${HAVE_MAKE} != ${WANT_MAKE}
|
||||
@(cd ${.CURDIR} && ${MAKE} ${WANT_MAKE:S,^f,,})
|
||||
.elif ${WANT_MAKE} == "fmake"
|
||||
@if ! (cd ${.CURDIR}/tools/build/make_check && \
|
||||
PATH=${PATH} ${BINMAKE} obj >/dev/null 2>&1 && \
|
||||
PATH=${PATH} ${BINMAKE} >/dev/null 2>&1); \
|
||||
@@ -291,14 +329,13 @@ upgrade_checks:
|
||||
(cd ${.CURDIR} && ${MAKE} make); \
|
||||
fi
|
||||
.endif
|
||||
.endif
|
||||
|
||||
#
|
||||
# Upgrade make(1) to the current version using the installed
|
||||
# headers, libraries and tools. Also, allow the location of
|
||||
# the system bsdmake-like utility to be overridden.
|
||||
#
|
||||
MMAKEENV= MAKEOBJDIRPREFIX=${MAKEPATH} \
|
||||
MMAKEENV= MAKEOBJDIRPREFIX=${MYMAKE:H} \
|
||||
DESTDIR= \
|
||||
INSTALL="sh ${.CURDIR}/tools/install.sh"
|
||||
MMAKE= ${MMAKEENV} ${MAKE} \
|
||||
@@ -312,19 +349,21 @@ make bmake: .PHONY
|
||||
@echo ">>> Building an up-to-date make(1)"
|
||||
@echo "--------------------------------------------------------------"
|
||||
${_+_}@cd ${.CURDIR}/usr.bin/${.TARGET}; \
|
||||
${MMAKE} obj && \
|
||||
${MMAKE} depend && \
|
||||
${MMAKE} all && \
|
||||
${MMAKE} install DESTDIR=${MAKEPATH} BINDIR=
|
||||
${MMAKE} obj DESTDIR= && \
|
||||
${MMAKE} depend DESTDIR= && \
|
||||
${MMAKE} all DESTDIR= && \
|
||||
${MMAKE} install DESTDIR=${MYMAKE:H} BINDIR= PROGNAME=${MYMAKE:T}
|
||||
|
||||
tinderbox toolchains kernel-toolchains: upgrade_checks
|
||||
|
||||
tinderbox:
|
||||
@cd ${.CURDIR} && ${MAKE} DOING_TINDERBOX=YES universe
|
||||
@cd ${.CURDIR} && ${SUB_MAKE} DOING_TINDERBOX=YES universe
|
||||
|
||||
toolchains:
|
||||
@cd ${.CURDIR} && ${MAKE} UNIVERSE_TARGET=toolchain universe
|
||||
@cd ${.CURDIR} && ${SUB_MAKE} UNIVERSE_TARGET=toolchain universe
|
||||
|
||||
kernel-toolchains:
|
||||
@cd ${.CURDIR} && ${MAKE} UNIVERSE_TARGET=kernel-toolchain universe
|
||||
@cd ${.CURDIR} && ${SUB_MAKE} UNIVERSE_TARGET=kernel-toolchain universe
|
||||
|
||||
#
|
||||
# universe
|
||||
@@ -365,7 +404,8 @@ MAKEFAIL=tee -a ${FAILFILE}
|
||||
MAKEFAIL=cat
|
||||
.endif
|
||||
|
||||
universe: universe_prologue upgrade_checks
|
||||
universe_prologue: upgrade_checks
|
||||
universe: universe_prologue
|
||||
universe_prologue:
|
||||
@echo "--------------------------------------------------------------"
|
||||
@echo ">>> make universe started on ${STARTTIME}"
|
||||
@@ -375,17 +415,17 @@ universe_prologue:
|
||||
.endif
|
||||
.for target in ${TARGETS}
|
||||
universe: universe_${target}
|
||||
.ORDER: universe_prologue upgrade_checks universe_${target}_prologue universe_${target} universe_epilogue
|
||||
universe_epilogue: universe_${target}
|
||||
universe_${target}: universe_${target}_prologue
|
||||
universe_${target}_prologue:
|
||||
universe_${target}_prologue: universe_prologue
|
||||
@echo ">> ${target} started on `LC_ALL=C date`"
|
||||
.if !defined(MAKE_JUST_KERNELS)
|
||||
.for target_arch in ${TARGET_ARCHES_${target}}
|
||||
universe_${target}: universe_${target}_${target_arch}
|
||||
universe_${target}_${target_arch}: universe_${target}_prologue
|
||||
universe_${target}_${target_arch}: universe_${target}_prologue .MAKE
|
||||
@echo ">> ${target}.${target_arch} ${UNIVERSE_TARGET} started on `LC_ALL=C date`"
|
||||
@(cd ${.CURDIR} && env __MAKE_CONF=/dev/null \
|
||||
${MAKE} ${JFLAG} ${UNIVERSE_TARGET} \
|
||||
${SUB_MAKE} ${JFLAG} ${UNIVERSE_TARGET} \
|
||||
TARGET=${target} \
|
||||
TARGET_ARCH=${target_arch} \
|
||||
> _.${target}.${target_arch}.${UNIVERSE_TARGET} 2>&1 || \
|
||||
@@ -403,14 +443,14 @@ universe_${target}_kernels: universe_${target}_${target_arch}
|
||||
.endfor
|
||||
.endif
|
||||
universe_${target}: universe_${target}_kernels
|
||||
universe_${target}_kernels: universe_${target}_prologue
|
||||
universe_${target}_kernels: universe_${target}_prologue .MAKE
|
||||
.if exists(${KERNSRCDIR}/${target}/conf/NOTES)
|
||||
@(cd ${KERNSRCDIR}/${target}/conf && env __MAKE_CONF=/dev/null \
|
||||
${MAKE} LINT > ${.CURDIR}/_.${target}.makeLINT 2>&1 || \
|
||||
${SUB_MAKE} LINT > ${.CURDIR}/_.${target}.makeLINT 2>&1 || \
|
||||
(echo "${target} 'make LINT' failed," \
|
||||
"check _.${target}.makeLINT for details"| ${MAKEFAIL}))
|
||||
.endif
|
||||
@cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} TARGET=${target} \
|
||||
@cd ${.CURDIR} && ${SUB_MAKE} ${.MAKEFLAGS} TARGET=${target} \
|
||||
universe_kernels
|
||||
.endif
|
||||
@echo ">> ${target} completed on `LC_ALL=C date`"
|
||||
@@ -431,9 +471,9 @@ TARGET_ARCH_${kernel}!= cd ${KERNSRCDIR}/${TARGET}/conf && \
|
||||
.error "Target architecture for ${TARGET}/conf/${kernel} unknown. config(8) likely too old."
|
||||
.endif
|
||||
universe_kernconfs: universe_kernconf_${TARGET}_${kernel}
|
||||
universe_kernconf_${TARGET}_${kernel}:
|
||||
universe_kernconf_${TARGET}_${kernel}: .MAKE
|
||||
@(cd ${.CURDIR} && env __MAKE_CONF=/dev/null \
|
||||
${MAKE} ${JFLAG} buildkernel \
|
||||
${SUB_MAKE} ${JFLAG} buildkernel \
|
||||
TARGET=${TARGET} \
|
||||
TARGET_ARCH=${TARGET_ARCH_${kernel}} \
|
||||
KERNCONF=${kernel} \
|
||||
|
||||
+240
-166
@@ -35,19 +35,12 @@
|
||||
# buildworld - rebuild *everything*, including glue to help do upgrades
|
||||
# installworld- install everything built by "buildworld"
|
||||
# doxygen - build API documentation of the kernel
|
||||
# update - convenient way to update your source tree (eg: cvsup/cvs)
|
||||
# update - convenient way to update your source tree (eg: svn/svnup)
|
||||
#
|
||||
# Standard targets (not defined here) are documented in the makefiles in
|
||||
# /usr/share/mk. These include:
|
||||
# obj depend all install clean cleandepend cleanobj
|
||||
|
||||
# You are supposed to define both of these when calling Makefile.inc1
|
||||
# directly. However, some old scripts don't. Cope for the moment, but
|
||||
# issue a new warning for a transition period.
|
||||
.if defined(TARGET) && !defined(TARGET_ARCH)
|
||||
.warning "You must pass both TARGET and TARGET_ARCH to Makefile.inc1. Setting TARGET_ARCH=${TARGET}."
|
||||
TARGET_ARCH=${TARGET}
|
||||
.endif
|
||||
.if !defined(TARGET) || !defined(TARGET_ARCH)
|
||||
.error "Both TARGET and TARGET_ARCH must be defined."
|
||||
.endif
|
||||
@@ -65,6 +58,9 @@ TARGET_ARCH=${TARGET}
|
||||
# use that new version. And the new (dynamically-linked) /bin/sh
|
||||
# will expect to find appropriate libraries in /lib and /libexec.
|
||||
#
|
||||
.if defined(SUBDIR_OVERRIDE)
|
||||
SUBDIR= ${SUBDIR_OVERRIDE}
|
||||
.else
|
||||
SUBDIR= share/info lib libexec
|
||||
SUBDIR+=bin
|
||||
.if ${MK_GAMES} != "no"
|
||||
@@ -91,7 +87,6 @@ SUBDIR+=sys usr.bin usr.sbin
|
||||
.if ${MK_OFED} != "no"
|
||||
SUBDIR+=contrib/ofed
|
||||
.endif
|
||||
|
||||
#
|
||||
# We must do etc/ last for install/distribute to work.
|
||||
#
|
||||
@@ -104,9 +99,6 @@ SUBDIR+=etc
|
||||
SUBDIR+= ${_DIR}
|
||||
.endif
|
||||
.endfor
|
||||
|
||||
.if defined(SUBDIR_OVERRIDE)
|
||||
SUBDIR= ${SUBDIR_OVERRIDE}
|
||||
.endif
|
||||
|
||||
.if defined(NOCLEAN)
|
||||
@@ -122,15 +114,8 @@ LOCAL_TOOL_DIRS?=
|
||||
|
||||
BUILDENV_SHELL?=/bin/sh
|
||||
|
||||
CVS?= cvs
|
||||
CVSFLAGS?= -A -P -d -I!
|
||||
SVN?= svn
|
||||
SVN?= /usr/local/bin/svn
|
||||
SVNFLAGS?= -r HEAD
|
||||
SUP?= /usr/bin/csup
|
||||
SUPFLAGS?= -g -L 2
|
||||
.if defined(SUPHOST)
|
||||
SUPFLAGS+= -h ${SUPHOST}
|
||||
.endif
|
||||
|
||||
MAKEOBJDIRPREFIX?= /usr/obj
|
||||
.if !defined(OSRELDATE)
|
||||
@@ -252,7 +237,6 @@ BMAKE= MAKEOBJDIRPREFIX=${WORLDTMP} \
|
||||
DESTDIR= \
|
||||
BOOTSTRAPPING=${OSRELDATE} \
|
||||
SSP_CFLAGS= \
|
||||
-DWITHOUT_META_MODE \
|
||||
-DWITHOUT_HTML -DWITHOUT_INFO -DNO_LINT -DWITHOUT_MAN \
|
||||
-DNO_PIC -DNO_PROFILE -DNO_SHARED \
|
||||
-DNO_CPU_CFLAGS -DNO_WARNS -DNO_CTF -DEARLY_BUILD
|
||||
@@ -264,14 +248,12 @@ TMAKE= MAKEOBJDIRPREFIX=${OBJTREE} \
|
||||
DESTDIR= \
|
||||
BOOTSTRAPPING=${OSRELDATE} \
|
||||
SSP_CFLAGS= \
|
||||
-DWITHOUT_META_MODE \
|
||||
-DNO_LINT \
|
||||
-DNO_CPU_CFLAGS -DNO_WARNS -DNO_CTF -DEARLY_BUILD
|
||||
|
||||
# cross-tools stage
|
||||
XMAKE= TOOLS_PREFIX=${WORLDTMP} ${BMAKE} \
|
||||
TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \
|
||||
-DWITHOUT_META_MODE \
|
||||
-DWITHOUT_GDB
|
||||
|
||||
# world stage
|
||||
@@ -281,18 +263,77 @@ WMAKEENV= ${CROSSENV} \
|
||||
VERSION="${VERSION}" \
|
||||
INSTALL="sh ${.CURDIR}/tools/install.sh" \
|
||||
PATH=${TMPPATH}
|
||||
|
||||
# make hierarchy
|
||||
HMAKE= PATH=${TMPPATH} ${MAKE} LOCAL_MTREE=${LOCAL_MTREE:Q}
|
||||
.if defined(NO_ROOT)
|
||||
HMAKE+= PATH=${TMPPATH} METALOG=${METALOG} -DNO_ROOT
|
||||
.endif
|
||||
|
||||
.if ${MK_CDDL} == "no"
|
||||
WMAKEENV+= NO_CTF=1
|
||||
.endif
|
||||
.if ${CC:T:Mgcc} == "gcc"
|
||||
|
||||
.if defined(CROSS_TOOLCHAIN_PREFIX)
|
||||
CROSS_COMPILER_PREFIX?=${CROSS_TOOLCHAIN_PREFIX}
|
||||
CROSS_BINUTILS_PREFIX?=${CROSS_TOOLCHAIN_PREFIX}
|
||||
.endif
|
||||
XCOMPILERS= CC CXX CPP
|
||||
.for COMPILER in ${XCOMPILERS}
|
||||
.if defined(CROSS_COMPILER_PREFIX)
|
||||
X${COMPILER}?= ${CROSS_COMPILER_PREFIX}${${COMPILER}}
|
||||
.else
|
||||
X${COMPILER}?= ${${COMPILER}}
|
||||
.endif
|
||||
.endfor
|
||||
XBINUTILS= AS AR LD NM OBJDUMP RANLIB STRINGS
|
||||
.for BINUTIL in ${XBINUTILS}
|
||||
.if defined(CROSS_BINUTILS_PREFIX)
|
||||
X${BINUTIL}?= ${CROSS_BINUTILS_PREFIX}${${BINUTIL}}
|
||||
.else
|
||||
X${BINUTIL}?= ${${BINUTIL}}
|
||||
.endif
|
||||
.endfor
|
||||
WMAKEENV+= CC="${XCC} ${XFLAGS}" CXX="${XCXX} ${XFLAGS}" \
|
||||
CPP="${XCPP} ${XFLAGS}" \
|
||||
AS="${XAS}" AR="${XAR}" LD="${XLD}" NM=${XNM} \
|
||||
OBJDUMP=${XOBJDUMP} RANLIB=${XRANLIB} STRINGS=${XSTRINGS}
|
||||
|
||||
.if ${XCC:T:Mgcc} == "gcc"
|
||||
WMAKE_COMPILER_TYPE= gcc
|
||||
.elif ${CC:T:Mclang} == "clang"
|
||||
.elif ${XCC:T:Mclang} == "clang"
|
||||
WMAKE_COMPILER_TYPE= clang
|
||||
.elif ${MK_CLANG_IS_CC} == "no"
|
||||
WMAKE_COMPILER_TYPE= gcc
|
||||
.else
|
||||
WMAKE_COMPILER_TYPE= clang
|
||||
.endif
|
||||
IMAKE_COMPILER_TYPE= COMPILER_TYPE=${WMAKE_COMPILER_TYPE}
|
||||
|
||||
.if ${XCC:M/*}
|
||||
XFLAGS= --sysroot=${WORLDTMP}
|
||||
.if defined(CROSS_BINUTILS_PREFIX)
|
||||
# In the case of xdev-build tools, CROSS_BINUTILS_PREFIX won't be a
|
||||
# directory, but the compiler will look in the right place for it's
|
||||
# tools so we don't need to tell it where to look.
|
||||
.if exists(${CROSS_BINUTILS_PREFIX})
|
||||
XFLAGS+= -B${CROSS_BINUTILS_PREFIX}
|
||||
.endif
|
||||
.else
|
||||
XFLAGS+= -B${WORLDTMP}/usr/bin
|
||||
.endif
|
||||
.if ${TARGET_ARCH} != ${MACHINE_ARCH} && ${WMAKE_COMPILER_TYPE} == "clang"
|
||||
.if (${TARGET_ARCH} == "arm" || ${TARGET_ARCH} == "armv6") && \
|
||||
${MK_ARM_EABI} != "no"
|
||||
TARGET_ABI= gnueabi
|
||||
.else
|
||||
TARGET_ABI= unknown
|
||||
.endif
|
||||
TARGET_TRIPLE?= ${TARGET_ARCH:C/amd64/x86_64/}-${TARGET_ABI}-freebsd10.0
|
||||
XFLAGS+= -target ${TARGET_TRIPLE}
|
||||
.endif
|
||||
.endif
|
||||
|
||||
WMAKEENV+= COMPILER_TYPE=${WMAKE_COMPILER_TYPE}
|
||||
WMAKE= ${WMAKEENV} ${MAKE} ${WORLD_FLAGS} -f Makefile.inc1 DESTDIR=${WORLDTMP}
|
||||
|
||||
@@ -328,6 +369,9 @@ LIB32FLAGS= -m32 ${LIB32CPUFLAGS} -DCOMPAT_32BIT \
|
||||
-isystem ${LIB32TMP}/usr/include/ \
|
||||
-L${LIB32TMP}/usr/lib32 \
|
||||
-B${LIB32TMP}/usr/lib32
|
||||
.if ${XCC:M/*}
|
||||
LIB32FLAGS+= --sysroot=${WORLDTMP}
|
||||
.endif
|
||||
|
||||
# Yes, the flags are redundant.
|
||||
LIB32WMAKEENV+= MAKEOBJDIRPREFIX=${OBJTREE}/lib32 \
|
||||
@@ -340,8 +384,8 @@ LIB32WMAKEENV+= MAKEOBJDIRPREFIX=${OBJTREE}/lib32 \
|
||||
SHLIBDIR=/usr/lib32 \
|
||||
COMPILER_TYPE=${WMAKE_COMPILER_TYPE}
|
||||
LIB32WMAKEFLAGS+= \
|
||||
CC="${CC} ${LIB32FLAGS}" \
|
||||
CXX="${CXX} ${LIB32FLAGS}" \
|
||||
CC="${XCC} ${LIB32FLAGS}" \
|
||||
CXX="${XCXX} ${LIB32FLAGS}" \
|
||||
DESTDIR=${LIB32TMP} \
|
||||
-DCOMPAT_32BIT \
|
||||
-DLIBRARIES_ONLY \
|
||||
@@ -357,7 +401,7 @@ LIB32IMAKE= ${LIB32WMAKE:NINSTALL=*:NDESTDIR=*:N_LDSCRIPTROOT=*} -DNO_INCS \
|
||||
|
||||
IMAKEENV= ${CROSSENV:N_LDSCRIPTROOT=*}
|
||||
IMAKE= ${IMAKEENV} ${MAKE} -f Makefile.inc1 \
|
||||
${IMAKE_INSTALL} ${IMAKE_MTREE}
|
||||
${IMAKE_INSTALL} ${IMAKE_MTREE} ${IMAKE_COMPILER_TYPE}
|
||||
.if empty(.MAKEFLAGS:M-n)
|
||||
IMAKEENV+= PATH=${STRICTTMPPATH}:${INSTALLTMP} \
|
||||
LD_LIBRARY_PATH=${INSTALLTMP} \
|
||||
@@ -370,11 +414,12 @@ IMAKEENV+= PATH=${TMPPATH}:${INSTALLTMP}
|
||||
INSTALLFLAGS+= -N ${.CURDIR}/etc
|
||||
MTREEFLAGS+= -N ${.CURDIR}/etc
|
||||
.endif
|
||||
_INSTALL_DDIR= ${DESTDIR}/${DISTDIR}
|
||||
INSTALL_DDIR= ${_INSTALL_DDIR:S://:/:g:C:/$::}
|
||||
.if defined(NO_ROOT)
|
||||
METALOG?= ${DESTDIR}/${DISTDIR}/METALOG
|
||||
IMAKE+= -DNO_ROOT METALOG=${METALOG}
|
||||
INSTALL_DDIR= ${DESTDIR}/${DISTDIR}
|
||||
INSTALLFLAGS+= -U -M ${METALOG} -D ${INSTALL_DDIR:S://:/:g:C:/$::}
|
||||
INSTALLFLAGS+= -U -M ${METALOG} -D ${INSTALL_DDIR}
|
||||
MTREEFLAGS+= -W
|
||||
.endif
|
||||
.if defined(DB_FROM_SRC) || defined(NO_ROOT)
|
||||
@@ -384,7 +429,7 @@ IMAKE_MTREE= MTREE_CMD="nmtree ${MTREEFLAGS}"
|
||||
|
||||
# kernel stage
|
||||
KMAKEENV= ${WMAKEENV}
|
||||
KMAKE= ${KMAKEENV} ${MAKE} ${KERNEL_FLAGS} KERNEL=${INSTKERNNAME}
|
||||
KMAKE= ${KMAKEENV} ${MAKE} ${.MAKEFLAGS} ${KERNEL_FLAGS} KERNEL=${INSTKERNNAME}
|
||||
|
||||
#
|
||||
# buildworld
|
||||
@@ -432,6 +477,13 @@ _worldtmp:
|
||||
mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
|
||||
-p ${WORLDTMP}/usr/include >/dev/null
|
||||
ln -sf ${.CURDIR}/sys ${WORLDTMP}
|
||||
.if ${MK_DEBUG_FILES} != "no"
|
||||
# We could instead disable debug files for these build stages
|
||||
mtree -deU -f ${.CURDIR}/etc/mtree/BSD.debug.dist \
|
||||
-p ${WORLDTMP}/legacy/usr/lib >/dev/null
|
||||
mtree -deU -f ${.CURDIR}/etc/mtree/BSD.debug.dist \
|
||||
-p ${WORLDTMP}/usr/lib >/dev/null
|
||||
.endif
|
||||
.if ${MK_BIND_LIBS} != "no"
|
||||
mtree -deU -f ${.CURDIR}/etc/mtree/BIND.include.dist \
|
||||
-p ${WORLDTMP}/usr/include >/dev/null
|
||||
@@ -517,6 +569,10 @@ build32:
|
||||
-p ${LIB32TMP}/usr >/dev/null
|
||||
mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
|
||||
-p ${LIB32TMP}/usr/include >/dev/null
|
||||
.if ${MK_DEBUG_FILES} != "no"
|
||||
mtree -deU -f ${.CURDIR}/etc/mtree/BSD.debug.dist \
|
||||
-p ${LIB32TMP}/usr/lib >/dev/null
|
||||
.endif
|
||||
mkdir -p ${WORLDTMP}
|
||||
ln -sf ${.CURDIR}/sys ${WORLDTMP}
|
||||
.for _t in obj includes
|
||||
@@ -620,6 +676,7 @@ kernel-toolchain: ${TOOLCHAIN_TGTS:N_includes:N_libraries}
|
||||
# Checks to be sure system is ready for installworld/installkernel.
|
||||
#
|
||||
installcheck:
|
||||
installcheck_UGID:
|
||||
|
||||
#
|
||||
# Require DESTDIR to be set if installing for a different architecture or
|
||||
@@ -651,7 +708,6 @@ CHECK_GIDS+= smmsp
|
||||
CHECK_UIDS+= proxy
|
||||
CHECK_GIDS+= proxy authpf
|
||||
.endif
|
||||
installcheck: installcheck_UGID
|
||||
installcheck_UGID:
|
||||
.for uid in ${CHECK_UIDS}
|
||||
@if ! `id -u ${uid} >/dev/null 2>&1`; then \
|
||||
@@ -707,7 +763,7 @@ EXTRA_DISTRIBUTIONS+= lib32
|
||||
|
||||
MTREE_MAGIC?= mtree 2.0
|
||||
|
||||
distributeworld installworld: installcheck
|
||||
distributeworld installworld: installcheck installcheck_UGID
|
||||
mkdir -p ${INSTALLTMP}
|
||||
progs=$$(for prog in ${ITOOLS}; do \
|
||||
if progpath=`which $$prog`; then \
|
||||
@@ -741,6 +797,10 @@ distributeworld installworld: installcheck
|
||||
-p ${DESTDIR}/${DISTDIR}/${dist}/usr >/dev/null
|
||||
mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
|
||||
-p ${DESTDIR}/${DISTDIR}/${dist}/usr/include >/dev/null
|
||||
.if ${MK_DEBUG_FILES} != "no"
|
||||
mtree -deU -f ${.CURDIR}/etc/mtree/BSD.debug.dist \
|
||||
-p ${DESTDIR}/${DISTDIR}/${dist}/usr/lib >/dev/null
|
||||
.endif
|
||||
.if defined(NO_ROOT)
|
||||
${IMAKEENV} nmtree -C -f ${.CURDIR}/etc/mtree/BSD.root.dist | \
|
||||
sed -e 's#^\./#./${dist}/#' >> ${METALOG}
|
||||
@@ -754,13 +814,13 @@ distributeworld installworld: installcheck
|
||||
cd ${.CURDIR}/etc; ${CROSSENV} PATH=${TMPPATH} ${MAKE} \
|
||||
METALOG=${METALOG} ${IMAKE_INSTALL} ${IMAKE_MTREE} \
|
||||
DISTBASE=/base DESTDIR=${DESTDIR}/${DISTDIR}/base \
|
||||
LOCAL_MTREE=${LOCAL_MTREE} distrib-dirs
|
||||
LOCAL_MTREE=${LOCAL_MTREE:Q} distrib-dirs
|
||||
.endif
|
||||
${_+_}cd ${.CURDIR}; ${IMAKE} re${.TARGET:S/world$//}; \
|
||||
${IMAKEENV} rm -rf ${INSTALLTMP}
|
||||
.if make(distributeworld)
|
||||
.for dist in ${EXTRA_DISTRIBUTIONS}
|
||||
find ${DESTDIR}/${DISTDIR}/${dist} -empty -delete
|
||||
find ${DESTDIR}/${DISTDIR}/${dist} -mindepth 1 -empty -delete
|
||||
.endfor
|
||||
.if defined(NO_ROOT)
|
||||
.for dist in base ${EXTRA_DISTRIBUTIONS}
|
||||
@@ -773,6 +833,18 @@ distributeworld installworld: installcheck
|
||||
awk 'BEGIN { print "#${MTREE_MAGIC}" } !/ type=/ { file = $$1 } / type=/ { if ($$1 == file) { sub(/^\.\/${dist}\//, "./"); print } }' > \
|
||||
${DESTDIR}/${DISTDIR}/${dist}.meta
|
||||
.endfor
|
||||
.if ${MK_DEBUG_FILES} != "no"
|
||||
. for dist in base ${EXTRA_DISTRIBUTIONS}
|
||||
@# For each file that exists in this dist, print the corresponding
|
||||
@# line from the METALOG. This relies on the fact that
|
||||
@# a line containing only the filename will sort immediatly before
|
||||
@# the relevant mtree line.
|
||||
cd ${DESTDIR}/${DISTDIR}; \
|
||||
find ./${dist}/usr/lib/debug | sort -u ${METALOG} - | \
|
||||
awk 'BEGIN { print "#${MTREE_MAGIC}" } !/ type=/ { file = $$1 } / type=/ { if ($$1 == file) { sub(/^\.\/${dist}\//, "./"); print } }' > \
|
||||
${DESTDIR}/${DISTDIR}/${dist}.debug.meta
|
||||
. endfor
|
||||
.endif
|
||||
.endif
|
||||
.endif
|
||||
|
||||
@@ -781,13 +853,29 @@ packageworld:
|
||||
.if defined(NO_ROOT)
|
||||
${_+_}cd ${DESTDIR}/${DISTDIR}/${dist}; \
|
||||
tar cvJf ${DESTDIR}/${DISTDIR}/${dist}.txz \
|
||||
--exclude usr/lib/debug \
|
||||
@${DESTDIR}/${DISTDIR}/${dist}.meta
|
||||
.else
|
||||
${_+_}cd ${DESTDIR}/${DISTDIR}/${dist}; \
|
||||
tar cvJf ${DESTDIR}/${DISTDIR}/${dist}.txz .
|
||||
tar cvJf ${DESTDIR}/${DISTDIR}/${dist}.txz \
|
||||
--exclude usr/lib/debug .
|
||||
.endif
|
||||
.endfor
|
||||
|
||||
.if ${MK_DEBUG_FILES} != "no"
|
||||
. for dist in base ${EXTRA_DISTRIBUTIONS}
|
||||
. if defined(NO_ROOT)
|
||||
${_+_}cd ${DESTDIR}/${DISTDIR}/${dist}; \
|
||||
tar cvJf ${DESTDIR}/${DISTDIR}/${dist}.debug.txz \
|
||||
@${DESTDIR}/${DISTDIR}/${dist}.debug.meta
|
||||
. else
|
||||
${_+_}cd ${DESTDIR}/${DISTDIR}/${dist}; \
|
||||
tar cvJfL ${DESTDIR}/${DISTDIR}/${dist}.debug.txz \
|
||||
usr/lib/debug
|
||||
. endif
|
||||
. endfor
|
||||
.endif
|
||||
|
||||
#
|
||||
# reinstall
|
||||
#
|
||||
@@ -800,7 +888,7 @@ reinstall:
|
||||
@echo ">>> Making hierarchy"
|
||||
@echo "--------------------------------------------------------------"
|
||||
${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 \
|
||||
LOCAL_MTREE=${LOCAL_MTREE} hierarchy
|
||||
LOCAL_MTREE=${LOCAL_MTREE:Q} hierarchy
|
||||
@echo
|
||||
@echo "--------------------------------------------------------------"
|
||||
@echo ">>> Installing everything"
|
||||
@@ -848,16 +936,11 @@ NO_KERNELOBJ= t
|
||||
KERNCONF=${KERNFAST}
|
||||
.endif
|
||||
.endif
|
||||
.if !defined(KERNCONF) && defined(KERNEL)
|
||||
KERNCONF= ${KERNEL}
|
||||
KERNWARN=
|
||||
.else
|
||||
.if ${TARGET_ARCH} == "powerpc64"
|
||||
KERNCONF?= GENERIC64
|
||||
.else
|
||||
KERNCONF?= GENERIC
|
||||
.endif
|
||||
.endif
|
||||
INSTKERNNAME?= kernel
|
||||
|
||||
KERNSRCDIR?= ${.CURDIR}/sys
|
||||
@@ -885,12 +968,6 @@ buildkernel:
|
||||
.if empty(BUILDKERNELS)
|
||||
@echo "ERROR: Missing kernel configuration file(s) (${KERNCONF})."; \
|
||||
false
|
||||
.endif
|
||||
.if defined(KERNWARN)
|
||||
@echo "--------------------------------------------------------------"
|
||||
@echo ">>> WARNING: KERNEL= setting should be changed to KERNCONF="
|
||||
@echo "--------------------------------------------------------------"
|
||||
@sleep 3
|
||||
.endif
|
||||
@echo
|
||||
.for _kernel in ${BUILDKERNELS}
|
||||
@@ -980,26 +1057,53 @@ distributekernel distributekernel.debug:
|
||||
.if empty(INSTALLKERNEL)
|
||||
@echo "ERROR: No kernel \"${KERNCONF}\" to install."; \
|
||||
false
|
||||
.endif
|
||||
mkdir -p ${DESTDIR}/${DISTDIR}
|
||||
.if defined(NO_ROOT)
|
||||
echo "#${MTREE_MAGIC}" > ${DESTDIR}/${DISTDIR}/kernel.premeta
|
||||
.endif
|
||||
cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \
|
||||
${CROSSENV} PATH=${TMPPATH} ${MAKE} KERNEL=${INSTKERNNAME} \
|
||||
DESTDIR=${DESTDIR}/${DISTDIR}/kernel \
|
||||
${IMAKEENV} ${IMAKE_INSTALL:S/METALOG/kernel.premeta/} \
|
||||
${IMAKE_MTREE} PATH=${TMPPATH} ${MAKE} KERNEL=${INSTKERNNAME} \
|
||||
DESTDIR=${INSTALL_DDIR}/kernel \
|
||||
${.TARGET:S/distributekernel/install/}
|
||||
.if defined(NO_ROOT)
|
||||
sed -e 's|^./kernel|.|' ${DESTDIR}/${DISTDIR}/kernel.premeta > \
|
||||
${DESTDIR}/${DISTDIR}/kernel.meta
|
||||
.endif
|
||||
.for _kernel in ${BUILDKERNELS:S/${INSTALLKERNEL}//}
|
||||
.if defined(NO_ROOT)
|
||||
echo "#${MTREE_MAGIC}" > ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.premeta
|
||||
.endif
|
||||
cd ${KRNLOBJDIR}/${_kernel}; \
|
||||
${CROSSENV} PATH=${TMPPATH} ${MAKE} \
|
||||
${IMAKEENV} ${IMAKE_INSTALL:S/METALOG/kernel.${_kernel}.premeta/} \
|
||||
${IMAKE_MTREE} PATH=${TMPPATH} ${MAKE} \
|
||||
KERNEL=${INSTKERNNAME}.${_kernel} \
|
||||
DESTDIR=${DESTDIR}/${DISTDIR}/kernel.${_kernel} \
|
||||
DESTDIR=${INSTALL_DDIR}/kernel.${_kernel} \
|
||||
${.TARGET:S/distributekernel/install/}
|
||||
sed -e 's|^./kernel|.|' \
|
||||
${DESTDIR}/${DISTDIR}/kernel.${_kernel}.premeta > \
|
||||
${DESTDIR}/${DISTDIR}/kernel.${_kernel}.meta
|
||||
.endfor
|
||||
|
||||
packagekernel:
|
||||
.if defined(NO_ROOT)
|
||||
cd ${DESTDIR}/${DISTDIR}/kernel; \
|
||||
tar cvJf ${DESTDIR}/${DISTDIR}/kernel.txz \
|
||||
@${DESTDIR}/${DISTDIR}/kernel.meta
|
||||
.for _kernel in ${BUILDKERNELS:S/${INSTALLKERNEL}//}
|
||||
cd ${DESTDIR}/${DISTDIR}/kernel.${_kernel}; \
|
||||
tar cvJf ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.txz \
|
||||
@${DESTDIR}/${DISTDIR}/kernel.${_kernel}.meta
|
||||
.endfor
|
||||
.else
|
||||
cd ${DESTDIR}/${DISTDIR}/kernel; \
|
||||
tar cvJf ${DESTDIR}/${DISTDIR}/kernel.txz .
|
||||
.for _kernel in ${BUILDKERNELS:S/${INSTALLKERNEL}//}
|
||||
cd ${DESTDIR}/${DISTDIR}/kernel.${_kernel}; \
|
||||
tar cvJf ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.txz .
|
||||
.endfor
|
||||
.endif
|
||||
|
||||
#
|
||||
# doxygen
|
||||
@@ -1016,63 +1120,22 @@ doxygen:
|
||||
#
|
||||
# update
|
||||
#
|
||||
# Update the source tree(s), by running cvsup/cvs/svn to update to the
|
||||
# Update the source tree(s), by running svn/svnup to update to the
|
||||
# latest copy.
|
||||
#
|
||||
update:
|
||||
.if defined(SUP_UPDATE)
|
||||
.if (defined(CVS_UPDATE) || defined(SUP_UPDATE)) && !defined(SVN_UPDATE)
|
||||
@echo "--------------------------------------------------------------"
|
||||
@echo ">>> Running ${SUP}"
|
||||
@echo "CVS_UPDATE and SUP_UPDATE are no longer supported."
|
||||
@echo "Please see: https://wiki.freebsd.org/CvsIsDeprecated"
|
||||
@echo "--------------------------------------------------------------"
|
||||
@echo "!! WARNING WARNING WARNING WARNING WARNING WARNING WARNING !!"
|
||||
@echo "!! Update methods with ${SUP} are deprecated."
|
||||
@echo "!! Please see http://www.freebsd.org/handbook/svn.html"
|
||||
@echo "!! and convert your update method to SVN_UPDATE or"
|
||||
@echo "!! freebsd-update(8)."
|
||||
@echo "!! WARNING WARNING WARNING WARNING WARNING WARNING WARNING !!"
|
||||
@sleep 5
|
||||
.if defined(SUPFILE)
|
||||
@${SUP} ${SUPFLAGS} ${SUPFILE}
|
||||
.endif
|
||||
.if defined(SUPFILE1)
|
||||
@${SUP} ${SUPFLAGS} ${SUPFILE1}
|
||||
.endif
|
||||
.if defined(SUPFILE2)
|
||||
@${SUP} ${SUPFLAGS} ${SUPFILE2}
|
||||
.endif
|
||||
.if defined(PORTSSUPFILE) && !defined(NO_PORTSUPDATE)
|
||||
@${SUP} ${SUPFLAGS} ${PORTSSUPFILE}
|
||||
.endif
|
||||
.if defined(DOCSUPFILE) && !defined(NO_DOCUPDATE)
|
||||
@${SUP} ${SUPFLAGS} ${DOCSUPFILE}
|
||||
.endif
|
||||
.endif
|
||||
.if defined(CVS_UPDATE)
|
||||
@cd ${.CURDIR} ; \
|
||||
if [ -d CVS ] ; then \
|
||||
echo "--------------------------------------------------------------" ; \
|
||||
echo ">>> Updating ${.CURDIR} from CVS repository" ${CVSROOT} ; \
|
||||
echo "--------------------------------------------------------------" ; \
|
||||
echo "!! WARNING WARNING WARNING WARNING WARNING WARNING WARNING !!" ; \
|
||||
echo "!! Update methods with CVS are deprecated." ; \
|
||||
echo "!! Please see http://www.freebsd.org/handbook/svn.html" ; \
|
||||
echo "!! and convert your update method to SVN_UPDATE or" ; \
|
||||
echo "!! freebsd-update(8)." ; \
|
||||
echo "!! WARNING WARNING WARNING WARNING WARNING WARNING WARNING !!" ; \
|
||||
sleep 5 ; \
|
||||
echo ${CVS} -R -q update ${CVSFLAGS} ; \
|
||||
${CVS} -R -q update ${CVSFLAGS} ; \
|
||||
fi
|
||||
@exit 1
|
||||
.endif
|
||||
.if defined(SVN_UPDATE)
|
||||
@cd ${.CURDIR} ; \
|
||||
if [ -d .svn ] ; then \
|
||||
echo "--------------------------------------------------------------" ; \
|
||||
echo ">>> Updating ${.CURDIR} using Subversion" ; \
|
||||
echo "--------------------------------------------------------------" ; \
|
||||
echo ${SVN} update ${SVNFLAGS} ; \
|
||||
${SVN} update ${SVNFLAGS} ; \
|
||||
fi
|
||||
@echo "--------------------------------------------------------------"
|
||||
@echo ">>> Updating ${.CURDIR} using Subversion"
|
||||
@echo "--------------------------------------------------------------"
|
||||
@(cd ${.CURDIR} && ${SVN} update ${SVNFLAGS})
|
||||
.endif
|
||||
|
||||
#
|
||||
@@ -1096,11 +1159,11 @@ legacy:
|
||||
.endif
|
||||
.for _tool in tools/build
|
||||
${_+_}@${ECHODIR} "===> ${_tool} (obj,includes,depend,all,install)"; \
|
||||
cd ${.CURDIR}/${_tool}; \
|
||||
${MAKE} DIRPRFX=${_tool}/ obj; \
|
||||
${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy includes; \
|
||||
${MAKE} DIRPRFX=${_tool}/ depend; \
|
||||
${MAKE} DIRPRFX=${_tool}/ all; \
|
||||
cd ${.CURDIR}/${_tool} && \
|
||||
${MAKE} DIRPRFX=${_tool}/ obj && \
|
||||
${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy includes && \
|
||||
${MAKE} DIRPRFX=${_tool}/ depend && \
|
||||
${MAKE} DIRPRFX=${_tool}/ all && \
|
||||
${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy install
|
||||
.endfor
|
||||
|
||||
@@ -1135,11 +1198,19 @@ _sed= usr.bin/sed
|
||||
_lex= usr.bin/lex
|
||||
.endif
|
||||
|
||||
.if ${BOOTSTRAPPING} < 1000002
|
||||
_m4= usr.bin/m4
|
||||
.endif
|
||||
|
||||
.if ${BOOTSTRAPPING} < 1000013
|
||||
_yacc= lib/liby \
|
||||
usr.bin/yacc
|
||||
.endif
|
||||
|
||||
.if ${BOOTSTRAPPING} < 1000014
|
||||
_crunch= usr.sbin/crunch
|
||||
.endif
|
||||
|
||||
.if ${BOOTSTRAPPING} < 1000026
|
||||
_nmtree= lib/libnetbsd \
|
||||
usr.sbin/nmtree
|
||||
@@ -1167,8 +1238,8 @@ _clang_tblgen= \
|
||||
|
||||
# dtrace tools are required for older bootstrap env and cross-build
|
||||
.if ${MK_CDDL} != "no" && \
|
||||
((${BOOTSTRAPPING} < 800038 && \
|
||||
!(${BOOTSTRAPPING} >= 700112 && ${BOOTSTRAPPING} < 799999)) \
|
||||
((${BOOTSTRAPPING} < 1000034 && \
|
||||
!(${BOOTSTRAPPING} >= 901505 && ${BOOTSTRAPPING} < 999999)) \
|
||||
|| (${MACHINE} != ${TARGET} || ${MACHINE_ARCH} != ${TARGET_ARCH}))
|
||||
_dtrace_tools= cddl/usr.bin/sgsmsg cddl/lib/libctf lib/libelf \
|
||||
lib/libdwarf cddl/usr.bin/ctfconvert cddl/usr.bin/ctfmerge
|
||||
@@ -1187,13 +1258,14 @@ _kerberos5_bootstrap_tools= \
|
||||
kerberos5/lib/libroken \
|
||||
kerberos5/lib/libvers \
|
||||
kerberos5/tools/asn1_compile \
|
||||
kerberos5/tools/slc
|
||||
kerberos5/tools/slc \
|
||||
usr.bin/compile_et
|
||||
.endif
|
||||
|
||||
# Please document (add comment) why something is in 'bootstrap-tools'.
|
||||
# Try to bound the building of the bootstrap-tool to just the
|
||||
# FreeBSD versions that need the tool built at this stage of the build.
|
||||
bootstrap-tools:
|
||||
bootstrap-tools: .MAKE
|
||||
.for _tool in \
|
||||
${_clang_tblgen} \
|
||||
${_kerberos5_bootstrap_tools} \
|
||||
@@ -1211,17 +1283,19 @@ bootstrap-tools:
|
||||
usr.bin/rpcgen \
|
||||
${_sed} \
|
||||
${_yacc} \
|
||||
${_m4} \
|
||||
${_lex} \
|
||||
lib/libmd \
|
||||
usr.bin/xinstall \
|
||||
${_gensnmptree} \
|
||||
usr.sbin/config \
|
||||
${_crunch} \
|
||||
${_nmtree}
|
||||
${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \
|
||||
cd ${.CURDIR}/${_tool}; \
|
||||
${MAKE} DIRPRFX=${_tool}/ obj; \
|
||||
${MAKE} DIRPRFX=${_tool}/ depend; \
|
||||
${MAKE} DIRPRFX=${_tool}/ all; \
|
||||
cd ${.CURDIR}/${_tool} && \
|
||||
${MAKE} DIRPRFX=${_tool}/ obj && \
|
||||
${MAKE} DIRPRFX=${_tool}/ depend && \
|
||||
${MAKE} DIRPRFX=${_tool}/ all && \
|
||||
${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy install
|
||||
.endfor
|
||||
|
||||
@@ -1244,7 +1318,7 @@ _gcc_tools= gnu/usr.bin/cc/cc_tools
|
||||
_rescue= rescue/rescue
|
||||
.endif
|
||||
|
||||
build-tools:
|
||||
build-tools: .MAKE
|
||||
.for _tool in \
|
||||
bin/csh \
|
||||
bin/sh \
|
||||
@@ -1257,18 +1331,19 @@ build-tools:
|
||||
usr.bin/awk \
|
||||
lib/libmagic \
|
||||
usr.bin/mkesdb_static \
|
||||
usr.bin/mkcsmapper_static
|
||||
usr.bin/mkcsmapper_static \
|
||||
usr.bin/vi/catalog
|
||||
${_+_}@${ECHODIR} "===> ${_tool} (obj,build-tools)"; \
|
||||
cd ${.CURDIR}/${_tool}; \
|
||||
${MAKE} DIRPRFX=${_tool}/ obj; \
|
||||
cd ${.CURDIR}/${_tool} && \
|
||||
${MAKE} DIRPRFX=${_tool}/ obj && \
|
||||
${MAKE} DIRPRFX=${_tool}/ build-tools
|
||||
.endfor
|
||||
.for _tool in \
|
||||
${_gcc_tools}
|
||||
${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all)"; \
|
||||
cd ${.CURDIR}/${_tool}; \
|
||||
${MAKE} DIRPRFX=${_tool}/ obj; \
|
||||
${MAKE} DIRPRFX=${_tool}/ depend; \
|
||||
cd ${.CURDIR}/${_tool} && \
|
||||
${MAKE} DIRPRFX=${_tool}/ obj && \
|
||||
${MAKE} DIRPRFX=${_tool}/ depend && \
|
||||
${MAKE} DIRPRFX=${_tool}/ all
|
||||
.endfor
|
||||
|
||||
@@ -1289,10 +1364,13 @@ _kgzip= usr.sbin/kgzip
|
||||
.endif
|
||||
.endif
|
||||
|
||||
.if ${MK_BINUTILS} != "no"
|
||||
.if ${XAS:M/*} == "" && ${MK_BINUTILS} != "no"
|
||||
_binutils= gnu/usr.bin/binutils
|
||||
.endif
|
||||
|
||||
# If an full path to an external cross compiler is given, don't build
|
||||
# a cross compiler.
|
||||
.if ${XCC:M/*} == "" && ${MK_CROSS_COMPILER} != "no"
|
||||
.if ${MK_CLANG} != "no" && (${MK_CLANG_IS_CC} != "no" || ${CC:T:Mclang} == "clang")
|
||||
_clang= usr.bin/clang
|
||||
_clang_libs= lib/clang
|
||||
@@ -1301,8 +1379,9 @@ _clang_libs= lib/clang
|
||||
.if ${MK_GCC} != "no" && (${MK_CLANG_IS_CC} == "no" || ${TARGET} == "pc98")
|
||||
_cc= gnu/usr.bin/cc
|
||||
.endif
|
||||
.endif
|
||||
|
||||
cross-tools:
|
||||
cross-tools: .MAKE
|
||||
.for _tool in \
|
||||
${_clang_libs} \
|
||||
${_clang} \
|
||||
@@ -1313,10 +1392,10 @@ cross-tools:
|
||||
${_crunchide} \
|
||||
${_kgzip}
|
||||
${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \
|
||||
cd ${.CURDIR}/${_tool}; \
|
||||
${MAKE} DIRPRFX=${_tool}/ obj; \
|
||||
${MAKE} DIRPRFX=${_tool}/ depend; \
|
||||
${MAKE} DIRPRFX=${_tool}/ all; \
|
||||
cd ${.CURDIR}/${_tool} && \
|
||||
${MAKE} DIRPRFX=${_tool}/ obj && \
|
||||
${MAKE} DIRPRFX=${_tool}/ depend && \
|
||||
${MAKE} DIRPRFX=${_tool}/ all && \
|
||||
${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX} install
|
||||
.endfor
|
||||
|
||||
@@ -1324,12 +1403,7 @@ cross-tools:
|
||||
# hierarchy - ensure that all the needed directories are present
|
||||
#
|
||||
hierarchy hier:
|
||||
.if defined(NO_ROOT)
|
||||
cd ${.CURDIR}/etc; ${MAKE} LOCAL_MTREE=${LOCAL_MTREE} \
|
||||
-DNO_ROOT METALOG=${METALOG} distrib-dirs
|
||||
.else
|
||||
cd ${.CURDIR}/etc; ${MAKE} LOCAL_MTREE=${LOCAL_MTREE} distrib-dirs
|
||||
.endif
|
||||
cd ${.CURDIR}/etc && ${HMAKE} distrib-dirs
|
||||
|
||||
#
|
||||
# libraries - build all libraries, and install them under ${DESTDIR}.
|
||||
@@ -1338,12 +1412,12 @@ hierarchy hier:
|
||||
# interdependencies (__L) are built automatically by the
|
||||
# ${.CURDIR}/tools/make_libdeps.sh script.
|
||||
#
|
||||
libraries:
|
||||
cd ${.CURDIR}; \
|
||||
${MAKE} -f Makefile.inc1 _prereq_libs; \
|
||||
${MAKE} -f Makefile.inc1 _startup_libs; \
|
||||
${MAKE} -f Makefile.inc1 _prebuild_libs; \
|
||||
${MAKE} -f Makefile.inc1 _generic_libs;
|
||||
libraries: .MAKE
|
||||
cd ${.CURDIR} && \
|
||||
${MAKE} -f Makefile.inc1 _prereq_libs && \
|
||||
${MAKE} -f Makefile.inc1 _startup_libs && \
|
||||
${MAKE} -f Makefile.inc1 _prebuild_libs && \
|
||||
${MAKE} -f Makefile.inc1 _generic_libs
|
||||
|
||||
#
|
||||
# static libgcc.a prerequisite for shared libc
|
||||
@@ -1386,7 +1460,7 @@ _prebuild_libs= ${_kerberos5_lib_libasn1} \
|
||||
${_kerberos5_lib_libwind} \
|
||||
${_lib_atf_libatf_c} \
|
||||
lib/libbz2 ${_libcom_err} lib/libcrypt \
|
||||
lib/libexpat \
|
||||
lib/libelf lib/libexpat \
|
||||
${_lib_libgssapi} ${_lib_libipx} \
|
||||
lib/libkiconv lib/libkvm lib/liblzma lib/libmd \
|
||||
lib/ncurses/ncurses lib/ncurses/ncursesw \
|
||||
@@ -1497,25 +1571,25 @@ lib/libradius__L: lib/libmd__L
|
||||
.endif
|
||||
|
||||
.for _lib in ${_prereq_libs}
|
||||
${_lib}__PL: .PHONY
|
||||
${_lib}__PL: .PHONY .MAKE
|
||||
.if exists(${.CURDIR}/${_lib})
|
||||
${_+_}@${ECHODIR} "===> ${_lib} (obj,depend,all,install)"; \
|
||||
cd ${.CURDIR}/${_lib}; \
|
||||
${MAKE} DIRPRFX=${_lib}/ obj; \
|
||||
${MAKE} DIRPRFX=${_lib}/ depend; \
|
||||
${MAKE} -DNO_PROFILE -DNO_PIC DIRPRFX=${_lib}/ all; \
|
||||
cd ${.CURDIR}/${_lib} && \
|
||||
${MAKE} DIRPRFX=${_lib}/ obj && \
|
||||
${MAKE} DIRPRFX=${_lib}/ depend && \
|
||||
${MAKE} -DNO_PROFILE -DNO_PIC DIRPRFX=${_lib}/ all && \
|
||||
${MAKE} -DNO_PROFILE -DNO_PIC DIRPRFX=${_lib}/ install
|
||||
.endif
|
||||
.endfor
|
||||
|
||||
.for _lib in ${_startup_libs} ${_prebuild_libs:Nlib/libpam} ${_generic_libs}
|
||||
${_lib}__L: .PHONY
|
||||
${_lib}__L: .PHONY .MAKE
|
||||
.if exists(${.CURDIR}/${_lib})
|
||||
${_+_}@${ECHODIR} "===> ${_lib} (obj,depend,all,install)"; \
|
||||
cd ${.CURDIR}/${_lib}; \
|
||||
${MAKE} DIRPRFX=${_lib}/ obj; \
|
||||
${MAKE} DIRPRFX=${_lib}/ depend; \
|
||||
${MAKE} DIRPRFX=${_lib}/ all; \
|
||||
cd ${.CURDIR}/${_lib} && \
|
||||
${MAKE} DIRPRFX=${_lib}/ obj && \
|
||||
${MAKE} DIRPRFX=${_lib}/ depend && \
|
||||
${MAKE} DIRPRFX=${_lib}/ all && \
|
||||
${MAKE} DIRPRFX=${_lib}/ install
|
||||
.endif
|
||||
.endfor
|
||||
@@ -1523,12 +1597,12 @@ ${_lib}__L: .PHONY
|
||||
# libpam is special: we need to build static PAM modules before
|
||||
# static PAM library, and dynamic PAM library before dynamic PAM
|
||||
# modules.
|
||||
lib/libpam__L: .PHONY
|
||||
lib/libpam__L: .PHONY .MAKE
|
||||
${_+_}@${ECHODIR} "===> lib/libpam (obj,depend,all,install)"; \
|
||||
cd ${.CURDIR}/lib/libpam; \
|
||||
${MAKE} DIRPRFX=lib/libpam/ obj; \
|
||||
${MAKE} DIRPRFX=lib/libpam/ depend; \
|
||||
${MAKE} DIRPRFX=lib/libpam/ -D_NO_LIBPAM_SO_YET all; \
|
||||
cd ${.CURDIR}/lib/libpam && \
|
||||
${MAKE} DIRPRFX=lib/libpam/ obj && \
|
||||
${MAKE} DIRPRFX=lib/libpam/ depend && \
|
||||
${MAKE} DIRPRFX=lib/libpam/ -D_NO_LIBPAM_SO_YET all && \
|
||||
${MAKE} DIRPRFX=lib/libpam/ -D_NO_LIBPAM_SO_YET install
|
||||
|
||||
_prereq_libs: ${_prereq_libs:S/$/__PL/}
|
||||
@@ -1538,8 +1612,8 @@ _generic_libs: ${_generic_libs:S/$/__L/}
|
||||
|
||||
.for __target in all clean cleandepend cleandir depend includes obj
|
||||
.for entry in ${SUBDIR}
|
||||
${entry}.${__target}__D: .PHONY
|
||||
${_+_}@if test -d ${.CURDIR}/${entry}.${MACHINE_ARCH}; then \
|
||||
${entry}.${__target}__D: .PHONY .MAKE
|
||||
${_+_}@set -e; if test -d ${.CURDIR}/${entry}.${MACHINE_ARCH}; then \
|
||||
${ECHODIR} "===> ${DIRPRFX}${entry}.${MACHINE_ARCH} (${__target})"; \
|
||||
edir=${entry}.${MACHINE_ARCH}; \
|
||||
cd ${.CURDIR}/$${edir}; \
|
||||
@@ -1777,10 +1851,10 @@ _xb-bootstrap-tools:
|
||||
.for _tool in \
|
||||
${_clang_tblgen}
|
||||
${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \
|
||||
cd ${.CURDIR}/${_tool}; \
|
||||
${CDMAKE} DIRPRFX=${_tool}/ obj; \
|
||||
${CDMAKE} DIRPRFX=${_tool}/ depend; \
|
||||
${CDMAKE} DIRPRFX=${_tool}/ all; \
|
||||
cd ${.CURDIR}/${_tool} && \
|
||||
${CDMAKE} DIRPRFX=${_tool}/ obj && \
|
||||
${CDMAKE} DIRPRFX=${_tool}/ depend && \
|
||||
${CDMAKE} DIRPRFX=${_tool}/ all && \
|
||||
${CDMAKE} DIRPRFX=${_tool}/ DESTDIR=${CDTMP} install
|
||||
.endfor
|
||||
|
||||
@@ -1796,9 +1870,9 @@ _xb-cross-tools:
|
||||
${_clang_libs} \
|
||||
${_clang}
|
||||
${_+_}@${ECHODIR} "===> xdev ${_tool} (obj,depend,all)"; \
|
||||
cd ${.CURDIR}/${_tool}; \
|
||||
${CDMAKE} DIRPRFX=${_tool}/ obj; \
|
||||
${CDMAKE} DIRPRFX=${_tool}/ depend; \
|
||||
cd ${.CURDIR}/${_tool} && \
|
||||
${CDMAKE} DIRPRFX=${_tool}/ obj && \
|
||||
${CDMAKE} DIRPRFX=${_tool}/ depend && \
|
||||
${CDMAKE} DIRPRFX=${_tool}/ all
|
||||
.endfor
|
||||
|
||||
@@ -1848,4 +1922,4 @@ xdev xdev-build xdev-install:
|
||||
@echo "*** Error: Both XDEV and XDEV_ARCH must be defined for \"${.TARGET}\" target"
|
||||
.endif
|
||||
|
||||
.MAKE.MODE= normal
|
||||
buildkernel ${WMAKE_TGTS} ${.ALLTARGETS:M_*}: .MAKE
|
||||
|
||||
+93
-1
@@ -38,7 +38,98 @@
|
||||
# xargs -n1 | sort | uniq -d;
|
||||
# done
|
||||
|
||||
# 20130903: gnupatch is no more
|
||||
OLD_FILES+=usr/bin/gnupatch
|
||||
OLD_FILES+=usr/share/man/man1/gnupatch.1.gz
|
||||
# 20130829: bsdpatch is patch unconditionally
|
||||
OLD_FILES+=usr/bin/bsdpatch
|
||||
OLD_FILES+=usr/share/man/man1/bsdpatch.1.gz
|
||||
# 20130822: bind 9.9.3-P2 import
|
||||
OLD_LIBS+=usr/lib/liblwres.so.80
|
||||
# 20130814: vm_page_busy(9)
|
||||
OLD_FILES+=usr/share/man/man9/vm_page_flash.9.gz
|
||||
OLD_FILES+=usr/share/man/man9/vm_page_io.9.gz
|
||||
OLD_FILES+=usr/share/man/man9/vm_page_io_finish.9.gz
|
||||
OLD_FILES+=usr/share/man/man9/vm_page_io_start.9.gz
|
||||
OLD_FILES+=usr/share/man/man9/vm_page_wakeup.9.gz
|
||||
# 20130710: libkvm version bump
|
||||
OLD_LIBS+=lib/libkvm.so.5
|
||||
OLD_LIBS+=usr/lib32/libkvm.so.5
|
||||
# 20130623: dialog update from 1.1 to 1.2
|
||||
OLD_LIBS+=usr/lib/libdialog.so.7
|
||||
OLD_LIBS+=usr/lib32/libdialog.so.7
|
||||
# 20130616: vfs_mount.9 removed
|
||||
OLD_FILES+=usr/share/man/man9/vfs_mount.9.gz
|
||||
# 20130614: remove CVS from base
|
||||
OLD_FILES+=usr/bin/cvs
|
||||
OLD_FILES+=usr/bin/cvsbug
|
||||
OLD_FILES+=usr/share/doc/psd/28.cvs/paper.ascii.gz
|
||||
OLD_DIRS+=usr/share/doc/psd/28.cvs
|
||||
OLD_FILES+=usr/share/examples/cvs/contrib/README
|
||||
OLD_FILES+=usr/share/examples/cvs/contrib/clmerge
|
||||
OLD_FILES+=usr/share/examples/cvs/contrib/cln_hist
|
||||
OLD_FILES+=usr/share/examples/cvs/contrib/commit_prep
|
||||
OLD_FILES+=usr/share/examples/cvs/contrib/cvs2vendor
|
||||
OLD_FILES+=usr/share/examples/cvs/contrib/cvs_acls
|
||||
OLD_FILES+=usr/share/examples/cvs/contrib/cvscheck
|
||||
OLD_FILES+=usr/share/examples/cvs/contrib/cvscheck.man
|
||||
OLD_FILES+=usr/share/examples/cvs/contrib/cvshelp.man
|
||||
OLD_FILES+=usr/share/examples/cvs/contrib/descend.man
|
||||
OLD_FILES+=usr/share/examples/cvs/contrib/easy-import
|
||||
OLD_FILES+=usr/share/examples/cvs/contrib/intro.doc
|
||||
OLD_FILES+=usr/share/examples/cvs/contrib/log
|
||||
OLD_FILES+=usr/share/examples/cvs/contrib/log_accum
|
||||
OLD_FILES+=usr/share/examples/cvs/contrib/mfpipe
|
||||
OLD_FILES+=usr/share/examples/cvs/contrib/rcs-to-cvs
|
||||
OLD_FILES+=usr/share/examples/cvs/contrib/rcs2log
|
||||
OLD_FILES+=usr/share/examples/cvs/contrib/rcslock
|
||||
OLD_FILES+=usr/share/examples/cvs/contrib/sccs2rcs
|
||||
OLD_DIRS+=usr/share/examples/cvs/contrib
|
||||
OLD_DIRS+=usr/share/examples/cvs
|
||||
OLD_FILES+=usr/share/info/cvs.info.gz
|
||||
OLD_FILES+=usr/share/info/cvsclient.info.gz
|
||||
OLD_FILES+=usr/share/man/man1/cvs.1.gz
|
||||
OLD_FILES+=usr/share/man/man5/cvs.5.gz
|
||||
OLD_FILES+=usr/share/man/man8/cvsbug.8.gz
|
||||
# 20130607: WITH_DEBUG_FILES added
|
||||
OLD_FILES+=lib/libufs.so.6.symbols
|
||||
OLD_FILES+=usr/lib32/libufs.so.6.symbols
|
||||
# 20130417: nfs fha moved from nfsserver to nfs
|
||||
OLD_FILES+=usr/include/nfsserver/nfs_fha.h
|
||||
# 20130411: new clang import which bumps version from 3.2 to 3.3.
|
||||
OLD_FILES+=usr/include/clang/3.2/__wmmintrin_aes.h
|
||||
OLD_FILES+=usr/include/clang/3.2/__wmmintrin_pclmul.h
|
||||
OLD_FILES+=usr/include/clang/3.2/altivec.h
|
||||
OLD_FILES+=usr/include/clang/3.2/ammintrin.h
|
||||
OLD_FILES+=usr/include/clang/3.2/avx2intrin.h
|
||||
OLD_FILES+=usr/include/clang/3.2/avxintrin.h
|
||||
OLD_FILES+=usr/include/clang/3.2/bmi2intrin.h
|
||||
OLD_FILES+=usr/include/clang/3.2/bmiintrin.h
|
||||
OLD_FILES+=usr/include/clang/3.2/cpuid.h
|
||||
OLD_FILES+=usr/include/clang/3.2/emmintrin.h
|
||||
OLD_FILES+=usr/include/clang/3.2/f16cintrin.h
|
||||
OLD_FILES+=usr/include/clang/3.2/fma4intrin.h
|
||||
OLD_FILES+=usr/include/clang/3.2/fmaintrin.h
|
||||
OLD_FILES+=usr/include/clang/3.2/immintrin.h
|
||||
OLD_FILES+=usr/include/clang/3.2/lzcntintrin.h
|
||||
OLD_FILES+=usr/include/clang/3.2/mm3dnow.h
|
||||
OLD_FILES+=usr/include/clang/3.2/mm_malloc.h
|
||||
OLD_FILES+=usr/include/clang/3.2/mmintrin.h
|
||||
OLD_FILES+=usr/include/clang/3.2/module.map
|
||||
OLD_FILES+=usr/include/clang/3.2/nmmintrin.h
|
||||
OLD_FILES+=usr/include/clang/3.2/pmmintrin.h
|
||||
OLD_FILES+=usr/include/clang/3.2/popcntintrin.h
|
||||
OLD_FILES+=usr/include/clang/3.2/rtmintrin.h
|
||||
OLD_FILES+=usr/include/clang/3.2/smmintrin.h
|
||||
OLD_FILES+=usr/include/clang/3.2/tmmintrin.h
|
||||
OLD_FILES+=usr/include/clang/3.2/wmmintrin.h
|
||||
OLD_FILES+=usr/include/clang/3.2/x86intrin.h
|
||||
OLD_FILES+=usr/include/clang/3.2/xmmintrin.h
|
||||
OLD_FILES+=usr/include/clang/3.2/xopintrin.h
|
||||
OLD_DIRS+=usr/include/clang/3.2
|
||||
# 20130404: legacy ATA stack removed
|
||||
OLD_FILES+=etc/periodic/daily/405.status-ata-raid
|
||||
OLD_FILES+=rescue/atacontrol
|
||||
OLD_FILES+=sbin/atacontrol
|
||||
OLD_FILES+=usr/share/man/man8/atacontrol.8.gz
|
||||
OLD_FILES+=usr/share/man/man4/atapicam.4.gz
|
||||
@@ -223,7 +314,9 @@ OLD_FILES+=usr/share/man/man1/yyfix.1.gz
|
||||
# 20120505: new clang import installed a redundant internal header
|
||||
OLD_FILES+=usr/include/clang/3.1/stdalign.h
|
||||
# 20120428: MD2 removed from libmd
|
||||
OLD_LIBS+=lib/libmd.so.5
|
||||
OLD_FILES+=usr/include/md2.h
|
||||
OLD_LIBS+=usr/lib32/libmd.so.5
|
||||
OLD_FILES+=usr/share/man/man3/MD2Data.3.gz
|
||||
OLD_FILES+=usr/share/man/man3/MD2End.3.gz
|
||||
OLD_FILES+=usr/share/man/man3/MD2File.3.gz
|
||||
@@ -790,7 +883,6 @@ OLD_LIBS+=lib/libipx.so.4
|
||||
OLD_LIBS+=lib/libkiconv.so.3
|
||||
OLD_LIBS+=lib/libkvm.so.4
|
||||
OLD_LIBS+=lib/libmd.so.4
|
||||
OLD_LIBS+=lib/libmd.so.5
|
||||
OLD_LIBS+=lib/libncurses.so.7
|
||||
OLD_LIBS+=lib/libncursesw.so.7
|
||||
OLD_LIBS+=lib/libnvpair.so.1
|
||||
|
||||
@@ -11,6 +11,11 @@ handbook:
|
||||
Items affecting the ports and packages system can be found in
|
||||
/usr/ports/UPDATING. Please read that file before running portupgrade.
|
||||
|
||||
NOTE: FreeBSD has switched from gcc to clang. If you have trouble bootstrapping
|
||||
from older versions of FreeBSD, try WITHOUT_CLANG to bootstrap to the tip of
|
||||
head, and then rebuild without this option. The bootstrap process from
|
||||
older version of current is a bit fragile.
|
||||
|
||||
NOTE TO PEOPLE WHO THINK THAT FreeBSD 10.x IS SLOW:
|
||||
FreeBSD 10.x has many debugging features turned on, in both the kernel
|
||||
and userland. These features attempt to detect incorrect use of
|
||||
@@ -26,6 +31,172 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 10.x IS SLOW:
|
||||
disable the most expensive debugging functionality run
|
||||
"ln -s 'abort:false,junk:false' /etc/malloc.conf".)
|
||||
|
||||
20130905:
|
||||
The PROCDESC kernel option is now part of the GENERIC kernel
|
||||
configuration and is required for the rwhod(8) to work.
|
||||
If you are using custom kernel configuration, you should include
|
||||
'options PROCDESC'.
|
||||
|
||||
20130905:
|
||||
The API and ABI related to the Capsicum framework was modified
|
||||
in backward incompatible way. The userland libraries and programs
|
||||
have to be recompiled to work with the new kernel. This includes the
|
||||
following libraries and programs, but the whole buildworld is
|
||||
advised: libc, libprocstat, dhclient, tcpdump, hastd, hastctl,
|
||||
kdump, procstat, rwho, rwhod, uniq.
|
||||
|
||||
20130827:
|
||||
Thomas Dickey (vendor author thereof) reports that dialog(1) since
|
||||
2011/10/18 has a bug in handling --hline. Testers and I noticed the
|
||||
--hline is not ignored but displayed as a NULL string, regardless of
|
||||
value. This will cause confusion in some bsdconfig dialogs where the
|
||||
--hline is used to inform users which keybindings to use. This will
|
||||
likewise affect any other persons relying on --hline. It also looks
|
||||
rather strange seeing "[]" at the bottom of dialog(1) widgets when
|
||||
passing --hline "anything". Thomas said he will have a look in a few
|
||||
weeks. NOTE: The "[]" brackets appear with the left-edge where it
|
||||
would normally appear given the width of text to display, but the
|
||||
displayed text is not there (part of the bug).
|
||||
|
||||
20130821:
|
||||
The PADLOCK_RNG and RDRAND_RNG kernel options are now devices.
|
||||
Thus "device padlock_rng" and "device rdrand_rng" should be
|
||||
used instead of "options PADLOCK_RNG" & "options RDRAND_RNG".
|
||||
|
||||
20130813:
|
||||
WITH_ICONV has been split into two feature sets. WITH_ICONV now
|
||||
enables just the iconv* functionality and is now on by default.
|
||||
WITH_LIBICONV_COMPAT enables the libiconv api and link time
|
||||
compatability. Set WITHOUT_ICONV to build the old way.
|
||||
If you have been using WITH_ICONV before, you will very likely
|
||||
need to turn on WITH_LIBICONV_COMPAT.
|
||||
|
||||
20130806:
|
||||
INVARIANTS option now enables DEBUG for code with OpenSolaris and
|
||||
Illumos origin, including ZFS. If you have INVARIANTS in your
|
||||
kernel configuration, then there is no need to set DEBUG or ZFS_DEBUG
|
||||
explicitly.
|
||||
DEBUG used to enable witness(9) tracking of OpenSolaris (mostly ZFS)
|
||||
locks if WITNESS option was set. Because that generated a lot of
|
||||
witness(9) reports and all of them were believed to be false
|
||||
positives, this is no longer done. New option OPENSOLARIS_WITNESS
|
||||
can be used to achieve the previous behavior.
|
||||
|
||||
20130806:
|
||||
Timer values in IPv6 data structures now use time_uptime instead
|
||||
of time_second. Although this is not a user-visible functional
|
||||
change, userland utilities which directly use them---ndp(8),
|
||||
rtadvd(8), and rtsold(8) in the base system---need to be updated
|
||||
to r253970 or later.
|
||||
|
||||
20130802:
|
||||
find -delete can now delete the pathnames given as arguments,
|
||||
instead of only files found below them or if the pathname did
|
||||
not contain any slashes. Formerly, the following error message
|
||||
would result:
|
||||
|
||||
find: -delete: <path>: relative path potentially not safe
|
||||
|
||||
Deleting the pathnames given as arguments can be prevented
|
||||
without error messages using -mindepth 1 or by changing
|
||||
directory and passing "." as argument to find. This works in the
|
||||
old as well as the new version of find.
|
||||
|
||||
20130726:
|
||||
Behavior of devfs rules path matching has been changed.
|
||||
Pattern is now always matched against fully qualified devfs
|
||||
path and slash characters must be explicitly matched by
|
||||
slashes in pattern (FNM_PATHNAME). Rulesets involving devfs
|
||||
subdirectories must be reviewed.
|
||||
|
||||
20130716:
|
||||
The default ARM ABI has changed to the ARM EABI. The old ABI is
|
||||
incompatible with the ARM EABI and all programs and modules will
|
||||
need to be rebuilt to work with a new kernel.
|
||||
|
||||
To keep using the old ABI ensure the WITHOUT_ARM_EABI knob is set.
|
||||
|
||||
NOTE: Support for the old ABI will be removed in the future and
|
||||
users are advised to upgrade.
|
||||
|
||||
20130709:
|
||||
pkg_install has been disconnected from the build if you really need it
|
||||
you should add WITH_PKGTOOLS in your src.conf(5).
|
||||
|
||||
20130709:
|
||||
Most of network statistics structures were changed to be able
|
||||
keep 64-bits counters. Thus all tools, that work with networking
|
||||
statistics, must be rebuilt (netstat(1), bsnmpd(1), etc.)
|
||||
|
||||
20130629:
|
||||
Fix targets that run multiple make's to use && rather than ;
|
||||
so that subsequent steps depend on success of previous.
|
||||
|
||||
NOTE: if building 'universe' with -j* on stable/8 or stable/9
|
||||
it would be better to start the build using bmake, to avoid
|
||||
overloading the machine.
|
||||
|
||||
20130618:
|
||||
Fix a bug that allowed a tracing process (e.g. gdb) to write
|
||||
to a memory-mapped file in the traced process's address space
|
||||
even if neither the traced process nor the tracing process had
|
||||
write access to that file.
|
||||
|
||||
20130615:
|
||||
CVS has been removed from the base system. An exact copy
|
||||
of the code is available from the devel/cvs port.
|
||||
|
||||
20130613:
|
||||
Some people report the following error after the switch to bmake:
|
||||
|
||||
make: illegal option -- J
|
||||
usage: make [-BPSXeiknpqrstv] [-C directory] [-D variable]
|
||||
...
|
||||
*** [buildworld] Error code 2
|
||||
|
||||
this likely due to an old instance of make in
|
||||
${MAKEPATH} (${MAKEOBJDIRPREFIX}${.CURDIR}/make.${MACHINE})
|
||||
which src/Makefile will use that blindly, if it exists, so if
|
||||
you see the above error:
|
||||
|
||||
rm -rf `make -V MAKEPATH`
|
||||
|
||||
should resolve it.
|
||||
|
||||
20130516:
|
||||
Use bmake by default.
|
||||
Whereas before one could choose to build with bmake via
|
||||
-DWITH_BMAKE one must now use -DWITHOUT_BMAKE to use the old
|
||||
make. The goal is to remove these knobs for 10-RELEASE.
|
||||
|
||||
It is worth noting that bmake (like gmake) treats the command
|
||||
line as the unit of failure, rather than statements within the
|
||||
command line. Thus '(cd some/where && dosomething)' is safer
|
||||
than 'cd some/where; dosomething'. The '()' allows consistent
|
||||
behavior in parallel build.
|
||||
|
||||
20130429:
|
||||
Fix a bug that allows NFS clients to issue READDIR on files.
|
||||
|
||||
20130426:
|
||||
The WITHOUT_IDEA option has been removed because
|
||||
the IDEA patent expired.
|
||||
|
||||
20130426:
|
||||
The sysctl which controls TRIM support under ZFS has been renamed
|
||||
from vfs.zfs.trim_disable -> vfs.zfs.trim.enabled and has been
|
||||
enabled by default.
|
||||
|
||||
20130425:
|
||||
The mergemaster command now uses the default MAKEOBJDIRPREFIX
|
||||
rather than creating it's own in the temporary directory in
|
||||
order allow access to bootstrapped versions of tools such as
|
||||
install and mtree. When upgrading from version of FreeBSD where
|
||||
the install command does not support -l, you will need to
|
||||
install a new mergemaster command if mergemaster -p is required.
|
||||
This can be accomplished with the command (cd src/usr.sbin/mergemaster
|
||||
&& make install).
|
||||
|
||||
20130404:
|
||||
Legacy ATA stack, disabled and replaced by new CAM-based one since
|
||||
FreeBSD 9.0, completely removed from the sources. Kernel modules
|
||||
@@ -77,6 +248,14 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 10.x IS SLOW:
|
||||
while having the GNU version installed as gnupatch, rebuild
|
||||
and install world with the WITH_BSD_PATCH knob set.
|
||||
|
||||
20130121:
|
||||
Due to the use of the new -l option to install(1) during build
|
||||
and install, you must take care not to directly set the INSTALL
|
||||
make variable in your /etc/make.conf, /etc/src.conf, or on the
|
||||
command line. If you wish to use the -C flag for all installs
|
||||
you may be able to add INSTALL+=-C to /etc/make.conf or
|
||||
/etc/src.conf.
|
||||
|
||||
20130118:
|
||||
The install(1) option -M has changed meaning and now takes an
|
||||
argument that is a file or path to append logs to. In the
|
||||
@@ -122,7 +301,10 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 10.x IS SLOW:
|
||||
This means that the world and kernel will be compiled with clang
|
||||
and that clang will be installed as /usr/bin/cc, /usr/bin/c++,
|
||||
and /usr/bin/cpp. To disable this behavior and revert to building
|
||||
with gcc, compile with WITHOUT_CLANG_IS_CC.
|
||||
with gcc, compile with WITHOUT_CLANG_IS_CC. Really old versions
|
||||
of current may need to bootstrap WITHOUT_CLANG first if the clang
|
||||
build fails (its compatibility window doesn't extend to the 9 stable
|
||||
branch point).
|
||||
|
||||
20121102:
|
||||
The IPFIREWALL_FORWARD kernel option has been removed. Its
|
||||
@@ -190,9 +372,9 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 10.x IS SLOW:
|
||||
20120913:
|
||||
The random(4) support for the VIA hardware random number
|
||||
generator (`PADLOCK') is no longer enabled unconditionally.
|
||||
Add the PADLOCK_RNG option in the custom kernel config if
|
||||
Add the padlock_rng device in the custom kernel config if
|
||||
needed. The GENERIC kernels on i386 and amd64 do include the
|
||||
option, so the change only affects the custom kernel
|
||||
device, so the change only affects the custom kernel
|
||||
configurations.
|
||||
|
||||
20120908:
|
||||
@@ -253,7 +435,9 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 10.x IS SLOW:
|
||||
is now spelled mips64. mipsn32eb is now spelled mipsn32. mipseb is
|
||||
now spelled mips. This is to aid compatibility with third-party
|
||||
software that expects this naming scheme in uname(3). Little-endian
|
||||
settings are unchanged.
|
||||
settings are unchanged. If you are updating a big-endian mips64 machine
|
||||
from before this change, you may need to set MACHINE_ARCH=mips64 in
|
||||
your environment before the new build system will recognize your machine.
|
||||
|
||||
20120306:
|
||||
Disable by default the option VFS_ALLOW_NONMPSAFE for all supported
|
||||
@@ -1604,6 +1788,11 @@ COMMON ITEMS:
|
||||
path, and has the highest probability of being successful. Please try
|
||||
this approach before reporting problems with a major version upgrade.
|
||||
|
||||
When upgrading a live system, having a root shell around before
|
||||
installing anything can help undo problems. Not having a root shell
|
||||
around can lead to problems if pam has changed too much from your
|
||||
starting point to allow continued authentication after the upgrade.
|
||||
|
||||
ZFS notes
|
||||
---------
|
||||
When upgrading the boot ZFS pool to a new version, always follow
|
||||
@@ -1669,7 +1858,6 @@ COMMON ITEMS:
|
||||
make delete-old [6]
|
||||
<reboot>
|
||||
|
||||
|
||||
To cross-install current onto a separate partition
|
||||
--------------------------------------------------
|
||||
# In this approach we use a separate partition to hold
|
||||
@@ -1745,7 +1933,7 @@ COMMON ITEMS:
|
||||
step. It never hurts to do it all the time. You may need to
|
||||
install a new mergemaster (cd src/usr.sbin/mergemaster && make
|
||||
install) after the buildworld before this step if you last updated
|
||||
from current before 20020224 or from -stable before 20020408.
|
||||
from current before 20130425 or from -stable before 20130430.
|
||||
|
||||
[6] This only deletes old files and directories. Old libraries
|
||||
can be deleted by "make delete-old-libs", but you have to make
|
||||
|
||||
+2
-1
@@ -68,7 +68,7 @@ static int bflag, eflag, lflag, nflag, sflag, tflag, vflag;
|
||||
static int rval;
|
||||
static const char *filename;
|
||||
|
||||
static void usage(void);
|
||||
static void usage(void) __dead2;
|
||||
static void scanfiles(char *argv[], int cooked);
|
||||
static void cook_cat(FILE *);
|
||||
static void raw_cat(int);
|
||||
@@ -153,6 +153,7 @@ main(int argc, char *argv[])
|
||||
static void
|
||||
usage(void)
|
||||
{
|
||||
|
||||
fprintf(stderr, "usage: cat [-belnstuv] [file ...]\n");
|
||||
exit(1);
|
||||
/* NOTREACHED */
|
||||
|
||||
+19
-3
@@ -32,7 +32,7 @@
|
||||
.\" @(#)chflags.1 8.4 (Berkeley) 5/2/95
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd March 3, 2006
|
||||
.Dd April 8, 2013
|
||||
.Dt CHFLAGS 1
|
||||
.Os
|
||||
.Sh NAME
|
||||
@@ -101,20 +101,36 @@ The following keywords are currently defined:
|
||||
.Bl -tag -offset indent -width ".Cm opaque"
|
||||
.It Cm arch , archived
|
||||
set the archived flag (super-user only)
|
||||
.It Cm opaque
|
||||
set the opaque flag (owner or super-user only)
|
||||
.It Cm nodump
|
||||
set the nodump flag (owner or super-user only)
|
||||
.It Cm opaque
|
||||
set the opaque flag (owner or super-user only)
|
||||
.It Cm sappnd , sappend
|
||||
set the system append-only flag (super-user only)
|
||||
.It Cm schg , schange , simmutable
|
||||
set the system immutable flag (super-user only)
|
||||
.It Cm snapshot
|
||||
set the snapshot flag (filesystems do not allow changing this flag)
|
||||
.It Cm sunlnk , sunlink
|
||||
set the system undeletable flag (super-user only)
|
||||
.It Cm uappnd , uappend
|
||||
set the user append-only flag (owner or super-user only)
|
||||
.It Cm uarch , uarchive
|
||||
set the archive flag (owner or super-user only)
|
||||
.It Cm uchg , uchange , uimmutable
|
||||
set the user immutable flag (owner or super-user only)
|
||||
.It Cm uhidden , hidden
|
||||
set the hidden file attribute (owner or super-user only)
|
||||
.It Cm uoffline , offline
|
||||
set the offline file attribute (owner or super-user only)
|
||||
.It Cm urdonly , rdonly , readonly
|
||||
set the DOS, Windows and CIFS readonly flag (owner or super-user only)
|
||||
.It Cm usparse , sparse
|
||||
set the sparse file attribute (owner or super-user only)
|
||||
.It Cm usystem , system
|
||||
set the DOS, Windows and CIFS system flag (owner or super-user only)
|
||||
.It Cm ureparse , reparse
|
||||
set the Windows reparse point file attribute (owner or super-user only)
|
||||
.It Cm uunlnk , uunlink
|
||||
set the user undeletable flag (owner or super-user only)
|
||||
.El
|
||||
|
||||
@@ -54,6 +54,8 @@ __FBSDID("$FreeBSD$");
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <langinfo.h>
|
||||
#include <locale.h>
|
||||
|
||||
#include "defs.h"
|
||||
#include "pathnames.h"
|
||||
@@ -81,6 +83,7 @@ static int do_status(const char *, int, char **);
|
||||
static int do_ielem(const char *, int, char **);
|
||||
static int do_return(const char *, int, char **);
|
||||
static int do_voltag(const char *, int, char **);
|
||||
static void print_designator(const char *, u_int8_t, u_int8_t);
|
||||
|
||||
#ifndef CHET_VT
|
||||
#define CHET_VT 10 /* Completely Arbitrary */
|
||||
@@ -723,6 +726,10 @@ do_status(const char *cname, int argc, char **argv)
|
||||
putchar('?');
|
||||
putchar('>');
|
||||
}
|
||||
if (ces->ces_designator_length > 0)
|
||||
print_designator(ces->ces_designator,
|
||||
ces->ces_code_set,
|
||||
ces->ces_designator_length);
|
||||
putchar('\n');
|
||||
}
|
||||
|
||||
@@ -1177,3 +1184,66 @@ usage(void)
|
||||
"arg1 arg2 [arg3 [...]]\n", getprogname());
|
||||
exit(1);
|
||||
}
|
||||
|
||||
#define UTF8CODESET "UTF-8"
|
||||
|
||||
static void
|
||||
print_designator(const char *designator, u_int8_t code_set,
|
||||
u_int8_t designator_length)
|
||||
{
|
||||
printf(" serial number: <");
|
||||
switch (code_set) {
|
||||
case CES_CODE_SET_ASCII: {
|
||||
/*
|
||||
* The driver insures that the string is always NUL terminated.
|
||||
*/
|
||||
printf("%s", designator);
|
||||
break;
|
||||
}
|
||||
case CES_CODE_SET_UTF_8: {
|
||||
char *cs_native;
|
||||
|
||||
setlocale(LC_ALL, "");
|
||||
cs_native = nl_langinfo(CODESET);
|
||||
|
||||
/* See if we can natively print UTF-8 */
|
||||
if (strcmp(cs_native, UTF8CODESET) == 0)
|
||||
cs_native = NULL;
|
||||
|
||||
if (cs_native == NULL) {
|
||||
/* We can natively print UTF-8, so use printf. */
|
||||
printf("%s", designator);
|
||||
} else {
|
||||
int i;
|
||||
|
||||
/*
|
||||
* We can't natively print UTF-8. We should
|
||||
* convert it to the terminal's codeset, but that
|
||||
* requires iconv(3) and FreeBSD doesn't have
|
||||
* iconv(3) in the base system yet. So we use %XX
|
||||
* notation for non US-ASCII characters instead.
|
||||
*/
|
||||
for (i = 0; i < designator_length &&
|
||||
designator[i] != '\0'; i++) {
|
||||
if ((unsigned char)designator[i] < 0x80)
|
||||
printf("%c", designator[i]);
|
||||
else
|
||||
printf("%%%02x",
|
||||
(unsigned char)designator[i]);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case CES_CODE_SET_BINARY: {
|
||||
int i;
|
||||
|
||||
for (i = 0; i < designator_length; i++)
|
||||
printf("%02X%s", designator[i],
|
||||
(i == designator_length - 1) ? "" : " ");
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
printf(">");
|
||||
}
|
||||
|
||||
@@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$");
|
||||
#include <errno.h>
|
||||
#include <inttypes.h>
|
||||
#include <limits.h>
|
||||
#include <signal.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
|
||||
@@ -41,6 +41,7 @@ __FBSDID("$FreeBSD$");
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <signal.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "dd.h"
|
||||
|
||||
+6
-2
@@ -81,6 +81,7 @@ size_t cbsz; /* conversion block size */
|
||||
uintmax_t files_cnt = 1; /* # of files to copy */
|
||||
const u_char *ctab; /* conversion table */
|
||||
char fill_char; /* Character to fill with if defined */
|
||||
volatile sig_atomic_t need_summary;
|
||||
|
||||
int
|
||||
main(int argc __unused, char *argv[])
|
||||
@@ -89,7 +90,7 @@ main(int argc __unused, char *argv[])
|
||||
jcl(argv);
|
||||
setup();
|
||||
|
||||
(void)signal(SIGINFO, summaryx);
|
||||
(void)signal(SIGINFO, siginfo_handler);
|
||||
(void)signal(SIGINT, terminate);
|
||||
|
||||
atexit(summary);
|
||||
@@ -358,7 +359,7 @@ dd_in(void)
|
||||
* than noerror, notrunc or sync are specified, the block
|
||||
* is output without buffering as it is read.
|
||||
*/
|
||||
if (ddflags & C_BS) {
|
||||
if ((ddflags & ~(C_NOERROR | C_NOTRUNC | C_SYNC)) == C_BS) {
|
||||
out.dbcnt = in.dbcnt;
|
||||
dd_out(1);
|
||||
in.dbcnt = 0;
|
||||
@@ -375,6 +376,9 @@ dd_in(void)
|
||||
|
||||
in.dbp += in.dbrcnt;
|
||||
(*cfunc)();
|
||||
if (need_summary) {
|
||||
summary();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+2
-1
@@ -43,7 +43,7 @@ void jcl(char **);
|
||||
void pos_in(void);
|
||||
void pos_out(void);
|
||||
void summary(void);
|
||||
void summaryx(int);
|
||||
void siginfo_handler(int);
|
||||
void terminate(int);
|
||||
void unblock(void);
|
||||
void unblock_close(void);
|
||||
@@ -61,3 +61,4 @@ extern const u_char e2a_32V[], e2a_POSIX[];
|
||||
extern const u_char a2ibm_32V[], a2ibm_POSIX[];
|
||||
extern u_char casetab[];
|
||||
extern char fill_char;
|
||||
extern volatile sig_atomic_t need_summary;
|
||||
|
||||
+10
-18
@@ -44,6 +44,7 @@ __FBSDID("$FreeBSD$");
|
||||
|
||||
#include <errno.h>
|
||||
#include <inttypes.h>
|
||||
#include <signal.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@@ -57,41 +58,32 @@ summary(void)
|
||||
{
|
||||
struct timeval tv;
|
||||
double secs;
|
||||
char buf[100];
|
||||
|
||||
(void)gettimeofday(&tv, NULL);
|
||||
secs = tv.tv_sec + tv.tv_usec * 1e-6 - st.start;
|
||||
if (secs < 1e-6)
|
||||
secs = 1e-6;
|
||||
/* Use snprintf(3) so that we don't reenter stdio(3). */
|
||||
(void)snprintf(buf, sizeof(buf),
|
||||
(void)fprintf(stderr,
|
||||
"%ju+%ju records in\n%ju+%ju records out\n",
|
||||
st.in_full, st.in_part, st.out_full, st.out_part);
|
||||
(void)write(STDERR_FILENO, buf, strlen(buf));
|
||||
if (st.swab) {
|
||||
(void)snprintf(buf, sizeof(buf), "%ju odd length swab %s\n",
|
||||
if (st.swab)
|
||||
(void)fprintf(stderr, "%ju odd length swab %s\n",
|
||||
st.swab, (st.swab == 1) ? "block" : "blocks");
|
||||
(void)write(STDERR_FILENO, buf, strlen(buf));
|
||||
}
|
||||
if (st.trunc) {
|
||||
(void)snprintf(buf, sizeof(buf), "%ju truncated %s\n",
|
||||
if (st.trunc)
|
||||
(void)fprintf(stderr, "%ju truncated %s\n",
|
||||
st.trunc, (st.trunc == 1) ? "block" : "blocks");
|
||||
(void)write(STDERR_FILENO, buf, strlen(buf));
|
||||
}
|
||||
(void)snprintf(buf, sizeof(buf),
|
||||
(void)fprintf(stderr,
|
||||
"%ju bytes transferred in %.6f secs (%.0f bytes/sec)\n",
|
||||
st.bytes, secs, st.bytes / secs);
|
||||
(void)write(STDERR_FILENO, buf, strlen(buf));
|
||||
need_summary = 0;
|
||||
}
|
||||
|
||||
/* ARGSUSED */
|
||||
void
|
||||
summaryx(int notused __unused)
|
||||
siginfo_handler(int signo __unused)
|
||||
{
|
||||
int save_errno = errno;
|
||||
|
||||
summary();
|
||||
errno = save_errno;
|
||||
need_summary = 1;
|
||||
}
|
||||
|
||||
/* ARGSUSED */
|
||||
|
||||
@@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$");
|
||||
#include <err.h>
|
||||
#include <errno.h>
|
||||
#include <inttypes.h>
|
||||
#include <signal.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "dd.h"
|
||||
@@ -91,6 +92,8 @@ pos_in(void)
|
||||
}
|
||||
} else
|
||||
--cnt;
|
||||
if (need_summary)
|
||||
summary();
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
+3
-1
@@ -196,7 +196,9 @@ If the value is outside, it will be set to the appropriate limit.
|
||||
.Xr localeconv 3 ,
|
||||
.Xr fstab 5 ,
|
||||
.Xr mount 8 ,
|
||||
.Xr quot 8 .
|
||||
.Xr pstat 8 ,
|
||||
.Xr quot 8 ,
|
||||
.Xr swapinfo 8 .
|
||||
.Sh STANDARDS
|
||||
With the exception of most options,
|
||||
the
|
||||
|
||||
+6
-5
@@ -114,6 +114,7 @@ main(int argc, char *argv[])
|
||||
|
||||
fstype = "ufs";
|
||||
(void)setlocale(LC_ALL, "");
|
||||
memset(&maxwidths, 0, sizeof(maxwidths));
|
||||
memset(&totalbuf, 0, sizeof(totalbuf));
|
||||
totalbuf.f_bsize = DEV_BSIZE;
|
||||
strlcpy(totalbuf.f_mntfromname, "total", MNAMELEN);
|
||||
@@ -200,7 +201,7 @@ main(int argc, char *argv[])
|
||||
} else {
|
||||
/* just the filesystems specified on the command line */
|
||||
mntbuf = malloc(argc * sizeof(*mntbuf));
|
||||
if (mntbuf == 0)
|
||||
if (mntbuf == NULL)
|
||||
err(1, "malloc()");
|
||||
mntsize = 0;
|
||||
/* continued in for loop below */
|
||||
@@ -209,13 +210,13 @@ main(int argc, char *argv[])
|
||||
/* iterate through specified filesystems */
|
||||
for (; *argv; argv++) {
|
||||
if (stat(*argv, &stbuf) < 0) {
|
||||
if ((mntpt = getmntpt(*argv)) == 0) {
|
||||
if ((mntpt = getmntpt(*argv)) == NULL) {
|
||||
warn("%s", *argv);
|
||||
rv = 1;
|
||||
continue;
|
||||
}
|
||||
} else if (S_ISCHR(stbuf.st_mode)) {
|
||||
if ((mntpt = getmntpt(*argv)) == 0) {
|
||||
if ((mntpt = getmntpt(*argv)) == NULL) {
|
||||
mdev.fspec = *argv;
|
||||
mntpath = strdup("/tmp/df.XXXXXX");
|
||||
if (mntpath == NULL) {
|
||||
@@ -282,7 +283,7 @@ main(int argc, char *argv[])
|
||||
mntbuf[mntsize++] = statfsbuf;
|
||||
}
|
||||
|
||||
bzero(&maxwidths, sizeof(maxwidths));
|
||||
memset(&maxwidths, 0, sizeof(maxwidths));
|
||||
for (i = 0; i < mntsize; i++) {
|
||||
if (aflag || (mntbuf[i].f_flags & MNT_IGNORE) == 0) {
|
||||
update_maxwidths(&maxwidths, &mntbuf[i]);
|
||||
@@ -309,7 +310,7 @@ getmntpt(const char *name)
|
||||
if (!strcmp(mntbuf[i].f_mntfromname, name))
|
||||
return (mntbuf[i].f_mntonname);
|
||||
}
|
||||
return (0);
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
.\" From: @(#)hostname.1 8.1 (Berkeley) 5/31/93
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd September 18, 1994
|
||||
.Dd April 22, 2013
|
||||
.Dt DOMAINNAME 1
|
||||
.Os
|
||||
.Sh NAME
|
||||
@@ -43,10 +43,11 @@ The
|
||||
.Nm
|
||||
utility prints the name of the current YP/NIS domain.
|
||||
The super-user can
|
||||
set the domain name by supplying an argument; this is usually done in the
|
||||
network initialization script
|
||||
.Pa /etc/rc.network ,
|
||||
normally run at boot
|
||||
set the domain name by supplying an argument; this is usually done with the
|
||||
.Va nisdomainname
|
||||
variable in the
|
||||
.Pa /etc/rc.conf
|
||||
file, normally run at boot
|
||||
time.
|
||||
.Sh NOTES
|
||||
The YP/NIS (formerly ``Yellow Pages'' but renamed for legal reasons)
|
||||
@@ -54,7 +55,8 @@ domain name does not necessarily have anything to do with the Domain
|
||||
Name System domain name, although they are often set equal for administrative
|
||||
convenience.
|
||||
.Sh SEE ALSO
|
||||
.Xr getdomainname 3
|
||||
.Xr getdomainname 3 ,
|
||||
.Xr rc.conf 5
|
||||
.Sh HISTORY
|
||||
The
|
||||
.Nm
|
||||
|
||||
+2
-2
@@ -914,9 +914,9 @@ that line.
|
||||
.El
|
||||
.Sh FILES
|
||||
.Bl -tag -width /tmp/ed.* -compact
|
||||
.It /tmp/ed.*
|
||||
.It Pa /tmp/ed.*
|
||||
buffer file
|
||||
.It ed.hup
|
||||
.It Pa ed.hup
|
||||
the file to which
|
||||
.Nm
|
||||
attempts to write the buffer if the terminal hangs up
|
||||
|
||||
+1
-1
@@ -89,7 +89,7 @@ extract_pattern(int delimiter)
|
||||
default:
|
||||
break;
|
||||
case '[':
|
||||
if ((nd = parse_char_class(++nd)) == NULL) {
|
||||
if ((nd = parse_char_class(nd + 1)) == NULL) {
|
||||
errmsg = "unbalanced brackets ([])";
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -4,4 +4,6 @@ PROG= expr
|
||||
SRCS= expr.y
|
||||
YFLAGS=
|
||||
|
||||
NO_WMISSING_VARIABLE_DECLARATIONS=
|
||||
|
||||
.include <bsd.prog.mk>
|
||||
|
||||
@@ -49,7 +49,7 @@ __FBSDID("$FreeBSD$");
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
static void usage(void);
|
||||
static void usage(void) __dead2;
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
|
||||
+6
-6
@@ -37,9 +37,9 @@ __FBSDID("$FreeBSD$");
|
||||
|
||||
static void usage(void);
|
||||
static int kdumpenv(void);
|
||||
static int kgetenv(char *);
|
||||
static int ksetenv(char *, char *);
|
||||
static int kunsetenv(char *);
|
||||
static int kgetenv(const char *);
|
||||
static int ksetenv(const char *, char *);
|
||||
static int kunsetenv(const char *);
|
||||
|
||||
static int hflag = 0;
|
||||
static int Nflag = 0;
|
||||
@@ -170,7 +170,7 @@ kdumpenv(void)
|
||||
}
|
||||
|
||||
static int
|
||||
kgetenv(char *env)
|
||||
kgetenv(const char *env)
|
||||
{
|
||||
char buf[1024];
|
||||
int ret;
|
||||
@@ -186,7 +186,7 @@ kgetenv(char *env)
|
||||
}
|
||||
|
||||
static int
|
||||
ksetenv(char *env, char *val)
|
||||
ksetenv(const char *env, char *val)
|
||||
{
|
||||
int ret;
|
||||
|
||||
@@ -197,7 +197,7 @@ ksetenv(char *env, char *val)
|
||||
}
|
||||
|
||||
static int
|
||||
kunsetenv(char *env)
|
||||
kunsetenv(const char *env)
|
||||
{
|
||||
int ret;
|
||||
|
||||
|
||||
+1
-1
@@ -156,7 +156,7 @@ signame_to_signum(const char *sig)
|
||||
{
|
||||
int n;
|
||||
|
||||
if (!strncasecmp(sig, "SIG", (size_t)3))
|
||||
if (strncasecmp(sig, "SIG", 3) == 0)
|
||||
sig += 3;
|
||||
for (n = 1; n < sys_nsig; n++) {
|
||||
if (!strcasecmp(sys_signame[n], sig))
|
||||
|
||||
+4
-4
@@ -65,8 +65,8 @@ static int wflag; /* Warn if symlink target does not
|
||||
* exist, and -f is not enabled. */
|
||||
static char linkch;
|
||||
|
||||
int linkit(const char *, const char *, int);
|
||||
void usage(void);
|
||||
static int linkit(const char *, const char *, int);
|
||||
static void usage(void);
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
@@ -219,7 +219,7 @@ samedirent(const char *path1, const char *path2)
|
||||
return sb1.st_dev == sb2.st_dev && sb1.st_ino == sb2.st_ino;
|
||||
}
|
||||
|
||||
int
|
||||
static int
|
||||
linkit(const char *source, const char *target, int isdir)
|
||||
{
|
||||
struct stat sb;
|
||||
@@ -347,7 +347,7 @@ linkit(const char *source, const char *target, int isdir)
|
||||
return (0);
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
usage(void)
|
||||
{
|
||||
(void)fprintf(stderr, "%s\n%s\n%s\n",
|
||||
|
||||
@@ -232,6 +232,9 @@ output.
|
||||
Include the file flags in a long
|
||||
.Pq Fl l
|
||||
output.
|
||||
See
|
||||
.Xr chflags 1
|
||||
for a list of file flags and their meanings.
|
||||
.It Fl p
|
||||
Write a slash
|
||||
.Pq Ql /
|
||||
|
||||
+2
-2
@@ -135,7 +135,7 @@ main(int argc, char *argv[])
|
||||
* Returns 1 if a directory has been created,
|
||||
* 2 if it already existed, and 0 on failure.
|
||||
*/
|
||||
int
|
||||
static int
|
||||
build(char *path, mode_t omode)
|
||||
{
|
||||
struct stat sb;
|
||||
@@ -208,7 +208,7 @@ build(char *path, mode_t omode)
|
||||
return (retval);
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
usage(void)
|
||||
{
|
||||
|
||||
|
||||
+6
-1
@@ -29,7 +29,7 @@
|
||||
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
.\" POSSIBILITY OF SUCH DAMAGE.
|
||||
.\"
|
||||
.Dd February 11, 2010
|
||||
.Dd August 9, 2013
|
||||
.Dt PKILL 1
|
||||
.Os
|
||||
.Sh NAME
|
||||
@@ -44,6 +44,7 @@
|
||||
.Op Fl N Ar system
|
||||
.Op Fl P Ar ppid
|
||||
.Op Fl U Ar uid
|
||||
.Op Fl c Ar class
|
||||
.Op Fl d Ar delim
|
||||
.Op Fl g Ar pgrp
|
||||
.Op Fl j Ar jid
|
||||
@@ -60,6 +61,7 @@
|
||||
.Op Fl N Ar system
|
||||
.Op Fl P Ar ppid
|
||||
.Op Fl U Ar uid
|
||||
.Op Fl c Ar class
|
||||
.Op Fl g Ar pgrp
|
||||
.Op Fl j Ar jid
|
||||
.Op Fl s Ar sid
|
||||
@@ -130,6 +132,9 @@ or
|
||||
process and all of its ancestors are excluded (unless
|
||||
.Fl v
|
||||
is used).
|
||||
.It Fl c Ar class
|
||||
Restrict matches to processes running with specified login class
|
||||
.Ar class .
|
||||
.It Fl f
|
||||
Match against full argument lists.
|
||||
The default is to match against process names.
|
||||
|
||||
+36
-7
@@ -79,12 +79,14 @@ enum listtype {
|
||||
LT_TTY,
|
||||
LT_PGRP,
|
||||
LT_JID,
|
||||
LT_SID
|
||||
LT_SID,
|
||||
LT_CLASS
|
||||
};
|
||||
|
||||
struct list {
|
||||
SLIST_ENTRY(list) li_chain;
|
||||
long li_number;
|
||||
char *li_name;
|
||||
};
|
||||
|
||||
SLIST_HEAD(listhead, list);
|
||||
@@ -116,6 +118,7 @@ static struct listhead ppidlist = SLIST_HEAD_INITIALIZER(ppidlist);
|
||||
static struct listhead tdevlist = SLIST_HEAD_INITIALIZER(tdevlist);
|
||||
static struct listhead sidlist = SLIST_HEAD_INITIALIZER(sidlist);
|
||||
static struct listhead jidlist = SLIST_HEAD_INITIALIZER(jidlist);
|
||||
static struct listhead classlist = SLIST_HEAD_INITIALIZER(classlist);
|
||||
|
||||
static void usage(void) __attribute__((__noreturn__));
|
||||
static int killact(const struct kinfo_proc *);
|
||||
@@ -179,7 +182,7 @@ main(int argc, char **argv)
|
||||
execf = NULL;
|
||||
coref = _PATH_DEVNULL;
|
||||
|
||||
while ((ch = getopt(argc, argv, "DF:G:ILM:N:P:SU:ad:fg:ij:lnoqs:t:u:vx")) != -1)
|
||||
while ((ch = getopt(argc, argv, "DF:G:ILM:N:P:SU:ac:d:fg:ij:lnoqs:t:u:vx")) != -1)
|
||||
switch (ch) {
|
||||
case 'D':
|
||||
debug_opt++;
|
||||
@@ -222,6 +225,10 @@ main(int argc, char **argv)
|
||||
case 'a':
|
||||
ancestors++;
|
||||
break;
|
||||
case 'c':
|
||||
makelist(&classlist, LT_CLASS, optarg);
|
||||
criteria = 1;
|
||||
break;
|
||||
case 'd':
|
||||
if (!pgrep)
|
||||
usage();
|
||||
@@ -469,6 +476,20 @@ main(int argc, char **argv)
|
||||
continue;
|
||||
}
|
||||
|
||||
SLIST_FOREACH(li, &classlist, li_chain) {
|
||||
/*
|
||||
* We skip P_SYSTEM processes to match ps(1) output.
|
||||
*/
|
||||
if ((kp->ki_flag & P_SYSTEM) == 0 &&
|
||||
kp->ki_loginclass != NULL &&
|
||||
strcmp(kp->ki_loginclass, li->li_name) == 0)
|
||||
break;
|
||||
}
|
||||
if (SLIST_FIRST(&classlist) != NULL && li == NULL) {
|
||||
selected[i] = 0;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (argc == 0)
|
||||
selected[i] = 1;
|
||||
}
|
||||
@@ -562,9 +583,9 @@ usage(void)
|
||||
|
||||
fprintf(stderr,
|
||||
"usage: %s %s [-F pidfile] [-G gid] [-M core] [-N system]\n"
|
||||
" [-P ppid] [-U uid] [-g pgrp] [-j jid] [-s sid]\n"
|
||||
" [-t tty] [-u euid] pattern ...\n", getprogname(),
|
||||
ustr);
|
||||
" [-P ppid] [-U uid] [-c class] [-g pgrp] [-j jid]\n"
|
||||
" [-s sid] [-t tty] [-u euid] pattern ...\n",
|
||||
getprogname(), ustr);
|
||||
|
||||
exit(STATUS_BADUSAGE);
|
||||
}
|
||||
@@ -664,8 +685,10 @@ makelist(struct listhead *head, enum listtype type, char *src)
|
||||
SLIST_INSERT_HEAD(head, li, li_chain);
|
||||
empty = 0;
|
||||
|
||||
li->li_number = (uid_t)strtol(sp, &ep, 0);
|
||||
if (*ep == '\0') {
|
||||
if (type != LT_CLASS)
|
||||
li->li_number = (uid_t)strtol(sp, &ep, 0);
|
||||
|
||||
if (type != LT_CLASS && *ep == '\0') {
|
||||
switch (type) {
|
||||
case LT_PGRP:
|
||||
if (li->li_number == 0)
|
||||
@@ -750,6 +773,12 @@ foundtty: if ((st.st_mode & S_IFCHR) == 0)
|
||||
errx(STATUS_BADUSAGE,
|
||||
"Invalid jail ID `%s'", sp);
|
||||
break;
|
||||
case LT_CLASS:
|
||||
li->li_number = -1;
|
||||
li->li_name = strdup(sp);
|
||||
if (li->li_name == NULL)
|
||||
err(STATUS_ERROR, "Cannot allocate memory");
|
||||
break;
|
||||
default:
|
||||
usage();
|
||||
}
|
||||
|
||||
@@ -87,6 +87,7 @@ static VAR var[] = {
|
||||
{"etimes", "ELAPSED", NULL, USER, elapseds, 0, CHAR, NULL, 0},
|
||||
{"euid", "", "uid", 0, NULL, 0, CHAR, NULL, 0},
|
||||
{"f", "F", NULL, 0, kvar, KOFF(ki_flag), INT, "x", 0},
|
||||
{"fib", "FIB", NULL, 0, kvar, KOFF(ki_fibnum), INT, "d", 0},
|
||||
{"flags", "", "f", 0, NULL, 0, CHAR, NULL, 0},
|
||||
{"gid", "GID", NULL, 0, kvar, KOFF(ki_groups), UINT, UIDFMT, 0},
|
||||
{"group", "GROUP", NULL, LJUST, egroupname, 0, CHAR, NULL, 0},
|
||||
|
||||
@@ -512,6 +512,9 @@ elapsed running time, format
|
||||
minutes:seconds.
|
||||
.It Cm etimes
|
||||
elapsed running time, in decimal integer seconds
|
||||
.It Cm fib
|
||||
default FIB number, see
|
||||
.Xr setfib 1
|
||||
.It Cm flags
|
||||
the process flags, in hexadecimal (alias
|
||||
.Cm f )
|
||||
|
||||
+4
-2
@@ -32,7 +32,7 @@
|
||||
.\" @(#)rm.1 8.5 (Berkeley) 12/5/94
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd March 15, 2013
|
||||
.Dd April 25, 2013
|
||||
.Dt RM 1
|
||||
.Os
|
||||
.Sh NAME
|
||||
@@ -42,7 +42,7 @@
|
||||
.Sh SYNOPSIS
|
||||
.Nm
|
||||
.Op Fl f | i
|
||||
.Op Fl dIPRrvW
|
||||
.Op Fl dIPRrvWx
|
||||
.Ar
|
||||
.Nm unlink
|
||||
.Ar file
|
||||
@@ -132,6 +132,8 @@ Attempt to undelete the named files.
|
||||
Currently, this option can only be used to recover
|
||||
files covered by whiteouts in a union file system (see
|
||||
.Xr undelete 2 ) .
|
||||
.It Fl x
|
||||
When removing a hierarchy, do not cross mount points.
|
||||
.El
|
||||
.Pp
|
||||
The
|
||||
|
||||
+28
-23
@@ -59,19 +59,19 @@ __FBSDID("$FreeBSD$");
|
||||
#include <unistd.h>
|
||||
|
||||
static int dflag, eval, fflag, iflag, Pflag, vflag, Wflag, stdin_ok;
|
||||
static int rflag, Iflag;
|
||||
static int rflag, Iflag, xflag;
|
||||
static uid_t uid;
|
||||
static volatile sig_atomic_t info;
|
||||
|
||||
int check(char *, char *, struct stat *);
|
||||
int check2(char **);
|
||||
void checkdot(char **);
|
||||
void checkslash(char **);
|
||||
void rm_file(char **);
|
||||
int rm_overwrite(char *, struct stat *);
|
||||
void rm_tree(char **);
|
||||
static int check(const char *, const char *, struct stat *);
|
||||
static int check2(char **);
|
||||
static void checkdot(char **);
|
||||
static void checkslash(char **);
|
||||
static void rm_file(char **);
|
||||
static int rm_overwrite(const char *, struct stat *);
|
||||
static void rm_tree(char **);
|
||||
static void siginfo(int __unused);
|
||||
void usage(void);
|
||||
static void usage(void);
|
||||
|
||||
/*
|
||||
* rm --
|
||||
@@ -106,8 +106,8 @@ main(int argc, char *argv[])
|
||||
exit(eval);
|
||||
}
|
||||
|
||||
Pflag = rflag = 0;
|
||||
while ((ch = getopt(argc, argv, "dfiIPRrvW")) != -1)
|
||||
Pflag = rflag = xflag = 0;
|
||||
while ((ch = getopt(argc, argv, "dfiIPRrvWx")) != -1)
|
||||
switch(ch) {
|
||||
case 'd':
|
||||
dflag = 1;
|
||||
@@ -136,6 +136,9 @@ main(int argc, char *argv[])
|
||||
case 'W':
|
||||
Wflag = 1;
|
||||
break;
|
||||
case 'x':
|
||||
xflag = 1;
|
||||
break;
|
||||
default:
|
||||
usage();
|
||||
}
|
||||
@@ -170,7 +173,7 @@ main(int argc, char *argv[])
|
||||
exit (eval);
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
rm_tree(char **argv)
|
||||
{
|
||||
FTS *fts;
|
||||
@@ -196,6 +199,8 @@ rm_tree(char **argv)
|
||||
flags |= FTS_NOSTAT;
|
||||
if (Wflag)
|
||||
flags |= FTS_WHITEOUT;
|
||||
if (xflag)
|
||||
flags |= FTS_XDEV;
|
||||
if (!(fts = fts_open(argv, flags, NULL))) {
|
||||
if (fflag && errno == ENOENT)
|
||||
return;
|
||||
@@ -335,7 +340,7 @@ rm_tree(char **argv)
|
||||
fts_close(fts);
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
rm_file(char **argv)
|
||||
{
|
||||
struct stat sb;
|
||||
@@ -412,8 +417,8 @@ rm_file(char **argv)
|
||||
* System V file system). In a logging or COW file system, you'll have to
|
||||
* have kernel support.
|
||||
*/
|
||||
int
|
||||
rm_overwrite(char *file, struct stat *sbp)
|
||||
static int
|
||||
rm_overwrite(const char *file, struct stat *sbp)
|
||||
{
|
||||
struct stat sb, sb2;
|
||||
struct statfs fsb;
|
||||
@@ -479,8 +484,8 @@ err: eval = 1;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
check(char *path, char *name, struct stat *sp)
|
||||
static int
|
||||
check(const char *path, const char *name, struct stat *sp)
|
||||
{
|
||||
int ch, first;
|
||||
char modep[15], *flagsp;
|
||||
@@ -491,7 +496,7 @@ check(char *path, char *name, struct stat *sp)
|
||||
else {
|
||||
/*
|
||||
* If it's not a symbolic link and it's unwritable and we're
|
||||
* talking to a terminal, ask. Symbolic links are excluded
|
||||
* talking to a terminal, ask. Symbolic links are excluded
|
||||
* because their permissions are meaningless. Check stdin_ok
|
||||
* first because we may not have stat'ed the file.
|
||||
*/
|
||||
@@ -524,7 +529,7 @@ check(char *path, char *name, struct stat *sp)
|
||||
}
|
||||
|
||||
#define ISSLASH(a) ((a)[0] == '/' && (a)[1] == '\0')
|
||||
void
|
||||
static void
|
||||
checkslash(char **argv)
|
||||
{
|
||||
char **t, **u;
|
||||
@@ -544,7 +549,7 @@ checkslash(char **argv)
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
static int
|
||||
check2(char **argv)
|
||||
{
|
||||
struct stat st;
|
||||
@@ -595,7 +600,7 @@ check2(char **argv)
|
||||
}
|
||||
|
||||
#define ISDOT(a) ((a)[0] == '.' && (!(a)[1] || ((a)[1] == '.' && !(a)[2])))
|
||||
void
|
||||
static void
|
||||
checkdot(char **argv)
|
||||
{
|
||||
char *p, **save, **t;
|
||||
@@ -619,12 +624,12 @@ checkdot(char **argv)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
usage(void)
|
||||
{
|
||||
|
||||
(void)fprintf(stderr, "%s\n%s\n",
|
||||
"usage: rm [-f | -i] [-dIPRrvW] file ...",
|
||||
"usage: rm [-f | -i] [-dIPRrvWx] file ...",
|
||||
" unlink file");
|
||||
exit(EX_USAGE);
|
||||
}
|
||||
|
||||
+3
-8
@@ -8,7 +8,7 @@ SHSRCS= alias.c arith_yacc.c arith_yylex.c cd.c echo.c error.c eval.c \
|
||||
histedit.c input.c jobs.c kill.c mail.c main.c memalloc.c miscbltin.c \
|
||||
mystring.c options.c output.c parser.c printf.c redir.c show.c \
|
||||
test.c trap.c var.c
|
||||
GENSRCS= builtins.c init.c nodes.c syntax.c
|
||||
GENSRCS= builtins.c nodes.c syntax.c
|
||||
GENHDRS= builtins.h nodes.h syntax.h token.h
|
||||
SRCS= ${SHSRCS} ${GENSRCS} ${GENHDRS}
|
||||
|
||||
@@ -30,26 +30,21 @@ WFORMAT=0
|
||||
${.CURDIR}/../test \
|
||||
${.CURDIR}/../../usr.bin/printf
|
||||
|
||||
CLEANFILES+= mkinit mkinit.o mknodes mknodes.o \
|
||||
CLEANFILES+= mknodes mknodes.o \
|
||||
mksyntax mksyntax.o
|
||||
CLEANFILES+= ${GENSRCS} ${GENHDRS}
|
||||
|
||||
build-tools: mkinit mknodes mksyntax
|
||||
build-tools: mknodes mksyntax
|
||||
|
||||
.ORDER: builtins.c builtins.h
|
||||
builtins.c builtins.h: mkbuiltins builtins.def
|
||||
sh ${.CURDIR}/mkbuiltins ${.CURDIR}
|
||||
|
||||
init.c: mkinit alias.c eval.c exec.c input.c jobs.c options.c parser.c \
|
||||
redir.c trap.c var.c
|
||||
./mkinit ${.ALLSRC:S/^mkinit$//}
|
||||
|
||||
# XXX this is just to stop the default .c rule being used, so that the
|
||||
# intermediate object has a fixed name.
|
||||
# XXX we have a default .c rule, but no default .o rule.
|
||||
.o:
|
||||
${CC} ${CFLAGS} ${LDFLAGS} ${.IMPSRC} ${LDLIBS} -o ${.TARGET}
|
||||
mkinit: mkinit.o
|
||||
mknodes: mknodes.o
|
||||
mksyntax: mksyntax.o
|
||||
|
||||
|
||||
+1
-28
@@ -25,38 +25,11 @@ programs is:
|
||||
program input files generates
|
||||
------- ----------- ---------
|
||||
mkbuiltins builtins builtins.h builtins.c
|
||||
mkinit *.c init.c
|
||||
mknodes nodetypes nodes.h nodes.c
|
||||
mksyntax - syntax.h syntax.c
|
||||
mktokens - token.h
|
||||
|
||||
There are undoubtedly too many of these. Mkinit searches all the
|
||||
C source files for entries looking like:
|
||||
|
||||
RESET {
|
||||
x = 2; /* executed when the shell does a longjmp
|
||||
back to the main command loop */
|
||||
}
|
||||
|
||||
It pulls this code out into routines which are when particular
|
||||
events occur. The intent is to improve modularity by isolating
|
||||
the information about which modules need to be explicitly
|
||||
initialized/reset within the modules themselves.
|
||||
|
||||
Mkinit recognizes several constructs for placing declarations in
|
||||
the init.c file.
|
||||
INCLUDE "file.h"
|
||||
includes a file. The storage class MKINIT makes a declaration
|
||||
available in the init.c file, for example:
|
||||
MKINIT int funcnest; /* depth of function calls */
|
||||
MKINIT alone on a line introduces a structure or union declara-
|
||||
tion:
|
||||
MKINIT
|
||||
struct redirtab {
|
||||
short renamed[10];
|
||||
};
|
||||
Preprocessor #define statements are copied to init.c without any
|
||||
special action to request this.
|
||||
There are undoubtedly too many of these.
|
||||
|
||||
EXCEPTIONS: Code for dealing with exceptions appears in
|
||||
exceptions.c. The C language doesn't include exception handling,
|
||||
|
||||
+5
-3
@@ -237,17 +237,19 @@ printaliases(void)
|
||||
}
|
||||
|
||||
int
|
||||
aliascmd(int argc, char **argv)
|
||||
aliascmd(int argc __unused, char **argv __unused)
|
||||
{
|
||||
char *n, *v;
|
||||
int ret = 0;
|
||||
struct alias *ap;
|
||||
|
||||
if (argc == 1) {
|
||||
nextopt("");
|
||||
|
||||
if (*argptr == NULL) {
|
||||
printaliases();
|
||||
return (0);
|
||||
}
|
||||
while ((n = *++argv) != NULL) {
|
||||
while ((n = *argptr++) != NULL) {
|
||||
if ((v = strchr(n+1, '=')) == NULL) /* n+1: funny ksh stuff */
|
||||
if ((ap = lookupalias(n, 0)) == NULL) {
|
||||
warning("%s: not found", n);
|
||||
|
||||
@@ -218,9 +218,13 @@ yylex(void)
|
||||
value += ARITH_REM - '%';
|
||||
goto checkeq;
|
||||
case '+':
|
||||
if (buf[1] == '+')
|
||||
return ARITH_BAD;
|
||||
value += ARITH_ADD - '+';
|
||||
goto checkeq;
|
||||
case '-':
|
||||
if (buf[1] == '-')
|
||||
return ARITH_BAD;
|
||||
value += ARITH_SUB - '-';
|
||||
goto checkeq;
|
||||
case '~':
|
||||
|
||||
+10
-19
@@ -76,7 +76,7 @@ __FBSDID("$FreeBSD$");
|
||||
|
||||
int evalskip; /* set if we are skipping commands */
|
||||
int skipcount; /* number of levels to skip */
|
||||
MKINIT int loopnest; /* current loop nesting level */
|
||||
static int loopnest; /* current loop nesting level */
|
||||
int funcnest; /* depth of function calls */
|
||||
static int builtin_flags; /* evalcommand flags for builtins */
|
||||
|
||||
@@ -104,16 +104,12 @@ static void prehash(union node *);
|
||||
* Called to reset things after an exception.
|
||||
*/
|
||||
|
||||
#ifdef mkinit
|
||||
INCLUDE "eval.h"
|
||||
|
||||
RESET {
|
||||
void
|
||||
reseteval(void)
|
||||
{
|
||||
evalskip = 0;
|
||||
loopnest = 0;
|
||||
funcnest = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/*
|
||||
@@ -328,7 +324,7 @@ skipping: if (evalskip == SKIPCONT && --skipcount <= 0) {
|
||||
}
|
||||
if (evalskip == SKIPBREAK && --skipcount <= 0)
|
||||
evalskip = 0;
|
||||
if (evalskip == SKIPFUNC || evalskip == SKIPFILE)
|
||||
if (evalskip == SKIPRETURN)
|
||||
status = exitstatus;
|
||||
break;
|
||||
}
|
||||
@@ -589,7 +585,8 @@ evalpipe(union node *n)
|
||||
pip[1] = -1;
|
||||
if (lp->next) {
|
||||
if (pipe(pip) < 0) {
|
||||
close(prevfd);
|
||||
if (prevfd >= 0)
|
||||
close(prevfd);
|
||||
error("Pipe call failed: %s", strerror(errno));
|
||||
}
|
||||
}
|
||||
@@ -1071,7 +1068,7 @@ evalcommand(union node *cmd, int flags, struct backcmd *backcmd)
|
||||
funcnest--;
|
||||
popredir();
|
||||
INTON;
|
||||
if (evalskip == SKIPFUNC) {
|
||||
if (evalskip == SKIPRETURN) {
|
||||
evalskip = 0;
|
||||
skipcount = 0;
|
||||
}
|
||||
@@ -1308,14 +1305,8 @@ returncmd(int argc, char **argv)
|
||||
{
|
||||
int ret = argc > 1 ? number(argv[1]) : oexitstatus;
|
||||
|
||||
if (funcnest) {
|
||||
evalskip = SKIPFUNC;
|
||||
skipcount = 1;
|
||||
} else {
|
||||
/* skip the rest of the file */
|
||||
evalskip = SKIPFILE;
|
||||
skipcount = 1;
|
||||
}
|
||||
evalskip = SKIPRETURN;
|
||||
skipcount = 1;
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
+3
-2
@@ -46,6 +46,8 @@ struct backcmd { /* result of evalbackcmd */
|
||||
struct job *jp; /* job structure for command */
|
||||
};
|
||||
|
||||
void reseteval(void);
|
||||
|
||||
/* flags in argument to evaltree/evalstring */
|
||||
#define EV_EXIT 01 /* exit after evaluating tree */
|
||||
#define EV_TESTED 02 /* exit status is checked; ignore -e flag */
|
||||
@@ -65,5 +67,4 @@ extern int skipcount;
|
||||
/* reasons for skipping commands (see comment on breakcmd routine) */
|
||||
#define SKIPBREAK 1
|
||||
#define SKIPCONT 2
|
||||
#define SKIPFUNC 3
|
||||
#define SKIPFILE 4
|
||||
#define SKIPRETURN 3
|
||||
|
||||
+2
-1
@@ -70,7 +70,6 @@ __FBSDID("$FreeBSD$");
|
||||
#include "syntax.h"
|
||||
#include "memalloc.h"
|
||||
#include "error.h"
|
||||
#include "init.h"
|
||||
#include "mystring.h"
|
||||
#include "show.h"
|
||||
#include "jobs.h"
|
||||
@@ -763,5 +762,7 @@ typecmd_impl(int argc, char **argv, int cmd, const char *path)
|
||||
int
|
||||
typecmd(int argc, char **argv)
|
||||
{
|
||||
if (argc > 2 && strcmp(argv[1], "--") == 0)
|
||||
argc--, argv++;
|
||||
return typecmd_impl(argc, argv, TYPECMD_TYPE, bltinlookup("PATH", 1));
|
||||
}
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
/*-
|
||||
* Copyright (c) 1991, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to Berkeley by
|
||||
* Kenneth Almquist.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)init.h 8.2 (Berkeley) 5/4/95
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
void reset(void);
|
||||
+8
-12
@@ -92,7 +92,7 @@ struct parsefile {
|
||||
|
||||
int plinno = 1; /* input line number */
|
||||
int parsenleft; /* copy of parsefile->nleft */
|
||||
MKINIT int parselleft; /* copy of parsefile->lleft */
|
||||
static int parselleft; /* copy of parsefile->lleft */
|
||||
const char *parsenextc; /* copy of parsefile->nextc */
|
||||
static char basebuf[BUFSIZ + 1];/* buffer for top level input file */
|
||||
static struct parsefile basepf = { /* top level input file */
|
||||
@@ -108,15 +108,12 @@ static void pushfile(void);
|
||||
static int preadfd(void);
|
||||
static void popstring(void);
|
||||
|
||||
#ifdef mkinit
|
||||
INCLUDE "input.h"
|
||||
INCLUDE "error.h"
|
||||
|
||||
RESET {
|
||||
void
|
||||
resetinput(void)
|
||||
{
|
||||
popallfiles();
|
||||
parselleft = parsenleft = 0; /* clear input buffer */
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
@@ -397,10 +394,10 @@ setinputfile(const char *fname, int push)
|
||||
int fd2;
|
||||
|
||||
INTOFF;
|
||||
if ((fd = open(fname, O_RDONLY)) < 0)
|
||||
if ((fd = open(fname, O_RDONLY | O_CLOEXEC)) < 0)
|
||||
error("cannot open %s: %s", fname, strerror(errno));
|
||||
if (fd < 10) {
|
||||
fd2 = fcntl(fd, F_DUPFD, 10);
|
||||
fd2 = fcntl(fd, F_DUPFD_CLOEXEC, 10);
|
||||
close(fd);
|
||||
if (fd2 < 0)
|
||||
error("Out of file descriptors");
|
||||
@@ -412,14 +409,13 @@ setinputfile(const char *fname, int push)
|
||||
|
||||
|
||||
/*
|
||||
* Like setinputfile, but takes an open file descriptor. Call this with
|
||||
* interrupts off.
|
||||
* Like setinputfile, but takes an open file descriptor (which should have
|
||||
* its FD_CLOEXEC flag already set). Call this with interrupts off.
|
||||
*/
|
||||
|
||||
void
|
||||
setinputfd(int fd, int push)
|
||||
{
|
||||
(void)fcntl(fd, F_SETFD, FD_CLOEXEC);
|
||||
if (push) {
|
||||
pushfile();
|
||||
parsefile->buf = ckmalloc(BUFSIZ + 1);
|
||||
|
||||
@@ -47,6 +47,7 @@ extern const char *parsenextc; /* next character in input buffer */
|
||||
struct alias;
|
||||
struct parsefile;
|
||||
|
||||
void resetinput(void);
|
||||
char *pfgets(char *, int);
|
||||
int pgetc(void);
|
||||
int preadbuffer(void);
|
||||
|
||||
+76
-55
@@ -77,24 +77,25 @@ __FBSDID("$FreeBSD$");
|
||||
|
||||
static struct job *jobtab; /* array of jobs */
|
||||
static int njobs; /* size of array */
|
||||
MKINIT pid_t backgndpid = -1; /* pid of last background process */
|
||||
MKINIT struct job *bgjob = NULL; /* last background process */
|
||||
static pid_t backgndpid = -1; /* pid of last background process */
|
||||
static struct job *bgjob = NULL; /* last background process */
|
||||
#if JOBS
|
||||
static struct job *jobmru; /* most recently used job list */
|
||||
static pid_t initialpgrp; /* pgrp of shell on invocation */
|
||||
#endif
|
||||
int in_waitcmd = 0; /* are we in waitcmd()? */
|
||||
volatile sig_atomic_t breakwaitcmd = 0; /* should wait be terminated? */
|
||||
static int ttyfd = -1;
|
||||
|
||||
/* mode flags for dowait */
|
||||
#define DOWAIT_BLOCK 0x1 /* wait until a child exits */
|
||||
#define DOWAIT_SIG 0x2 /* if DOWAIT_BLOCK, abort on signals */
|
||||
#define DOWAIT_SIG 0x2 /* if DOWAIT_BLOCK, abort on SIGINT/SIGQUIT */
|
||||
#define DOWAIT_SIG_ANY 0x4 /* if DOWAIT_SIG, abort on any signal */
|
||||
|
||||
#if JOBS
|
||||
static void restartjob(struct job *);
|
||||
#endif
|
||||
static void freejob(struct job *);
|
||||
static int waitcmdloop(struct job *);
|
||||
static struct job *getjob_nonotfound(char *);
|
||||
static struct job *getjob(char *);
|
||||
pid_t getjobpgrp(char *);
|
||||
static pid_t dowait(int, struct job *);
|
||||
@@ -114,7 +115,7 @@ static void showjob(struct job *, int);
|
||||
* Turn job control on and off.
|
||||
*/
|
||||
|
||||
MKINIT int jobctl;
|
||||
static int jobctl;
|
||||
|
||||
#if JOBS
|
||||
void
|
||||
@@ -127,11 +128,12 @@ setjobctl(int on)
|
||||
if (on) {
|
||||
if (ttyfd != -1)
|
||||
close(ttyfd);
|
||||
if ((ttyfd = open(_PATH_TTY, O_RDWR)) < 0) {
|
||||
if ((ttyfd = open(_PATH_TTY, O_RDWR | O_CLOEXEC)) < 0) {
|
||||
i = 0;
|
||||
while (i <= 2 && !isatty(i))
|
||||
i++;
|
||||
if (i > 2 || (ttyfd = fcntl(i, F_DUPFD, 10)) < 0)
|
||||
if (i > 2 ||
|
||||
(ttyfd = fcntl(i, F_DUPFD_CLOEXEC, 10)) < 0)
|
||||
goto out;
|
||||
}
|
||||
if (ttyfd < 10) {
|
||||
@@ -139,7 +141,7 @@ setjobctl(int on)
|
||||
* Keep our TTY file descriptor out of the way of
|
||||
* the user's redirections.
|
||||
*/
|
||||
if ((i = fcntl(ttyfd, F_DUPFD, 10)) < 0) {
|
||||
if ((i = fcntl(ttyfd, F_DUPFD_CLOEXEC, 10)) < 0) {
|
||||
close(ttyfd);
|
||||
ttyfd = -1;
|
||||
goto out;
|
||||
@@ -147,11 +149,6 @@ setjobctl(int on)
|
||||
close(ttyfd);
|
||||
ttyfd = i;
|
||||
}
|
||||
if (fcntl(ttyfd, F_SETFD, FD_CLOEXEC) < 0) {
|
||||
close(ttyfd);
|
||||
ttyfd = -1;
|
||||
goto out;
|
||||
}
|
||||
do { /* while we are in the background */
|
||||
initialpgrp = tcgetpgrp(ttyfd);
|
||||
if (initialpgrp < 0) {
|
||||
@@ -185,13 +182,14 @@ out: out2fmt_flush("sh: can't access tty; job control turned off\n");
|
||||
|
||||
#if JOBS
|
||||
int
|
||||
fgcmd(int argc __unused, char **argv)
|
||||
fgcmd(int argc __unused, char **argv __unused)
|
||||
{
|
||||
struct job *jp;
|
||||
pid_t pgrp;
|
||||
int status;
|
||||
|
||||
jp = getjob(argv[1]);
|
||||
nextopt("");
|
||||
jp = getjob(*argptr);
|
||||
if (jp->jobctl == 0)
|
||||
error("job not created under job control");
|
||||
printjobcmd(jp);
|
||||
@@ -212,8 +210,9 @@ bgcmd(int argc, char **argv)
|
||||
{
|
||||
struct job *jp;
|
||||
|
||||
nextopt("");
|
||||
do {
|
||||
jp = getjob(*++argv);
|
||||
jp = getjob(*argptr);
|
||||
if (jp->jobctl == 0)
|
||||
error("job not created under job control");
|
||||
if (jp->state == JOBDONE)
|
||||
@@ -222,7 +221,7 @@ bgcmd(int argc, char **argv)
|
||||
jp->foreground = 0;
|
||||
out1fmt("[%td] ", jp - jobtab + 1);
|
||||
printjobcmd(jp);
|
||||
} while (--argc > 1);
|
||||
} while (*argptr != NULL && *++argptr != NULL);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -417,13 +416,15 @@ showjobs(int change, int mode)
|
||||
if (change && ! jp->changed)
|
||||
continue;
|
||||
showjob(jp, mode);
|
||||
jp->changed = 0;
|
||||
/* Hack: discard jobs for which $! has not been referenced
|
||||
* in interactive mode when they terminate.
|
||||
*/
|
||||
if (jp->state == JOBDONE && !jp->remembered &&
|
||||
(iflag || jp != bgjob)) {
|
||||
freejob(jp);
|
||||
if (mode == SHOWJOBS_DEFAULT || mode == SHOWJOBS_VERBOSE) {
|
||||
jp->changed = 0;
|
||||
/* Hack: discard jobs for which $! has not been
|
||||
* referenced in interactive mode when they terminate.
|
||||
*/
|
||||
if (jp->state == JOBDONE && !jp->remembered &&
|
||||
(iflag || jp != bgjob)) {
|
||||
freejob(jp);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -461,32 +462,41 @@ int
|
||||
waitcmd(int argc __unused, char **argv __unused)
|
||||
{
|
||||
struct job *job;
|
||||
int status, retval;
|
||||
struct job *jp;
|
||||
int retval;
|
||||
|
||||
nextopt("");
|
||||
if (*argptr != NULL) {
|
||||
job = getjob(*argptr);
|
||||
} else {
|
||||
job = NULL;
|
||||
}
|
||||
if (*argptr == NULL)
|
||||
return (waitcmdloop(NULL));
|
||||
|
||||
do {
|
||||
job = getjob_nonotfound(*argptr);
|
||||
if (job == NULL)
|
||||
retval = 127;
|
||||
else
|
||||
retval = waitcmdloop(job);
|
||||
argptr++;
|
||||
} while (*argptr != NULL);
|
||||
|
||||
return (retval);
|
||||
}
|
||||
|
||||
static int
|
||||
waitcmdloop(struct job *job)
|
||||
{
|
||||
int status, retval, sig;
|
||||
struct job *jp;
|
||||
|
||||
/*
|
||||
* Loop until a process is terminated or stopped, or a SIGINT is
|
||||
* received.
|
||||
*/
|
||||
|
||||
in_waitcmd++;
|
||||
do {
|
||||
if (job != NULL) {
|
||||
if (job->state) {
|
||||
if (job->state == JOBDONE) {
|
||||
status = job->ps[job->nprocs - 1].status;
|
||||
if (WIFEXITED(status))
|
||||
retval = WEXITSTATUS(status);
|
||||
#if JOBS
|
||||
else if (WIFSTOPPED(status))
|
||||
retval = WSTOPSIG(status) + 128;
|
||||
#endif
|
||||
else
|
||||
retval = WTERMSIG(status) + 128;
|
||||
if (! iflag || ! job->changed)
|
||||
@@ -496,7 +506,6 @@ waitcmd(int argc __unused, char **argv __unused)
|
||||
if (job == bgjob)
|
||||
bgjob = NULL;
|
||||
}
|
||||
in_waitcmd--;
|
||||
return retval;
|
||||
}
|
||||
} else {
|
||||
@@ -512,7 +521,6 @@ waitcmd(int argc __unused, char **argv __unused)
|
||||
}
|
||||
for (jp = jobtab ; ; jp++) {
|
||||
if (jp >= jobtab + njobs) { /* no running procs */
|
||||
in_waitcmd--;
|
||||
return 0;
|
||||
}
|
||||
if (jp->used && jp->state == 0)
|
||||
@@ -520,20 +528,22 @@ waitcmd(int argc __unused, char **argv __unused)
|
||||
}
|
||||
}
|
||||
} while (dowait(DOWAIT_BLOCK | DOWAIT_SIG, (struct job *)NULL) != -1);
|
||||
in_waitcmd--;
|
||||
|
||||
return pendingsig + 128;
|
||||
sig = pendingsig_waitcmd;
|
||||
pendingsig_waitcmd = 0;
|
||||
return sig + 128;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int
|
||||
jobidcmd(int argc __unused, char **argv)
|
||||
jobidcmd(int argc __unused, char **argv __unused)
|
||||
{
|
||||
struct job *jp;
|
||||
int i;
|
||||
|
||||
jp = getjob(argv[1]);
|
||||
nextopt("");
|
||||
jp = getjob(*argptr);
|
||||
for (i = 0 ; i < jp->nprocs ; ) {
|
||||
out1fmt("%d", (int)jp->ps[i].pid);
|
||||
out1c(++i < jp->nprocs? ' ' : '\n');
|
||||
@@ -548,7 +558,7 @@ jobidcmd(int argc __unused, char **argv)
|
||||
*/
|
||||
|
||||
static struct job *
|
||||
getjob(char *name)
|
||||
getjob_nonotfound(char *name)
|
||||
{
|
||||
int jobno;
|
||||
struct job *found, *jp;
|
||||
@@ -613,12 +623,22 @@ currentjob: if ((jp = getcurjob(NULL)) == NULL)
|
||||
return jp;
|
||||
}
|
||||
}
|
||||
error("No such job: %s", name);
|
||||
/*NOTREACHED*/
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
static struct job *
|
||||
getjob(char *name)
|
||||
{
|
||||
struct job *jp;
|
||||
|
||||
jp = getjob_nonotfound(name);
|
||||
if (jp == NULL)
|
||||
error("No such job: %s", name);
|
||||
return (jp);
|
||||
}
|
||||
|
||||
|
||||
pid_t
|
||||
getjobpgrp(char *name)
|
||||
{
|
||||
@@ -967,7 +987,8 @@ waitforjob(struct job *jp, int *origstatus)
|
||||
INTOFF;
|
||||
TRACE(("waitforjob(%%%td) called\n", jp - jobtab + 1));
|
||||
while (jp->state == 0)
|
||||
if (dowait(DOWAIT_BLOCK | (Tflag ? DOWAIT_SIG : 0), jp) == -1)
|
||||
if (dowait(DOWAIT_BLOCK | (Tflag ? DOWAIT_SIG |
|
||||
DOWAIT_SIG_ANY : 0), jp) == -1)
|
||||
dotrap();
|
||||
#if JOBS
|
||||
if (jp->jobctl) {
|
||||
@@ -1058,12 +1079,17 @@ dowait(int mode, struct job *job)
|
||||
pid = wait3(&status, wflags, (struct rusage *)NULL);
|
||||
TRACE(("wait returns %d, status=%d\n", (int)pid, status));
|
||||
if (pid == 0 && (mode & DOWAIT_SIG) != 0) {
|
||||
sigsuspend(&omask);
|
||||
pid = -1;
|
||||
if (((mode & DOWAIT_SIG_ANY) != 0 ?
|
||||
pendingsig : pendingsig_waitcmd) != 0) {
|
||||
errno = EINTR;
|
||||
break;
|
||||
}
|
||||
sigsuspend(&omask);
|
||||
if (int_pending())
|
||||
break;
|
||||
}
|
||||
} while (pid == -1 && errno == EINTR && breakwaitcmd == 0);
|
||||
} while (pid == -1 && errno == EINTR);
|
||||
if (pid == -1 && errno == ECHILD && job != NULL)
|
||||
job->state = JOBDONE;
|
||||
if ((mode & DOWAIT_SIG) != 0) {
|
||||
@@ -1072,11 +1098,6 @@ dowait(int mode, struct job *job)
|
||||
sigprocmask(SIG_SETMASK, &omask, NULL);
|
||||
INTON;
|
||||
}
|
||||
if (breakwaitcmd != 0) {
|
||||
breakwaitcmd = 0;
|
||||
if (pid <= 0)
|
||||
return -1;
|
||||
}
|
||||
if (pid <= 0)
|
||||
return pid;
|
||||
INTOFF;
|
||||
|
||||
@@ -83,8 +83,6 @@ enum {
|
||||
};
|
||||
|
||||
extern int job_warning; /* user was warned about stopped jobs */
|
||||
extern int in_waitcmd; /* are we in waitcmd()? */
|
||||
extern volatile sig_atomic_t breakwaitcmd; /* break wait to process traps? */
|
||||
|
||||
void setjobctl(int);
|
||||
void showjobs(int, int);
|
||||
|
||||
+11
-4
@@ -68,10 +68,10 @@ __FBSDID("$FreeBSD$");
|
||||
#include "show.h"
|
||||
#include "memalloc.h"
|
||||
#include "error.h"
|
||||
#include "init.h"
|
||||
#include "mystring.h"
|
||||
#include "exec.h"
|
||||
#include "cd.h"
|
||||
#include "redir.h"
|
||||
#include "builtins.h"
|
||||
|
||||
int rootpid;
|
||||
@@ -79,6 +79,7 @@ int rootshell;
|
||||
struct jmploc main_handler;
|
||||
int localeisutf8, initial_localeisutf8;
|
||||
|
||||
static void reset(void);
|
||||
static void cmdloop(int);
|
||||
static void read_profile(const char *);
|
||||
static char *find_dot_file(char *);
|
||||
@@ -170,8 +171,8 @@ main(int argc, char *argv[])
|
||||
if (minusc) {
|
||||
evalstring(minusc, sflag ? 0 : EV_EXIT);
|
||||
}
|
||||
state4:
|
||||
if (sflag || minusc == NULL) {
|
||||
state4: /* XXX ??? - why isn't this before the "if" statement */
|
||||
cmdloop(1);
|
||||
}
|
||||
exitshell(exitstatus);
|
||||
@@ -179,6 +180,12 @@ main(int argc, char *argv[])
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
reset(void)
|
||||
{
|
||||
reseteval();
|
||||
resetinput();
|
||||
}
|
||||
|
||||
/*
|
||||
* Read and execute commands. "Top" is nonzero for the top level command
|
||||
@@ -224,7 +231,7 @@ cmdloop(int top)
|
||||
popstackmark(&smark);
|
||||
setstackmark(&smark);
|
||||
if (evalskip != 0) {
|
||||
if (evalskip == SKIPFILE)
|
||||
if (evalskip == SKIPRETURN)
|
||||
evalskip = 0;
|
||||
break;
|
||||
}
|
||||
@@ -248,7 +255,7 @@ read_profile(const char *name)
|
||||
if (expandedname == NULL)
|
||||
return;
|
||||
INTOFF;
|
||||
if ((fd = open(expandedname, O_RDONLY)) >= 0)
|
||||
if ((fd = open(expandedname, O_RDONLY | O_CLOEXEC)) >= 0)
|
||||
setinputfd(fd, 1);
|
||||
INTON;
|
||||
if (fd < 0)
|
||||
|
||||
+3
-17
@@ -124,7 +124,6 @@ struct stack_block {
|
||||
#define SPACE(sp) ((char*)(sp) + ALIGN(sizeof(struct stack_block)))
|
||||
|
||||
static struct stack_block *stackp;
|
||||
static struct stackmark *markp;
|
||||
char *stacknxt;
|
||||
int stacknleft;
|
||||
char *sstrend;
|
||||
@@ -186,8 +185,9 @@ setstackmark(struct stackmark *mark)
|
||||
mark->stackp = stackp;
|
||||
mark->stacknxt = stacknxt;
|
||||
mark->stacknleft = stacknleft;
|
||||
mark->marknext = markp;
|
||||
markp = mark;
|
||||
/* Ensure this block stays in place. */
|
||||
if (stackp != NULL && stacknxt == SPACE(stackp))
|
||||
stalloc(1);
|
||||
}
|
||||
|
||||
|
||||
@@ -197,7 +197,6 @@ popstackmark(struct stackmark *mark)
|
||||
struct stack_block *sp;
|
||||
|
||||
INTOFF;
|
||||
markp = mark->marknext;
|
||||
while (stackp != mark->stackp) {
|
||||
sp = stackp;
|
||||
stackp = sp->prev;
|
||||
@@ -229,7 +228,6 @@ growstackblock(int min)
|
||||
int oldlen;
|
||||
struct stack_block *sp;
|
||||
struct stack_block *oldstackp;
|
||||
struct stackmark *xmark;
|
||||
|
||||
if (min < stacknleft)
|
||||
min = stacknleft;
|
||||
@@ -254,18 +252,6 @@ growstackblock(int min)
|
||||
stacknxt = SPACE(sp);
|
||||
stacknleft = newlen - (stacknxt - (char*)sp);
|
||||
sstrend = stacknxt + stacknleft;
|
||||
|
||||
/*
|
||||
* Stack marks pointing to the start of the old block
|
||||
* must be relocated to point to the new block
|
||||
*/
|
||||
xmark = markp;
|
||||
while (xmark != NULL && xmark->stackp == oldstackp) {
|
||||
xmark->stackp = stackp;
|
||||
xmark->stacknxt = stacknxt;
|
||||
xmark->stacknleft = stacknleft;
|
||||
xmark = xmark->marknext;
|
||||
}
|
||||
INTON;
|
||||
} else {
|
||||
newlen -= ALIGN(sizeof(struct stack_block));
|
||||
|
||||
@@ -39,7 +39,6 @@ struct stackmark {
|
||||
struct stack_block *stackp;
|
||||
char *stacknxt;
|
||||
int stacknleft;
|
||||
struct stackmark *marknext;
|
||||
};
|
||||
|
||||
|
||||
|
||||
+20
-3
@@ -60,6 +60,7 @@ __FBSDID("$FreeBSD$");
|
||||
#include "error.h"
|
||||
#include "mystring.h"
|
||||
#include "syntax.h"
|
||||
#include "trap.h"
|
||||
|
||||
#undef eflag
|
||||
|
||||
@@ -102,6 +103,8 @@ readcmd(int argc __unused, char **argv __unused)
|
||||
struct timeval tv;
|
||||
char *tvptr;
|
||||
fd_set ifds;
|
||||
ssize_t nread;
|
||||
int sig;
|
||||
|
||||
rflag = 0;
|
||||
prompt = NULL;
|
||||
@@ -156,8 +159,10 @@ readcmd(int argc __unused, char **argv __unused)
|
||||
/*
|
||||
* If there's nothing ready, return an error.
|
||||
*/
|
||||
if (status <= 0)
|
||||
return(1);
|
||||
if (status <= 0) {
|
||||
sig = pendingsig;
|
||||
return (128 + (sig != 0 ? sig : SIGALRM));
|
||||
}
|
||||
}
|
||||
|
||||
status = 0;
|
||||
@@ -165,7 +170,19 @@ readcmd(int argc __unused, char **argv __unused)
|
||||
backslash = 0;
|
||||
STARTSTACKSTR(p);
|
||||
for (;;) {
|
||||
if (read(STDIN_FILENO, &c, 1) != 1) {
|
||||
nread = read(STDIN_FILENO, &c, 1);
|
||||
if (nread == -1) {
|
||||
if (errno == EINTR) {
|
||||
sig = pendingsig;
|
||||
if (sig == 0)
|
||||
continue;
|
||||
status = 128 + sig;
|
||||
break;
|
||||
}
|
||||
warning("read error: %s", strerror(errno));
|
||||
status = 2;
|
||||
break;
|
||||
} else if (nread != 1) {
|
||||
status = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
-480
@@ -1,480 +0,0 @@
|
||||
/*-
|
||||
* Copyright (c) 1991, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to Berkeley by
|
||||
* Kenneth Almquist.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char const copyright[] =
|
||||
"@(#) Copyright (c) 1991, 1993\n\
|
||||
The Regents of the University of California. All rights reserved.\n";
|
||||
#endif /* not lint */
|
||||
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)mkinit.c 8.2 (Berkeley) 5/4/95";
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
/*
|
||||
* This program scans all the source files for code to handle various
|
||||
* special events and combines this code into one file. This (allegedly)
|
||||
* improves the structure of the program since there is no need for
|
||||
* anyone outside of a module to know that that module performs special
|
||||
* operations on particular events.
|
||||
*
|
||||
* Usage: mkinit sourcefile...
|
||||
*/
|
||||
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
|
||||
|
||||
/*
|
||||
* OUTFILE is the name of the output file. Output is initially written
|
||||
* to the file OUTTEMP, which is then moved to OUTFILE.
|
||||
*/
|
||||
|
||||
#define OUTFILE "init.c"
|
||||
#define OUTTEMP "init.c.new"
|
||||
|
||||
|
||||
/*
|
||||
* A text structure is basically just a string that grows as more characters
|
||||
* are added onto the end of it. It is implemented as a linked list of
|
||||
* blocks of characters. The routines addstr and addchar append a string
|
||||
* or a single character, respectively, to a text structure. Writetext
|
||||
* writes the contents of a text structure to a file.
|
||||
*/
|
||||
|
||||
#define BLOCKSIZE 512
|
||||
|
||||
struct text {
|
||||
char *nextc;
|
||||
int nleft;
|
||||
struct block *start;
|
||||
struct block *last;
|
||||
};
|
||||
|
||||
struct block {
|
||||
struct block *next;
|
||||
char text[BLOCKSIZE];
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* There is one event structure for each event that mkinit handles.
|
||||
*/
|
||||
|
||||
struct event {
|
||||
const char *name; /* name of event (e.g. RESET) */
|
||||
const char *routine; /* name of routine called on event */
|
||||
const char *comment; /* comment describing routine */
|
||||
struct text code; /* code for handling event */
|
||||
};
|
||||
|
||||
|
||||
char writer[] = "\
|
||||
/*\n\
|
||||
* This file was generated by the mkinit program.\n\
|
||||
*/\n\
|
||||
\n";
|
||||
|
||||
char reset[] = "\
|
||||
/*\n\
|
||||
* This routine is called when an error or an interrupt occurs in an\n\
|
||||
* interactive shell and control is returned to the main command loop.\n\
|
||||
*/\n";
|
||||
|
||||
|
||||
struct event event[] = {
|
||||
{ "RESET", "reset", reset, { NULL, 0, NULL, NULL } },
|
||||
{ NULL, NULL, NULL, { NULL, 0, NULL, NULL } }
|
||||
};
|
||||
|
||||
|
||||
const char *curfile; /* current file */
|
||||
int linno; /* current line */
|
||||
char *header_files[200]; /* list of header files */
|
||||
struct text defines; /* #define statements */
|
||||
struct text decls; /* declarations */
|
||||
int amiddecls; /* for formatting */
|
||||
|
||||
|
||||
void readfile(const char *);
|
||||
int match(const char *, const char *);
|
||||
int gooddefine(const char *);
|
||||
void doevent(struct event *, FILE *, const char *);
|
||||
void doinclude(char *);
|
||||
void dodecl(char *, FILE *);
|
||||
void output(void);
|
||||
void addstr(const char *, struct text *);
|
||||
void addchar(int, struct text *);
|
||||
void writetext(struct text *, FILE *);
|
||||
FILE *ckfopen(const char *, const char *);
|
||||
void *ckmalloc(size_t);
|
||||
char *savestr(const char *);
|
||||
void error(const char *);
|
||||
|
||||
#define equal(s1, s2) (strcmp(s1, s2) == 0)
|
||||
|
||||
int
|
||||
main(int argc __unused, char *argv[])
|
||||
{
|
||||
char **ap;
|
||||
|
||||
header_files[0] = savestr("\"shell.h\"");
|
||||
header_files[1] = savestr("\"mystring.h\"");
|
||||
header_files[2] = savestr("\"init.h\"");
|
||||
for (ap = argv + 1 ; *ap ; ap++)
|
||||
readfile(*ap);
|
||||
output();
|
||||
rename(OUTTEMP, OUTFILE);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Parse an input file.
|
||||
*/
|
||||
|
||||
void
|
||||
readfile(const char *fname)
|
||||
{
|
||||
FILE *fp;
|
||||
char line[1024];
|
||||
struct event *ep;
|
||||
|
||||
fp = ckfopen(fname, "r");
|
||||
curfile = fname;
|
||||
linno = 0;
|
||||
amiddecls = 0;
|
||||
while (fgets(line, sizeof line, fp) != NULL) {
|
||||
linno++;
|
||||
for (ep = event ; ep->name ; ep++) {
|
||||
if (line[0] == ep->name[0] && match(ep->name, line)) {
|
||||
doevent(ep, fp, fname);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (line[0] == 'I' && match("INCLUDE", line))
|
||||
doinclude(line);
|
||||
if (line[0] == 'M' && match("MKINIT", line))
|
||||
dodecl(line, fp);
|
||||
if (line[0] == '#' && gooddefine(line)) {
|
||||
char *cp;
|
||||
char line2[1024];
|
||||
static const char undef[] = "#undef ";
|
||||
|
||||
strcpy(line2, line);
|
||||
memcpy(line2, undef, sizeof(undef) - 1);
|
||||
cp = line2 + sizeof(undef) - 1;
|
||||
while(*cp && (*cp == ' ' || *cp == '\t'))
|
||||
cp++;
|
||||
while(*cp && *cp != ' ' && *cp != '\t' && *cp != '\n')
|
||||
cp++;
|
||||
*cp++ = '\n'; *cp = '\0';
|
||||
addstr(line2, &defines);
|
||||
addstr(line, &defines);
|
||||
}
|
||||
}
|
||||
fclose(fp);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
match(const char *name, const char *line)
|
||||
{
|
||||
const char *p, *q;
|
||||
|
||||
p = name, q = line;
|
||||
while (*p) {
|
||||
if (*p++ != *q++)
|
||||
return 0;
|
||||
}
|
||||
if (*q != '{' && *q != ' ' && *q != '\t' && *q != '\n')
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
gooddefine(const char *line)
|
||||
{
|
||||
const char *p;
|
||||
|
||||
if (! match("#define", line))
|
||||
return 0; /* not a define */
|
||||
p = line + 7;
|
||||
while (*p == ' ' || *p == '\t')
|
||||
p++;
|
||||
while (*p != ' ' && *p != '\t') {
|
||||
if (*p == '(')
|
||||
return 0; /* macro definition */
|
||||
p++;
|
||||
}
|
||||
while (*p != '\n' && *p != '\0')
|
||||
p++;
|
||||
if (p[-1] == '\\')
|
||||
return 0; /* multi-line definition */
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
doevent(struct event *ep, FILE *fp, const char *fname)
|
||||
{
|
||||
char line[1024];
|
||||
int indent;
|
||||
const char *p;
|
||||
|
||||
sprintf(line, "\n /* from %s: */\n", fname);
|
||||
addstr(line, &ep->code);
|
||||
addstr(" {\n", &ep->code);
|
||||
for (;;) {
|
||||
linno++;
|
||||
if (fgets(line, sizeof line, fp) == NULL)
|
||||
error("Unexpected EOF");
|
||||
if (equal(line, "}\n"))
|
||||
break;
|
||||
indent = 6;
|
||||
for (p = line ; *p == '\t' ; p++)
|
||||
indent += 8;
|
||||
for ( ; *p == ' ' ; p++)
|
||||
indent++;
|
||||
if (*p == '\n' || *p == '#')
|
||||
indent = 0;
|
||||
while (indent >= 8) {
|
||||
addchar('\t', &ep->code);
|
||||
indent -= 8;
|
||||
}
|
||||
while (indent > 0) {
|
||||
addchar(' ', &ep->code);
|
||||
indent--;
|
||||
}
|
||||
addstr(p, &ep->code);
|
||||
}
|
||||
addstr(" }\n", &ep->code);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
doinclude(char *line)
|
||||
{
|
||||
char *p;
|
||||
char *name;
|
||||
char **pp;
|
||||
|
||||
for (p = line ; *p != '"' && *p != '<' && *p != '\0' ; p++);
|
||||
if (*p == '\0')
|
||||
error("Expecting '\"' or '<'");
|
||||
name = p;
|
||||
while (*p != ' ' && *p != '\t' && *p != '\n')
|
||||
p++;
|
||||
if (p[-1] != '"' && p[-1] != '>')
|
||||
error("Missing terminator");
|
||||
*p = '\0';
|
||||
|
||||
/* name now contains the name of the include file */
|
||||
for (pp = header_files ; *pp && ! equal(*pp, name) ; pp++);
|
||||
if (*pp == NULL)
|
||||
*pp = savestr(name);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
dodecl(char *line1, FILE *fp)
|
||||
{
|
||||
char line[1024];
|
||||
char *p, *q;
|
||||
|
||||
if (strcmp(line1, "MKINIT\n") == 0) { /* start of struct/union decl */
|
||||
addchar('\n', &decls);
|
||||
do {
|
||||
linno++;
|
||||
if (fgets(line, sizeof line, fp) == NULL)
|
||||
error("Unterminated structure declaration");
|
||||
addstr(line, &decls);
|
||||
} while (line[0] != '}');
|
||||
amiddecls = 0;
|
||||
} else {
|
||||
if (! amiddecls)
|
||||
addchar('\n', &decls);
|
||||
q = NULL;
|
||||
for (p = line1 + 6 ; *p && strchr("=/\n", *p) == NULL; p++)
|
||||
continue;
|
||||
if (*p == '=') { /* eliminate initialization */
|
||||
for (q = p ; *q && *q != ';' ; q++);
|
||||
if (*q == '\0')
|
||||
q = NULL;
|
||||
else {
|
||||
while (p[-1] == ' ')
|
||||
p--;
|
||||
*p = '\0';
|
||||
}
|
||||
}
|
||||
addstr("extern", &decls);
|
||||
addstr(line1 + 6, &decls);
|
||||
if (q != NULL)
|
||||
addstr(q, &decls);
|
||||
amiddecls = 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Write the output to the file OUTTEMP.
|
||||
*/
|
||||
|
||||
void
|
||||
output(void)
|
||||
{
|
||||
FILE *fp;
|
||||
char **pp;
|
||||
struct event *ep;
|
||||
|
||||
fp = ckfopen(OUTTEMP, "w");
|
||||
fputs(writer, fp);
|
||||
for (pp = header_files ; *pp ; pp++)
|
||||
fprintf(fp, "#include %s\n", *pp);
|
||||
fputs("\n\n\n", fp);
|
||||
writetext(&defines, fp);
|
||||
fputs("\n\n", fp);
|
||||
writetext(&decls, fp);
|
||||
for (ep = event ; ep->name ; ep++) {
|
||||
fputs("\n\n\n", fp);
|
||||
fputs(ep->comment, fp);
|
||||
fprintf(fp, "\nvoid\n%s(void)\n{\n", ep->routine);
|
||||
writetext(&ep->code, fp);
|
||||
fprintf(fp, "}\n");
|
||||
}
|
||||
fclose(fp);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* A text structure is simply a block of text that is kept in memory.
|
||||
* Addstr appends a string to the text struct, and addchar appends a single
|
||||
* character.
|
||||
*/
|
||||
|
||||
void
|
||||
addstr(const char *s, struct text *text)
|
||||
{
|
||||
while (*s) {
|
||||
if (--text->nleft < 0)
|
||||
addchar(*s++, text);
|
||||
else
|
||||
*text->nextc++ = *s++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
addchar(int c, struct text *text)
|
||||
{
|
||||
struct block *bp;
|
||||
|
||||
if (--text->nleft < 0) {
|
||||
bp = ckmalloc(sizeof *bp);
|
||||
if (text->start == NULL)
|
||||
text->start = bp;
|
||||
else
|
||||
text->last->next = bp;
|
||||
text->last = bp;
|
||||
text->nextc = bp->text;
|
||||
text->nleft = BLOCKSIZE - 1;
|
||||
}
|
||||
*text->nextc++ = c;
|
||||
}
|
||||
|
||||
/*
|
||||
* Write the contents of a text structure to a file.
|
||||
*/
|
||||
void
|
||||
writetext(struct text *text, FILE *fp)
|
||||
{
|
||||
struct block *bp;
|
||||
|
||||
if (text->start != NULL) {
|
||||
for (bp = text->start ; bp != text->last ; bp = bp->next)
|
||||
fwrite(bp->text, sizeof (char), BLOCKSIZE, fp);
|
||||
fwrite(bp->text, sizeof (char), BLOCKSIZE - text->nleft, fp);
|
||||
}
|
||||
}
|
||||
|
||||
FILE *
|
||||
ckfopen(const char *file, const char *mode)
|
||||
{
|
||||
FILE *fp;
|
||||
|
||||
if ((fp = fopen(file, mode)) == NULL) {
|
||||
fprintf(stderr, "Can't open %s: %s\n", file, strerror(errno));
|
||||
exit(2);
|
||||
}
|
||||
return fp;
|
||||
}
|
||||
|
||||
void *
|
||||
ckmalloc(size_t nbytes)
|
||||
{
|
||||
char *p;
|
||||
|
||||
if ((p = malloc(nbytes)) == NULL)
|
||||
error("Out of space");
|
||||
return p;
|
||||
}
|
||||
|
||||
char *
|
||||
savestr(const char *s)
|
||||
{
|
||||
char *p;
|
||||
|
||||
p = ckmalloc(strlen(s) + 1);
|
||||
strcpy(p, s);
|
||||
return p;
|
||||
}
|
||||
|
||||
void
|
||||
error(const char *msg)
|
||||
{
|
||||
if (curfile != NULL)
|
||||
fprintf(stderr, "%s:%d: ", curfile, linno);
|
||||
fprintf(stderr, "%s\n", msg);
|
||||
exit(2);
|
||||
}
|
||||
@@ -75,25 +75,6 @@ struct output memout = {NULL, 0, NULL, 0, MEM_OUT, 0};
|
||||
struct output *out1 = &output;
|
||||
struct output *out2 = &errout;
|
||||
|
||||
|
||||
|
||||
#ifdef mkinit
|
||||
|
||||
INCLUDE "output.h"
|
||||
INCLUDE "memalloc.h"
|
||||
|
||||
RESET {
|
||||
out1 = &output;
|
||||
out2 = &errout;
|
||||
if (memout.buf != NULL) {
|
||||
ckfree(memout.buf);
|
||||
memout.buf = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
void
|
||||
outcslow(int c, struct output *file)
|
||||
{
|
||||
|
||||
+79
-110
@@ -96,9 +96,9 @@ static struct heredoc *heredoclist; /* list of here documents to read */
|
||||
static int doprompt; /* if set, prompt the user */
|
||||
static int needprompt; /* true if interactive and at start of line */
|
||||
static int lasttoken; /* last token read */
|
||||
MKINIT int tokpushback; /* last token pushed back */
|
||||
static int tokpushback; /* last token pushed back */
|
||||
static char *wordtext; /* text of last word returned by readtoken */
|
||||
MKINIT int checkkwd; /* 1 == check for kwds, 2 == also eat newlines */
|
||||
static int checkkwd;
|
||||
static struct nodelist *backquotelist;
|
||||
static union node *redirnode;
|
||||
static struct heredoc *heredoc;
|
||||
@@ -108,12 +108,13 @@ static int funclinno; /* line # where the current function started */
|
||||
static struct parser_temp *parser_temp;
|
||||
|
||||
|
||||
static union node *list(int, int);
|
||||
static union node *list(int);
|
||||
static union node *andor(void);
|
||||
static union node *pipeline(void);
|
||||
static union node *command(void);
|
||||
static union node *simplecmd(union node **, union node *);
|
||||
static union node *makename(void);
|
||||
static union node *makebinary(int type, union node *n1, union node *n2);
|
||||
static void parsefname(void);
|
||||
static void parseheredoc(void);
|
||||
static int peektoken(void);
|
||||
@@ -121,6 +122,7 @@ static int readtoken(void);
|
||||
static int xxreadtoken(void);
|
||||
static int readtoken1(int, const char *, const char *, int);
|
||||
static int noexpand(char *);
|
||||
static void consumetoken(int);
|
||||
static void synexpect(int) __dead2;
|
||||
static void synerror(const char *) __dead2;
|
||||
static void setprompt(int);
|
||||
@@ -210,6 +212,7 @@ parsecmd(int interact)
|
||||
heredoclist = NULL;
|
||||
|
||||
tokpushback = 0;
|
||||
checkkwd = 0;
|
||||
doprompt = interact;
|
||||
if (doprompt)
|
||||
setprompt(1);
|
||||
@@ -222,18 +225,18 @@ parsecmd(int interact)
|
||||
if (t == TNL)
|
||||
return NULL;
|
||||
tokpushback++;
|
||||
return list(1, 1);
|
||||
return list(1);
|
||||
}
|
||||
|
||||
|
||||
static union node *
|
||||
list(int nlflag, int erflag)
|
||||
list(int nlflag)
|
||||
{
|
||||
union node *ntop, *n1, *n2, *n3;
|
||||
int tok;
|
||||
|
||||
checkkwd = CHKNL | CHKKWD | CHKALIAS;
|
||||
if (!nlflag && !erflag && tokendlist[peektoken()])
|
||||
if (!nlflag && tokendlist[peektoken()])
|
||||
return NULL;
|
||||
ntop = n1 = NULL;
|
||||
for (;;) {
|
||||
@@ -255,17 +258,11 @@ list(int nlflag, int erflag)
|
||||
if (ntop == NULL)
|
||||
ntop = n2;
|
||||
else if (n1 == NULL) {
|
||||
n1 = (union node *)stalloc(sizeof (struct nbinary));
|
||||
n1->type = NSEMI;
|
||||
n1->nbinary.ch1 = ntop;
|
||||
n1->nbinary.ch2 = n2;
|
||||
n1 = makebinary(NSEMI, ntop, n2);
|
||||
ntop = n1;
|
||||
}
|
||||
else {
|
||||
n3 = (union node *)stalloc(sizeof (struct nbinary));
|
||||
n3->type = NSEMI;
|
||||
n3->nbinary.ch1 = n1->nbinary.ch2;
|
||||
n3->nbinary.ch2 = n2;
|
||||
n3 = makebinary(NSEMI, n1->nbinary.ch2, n2);
|
||||
n1->nbinary.ch2 = n3;
|
||||
n1 = n3;
|
||||
}
|
||||
@@ -286,8 +283,7 @@ list(int nlflag, int erflag)
|
||||
tokpushback++;
|
||||
}
|
||||
checkkwd = CHKNL | CHKKWD | CHKALIAS;
|
||||
if (!nlflag && (erflag ? peektoken() == TEOF :
|
||||
tokendlist[peektoken()]))
|
||||
if (!nlflag && tokendlist[peektoken()])
|
||||
return ntop;
|
||||
break;
|
||||
case TEOF:
|
||||
@@ -297,7 +293,7 @@ list(int nlflag, int erflag)
|
||||
pungetc(); /* push back EOF on input */
|
||||
return ntop;
|
||||
default:
|
||||
if (nlflag || erflag)
|
||||
if (nlflag)
|
||||
synexpect(-1);
|
||||
tokpushback++;
|
||||
return ntop;
|
||||
@@ -310,10 +306,10 @@ list(int nlflag, int erflag)
|
||||
static union node *
|
||||
andor(void)
|
||||
{
|
||||
union node *n1, *n2, *n3;
|
||||
union node *n;
|
||||
int t;
|
||||
|
||||
n1 = pipeline();
|
||||
n = pipeline();
|
||||
for (;;) {
|
||||
if ((t = readtoken()) == TAND) {
|
||||
t = NAND;
|
||||
@@ -321,14 +317,9 @@ andor(void)
|
||||
t = NOR;
|
||||
} else {
|
||||
tokpushback++;
|
||||
return n1;
|
||||
return n;
|
||||
}
|
||||
n2 = pipeline();
|
||||
n3 = (union node *)stalloc(sizeof (struct nbinary));
|
||||
n3->type = t;
|
||||
n3->nbinary.ch1 = n1;
|
||||
n3->nbinary.ch2 = n2;
|
||||
n1 = n3;
|
||||
n = makebinary(t, n, pipeline());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -410,49 +401,39 @@ command(void)
|
||||
case TIF:
|
||||
n1 = (union node *)stalloc(sizeof (struct nif));
|
||||
n1->type = NIF;
|
||||
if ((n1->nif.test = list(0, 0)) == NULL)
|
||||
if ((n1->nif.test = list(0)) == NULL)
|
||||
synexpect(-1);
|
||||
if (readtoken() != TTHEN)
|
||||
synexpect(TTHEN);
|
||||
n1->nif.ifpart = list(0, 0);
|
||||
consumetoken(TTHEN);
|
||||
n1->nif.ifpart = list(0);
|
||||
n2 = n1;
|
||||
while (readtoken() == TELIF) {
|
||||
n2->nif.elsepart = (union node *)stalloc(sizeof (struct nif));
|
||||
n2 = n2->nif.elsepart;
|
||||
n2->type = NIF;
|
||||
if ((n2->nif.test = list(0, 0)) == NULL)
|
||||
if ((n2->nif.test = list(0)) == NULL)
|
||||
synexpect(-1);
|
||||
if (readtoken() != TTHEN)
|
||||
synexpect(TTHEN);
|
||||
n2->nif.ifpart = list(0, 0);
|
||||
consumetoken(TTHEN);
|
||||
n2->nif.ifpart = list(0);
|
||||
}
|
||||
if (lasttoken == TELSE)
|
||||
n2->nif.elsepart = list(0, 0);
|
||||
n2->nif.elsepart = list(0);
|
||||
else {
|
||||
n2->nif.elsepart = NULL;
|
||||
tokpushback++;
|
||||
}
|
||||
if (readtoken() != TFI)
|
||||
synexpect(TFI);
|
||||
consumetoken(TFI);
|
||||
checkkwd = CHKKWD | CHKALIAS;
|
||||
break;
|
||||
case TWHILE:
|
||||
case TUNTIL: {
|
||||
int got;
|
||||
n1 = (union node *)stalloc(sizeof (struct nbinary));
|
||||
n1->type = (lasttoken == TWHILE)? NWHILE : NUNTIL;
|
||||
if ((n1->nbinary.ch1 = list(0, 0)) == NULL)
|
||||
case TUNTIL:
|
||||
t = lasttoken;
|
||||
if ((n1 = list(0)) == NULL)
|
||||
synexpect(-1);
|
||||
if ((got=readtoken()) != TDO) {
|
||||
TRACE(("expecting DO got %s %s\n", tokname[got], got == TWORD ? wordtext : ""));
|
||||
synexpect(TDO);
|
||||
}
|
||||
n1->nbinary.ch2 = list(0, 0);
|
||||
if (readtoken() != TDONE)
|
||||
synexpect(TDONE);
|
||||
consumetoken(TDO);
|
||||
n1 = makebinary((t == TWHILE)? NWHILE : NUNTIL, n1, list(0));
|
||||
consumetoken(TDONE);
|
||||
checkkwd = CHKKWD | CHKALIAS;
|
||||
break;
|
||||
}
|
||||
case TFOR:
|
||||
if (readtoken() != TWORD || quoteflag || ! goodname(wordtext))
|
||||
synerror("Bad for loop variable");
|
||||
@@ -464,10 +445,7 @@ TRACE(("expecting DO got %s %s\n", tokname[got], got == TWORD ? wordtext : ""));
|
||||
if (lasttoken == TWORD && ! quoteflag && equal(wordtext, "in")) {
|
||||
app = ≈
|
||||
while (readtoken() == TWORD) {
|
||||
n2 = (union node *)stalloc(sizeof (struct narg));
|
||||
n2->type = NARG;
|
||||
n2->narg.text = wordtext;
|
||||
n2->narg.backquote = backquotelist;
|
||||
n2 = makename();
|
||||
*app = n2;
|
||||
app = &n2->narg.next;
|
||||
}
|
||||
@@ -499,21 +477,15 @@ TRACE(("expecting DO got %s %s\n", tokname[got], got == TWORD ? wordtext : ""));
|
||||
t = TEND;
|
||||
else
|
||||
synexpect(-1);
|
||||
n1->nfor.body = list(0, 0);
|
||||
if (readtoken() != t)
|
||||
synexpect(t);
|
||||
n1->nfor.body = list(0);
|
||||
consumetoken(t);
|
||||
checkkwd = CHKKWD | CHKALIAS;
|
||||
break;
|
||||
case TCASE:
|
||||
n1 = (union node *)stalloc(sizeof (struct ncase));
|
||||
n1->type = NCASE;
|
||||
if (readtoken() != TWORD)
|
||||
synexpect(TWORD);
|
||||
n1->ncase.expr = n2 = (union node *)stalloc(sizeof (struct narg));
|
||||
n2->type = NARG;
|
||||
n2->narg.text = wordtext;
|
||||
n2->narg.backquote = backquotelist;
|
||||
n2->narg.next = NULL;
|
||||
consumetoken(TWORD);
|
||||
n1->ncase.expr = makename();
|
||||
while (readtoken() == TNL);
|
||||
if (lasttoken != TWORD || ! equal(wordtext, "in"))
|
||||
synerror("expecting \"in\"");
|
||||
@@ -526,10 +498,7 @@ TRACE(("expecting DO got %s %s\n", tokname[got], got == TWORD ? wordtext : ""));
|
||||
if (lasttoken == TLP)
|
||||
readtoken();
|
||||
for (;;) {
|
||||
*app = ap = (union node *)stalloc(sizeof (struct narg));
|
||||
ap->type = NARG;
|
||||
ap->narg.text = wordtext;
|
||||
ap->narg.backquote = backquotelist;
|
||||
*app = ap = makename();
|
||||
checkkwd = CHKNL | CHKKWD;
|
||||
if (readtoken() != TPIPE)
|
||||
break;
|
||||
@@ -539,7 +508,7 @@ TRACE(("expecting DO got %s %s\n", tokname[got], got == TWORD ? wordtext : ""));
|
||||
ap->narg.next = NULL;
|
||||
if (lasttoken != TRP)
|
||||
synexpect(TRP);
|
||||
cp->nclist.body = list(0, 0);
|
||||
cp->nclist.body = list(0);
|
||||
|
||||
checkkwd = CHKNL | CHKKWD | CHKALIAS;
|
||||
if ((t = readtoken()) != TESAC) {
|
||||
@@ -559,34 +528,31 @@ TRACE(("expecting DO got %s %s\n", tokname[got], got == TWORD ? wordtext : ""));
|
||||
case TLP:
|
||||
n1 = (union node *)stalloc(sizeof (struct nredir));
|
||||
n1->type = NSUBSHELL;
|
||||
n1->nredir.n = list(0, 0);
|
||||
n1->nredir.n = list(0);
|
||||
n1->nredir.redirect = NULL;
|
||||
if (readtoken() != TRP)
|
||||
synexpect(TRP);
|
||||
consumetoken(TRP);
|
||||
checkkwd = CHKKWD | CHKALIAS;
|
||||
is_subshell = 1;
|
||||
break;
|
||||
case TBEGIN:
|
||||
n1 = list(0, 0);
|
||||
if (readtoken() != TEND)
|
||||
synexpect(TEND);
|
||||
n1 = list(0);
|
||||
consumetoken(TEND);
|
||||
checkkwd = CHKKWD | CHKALIAS;
|
||||
break;
|
||||
/* Handle an empty command like other simple commands. */
|
||||
/* A simple command must have at least one redirection or word. */
|
||||
case TBACKGND:
|
||||
case TSEMI:
|
||||
case TAND:
|
||||
case TOR:
|
||||
/*
|
||||
* An empty command before a ; doesn't make much sense, and
|
||||
* should certainly be disallowed in the case of `if ;'.
|
||||
*/
|
||||
case TPIPE:
|
||||
case TENDCASE:
|
||||
case TFALLTHRU:
|
||||
case TEOF:
|
||||
case TNL:
|
||||
case TRP:
|
||||
if (!redir)
|
||||
synexpect(-1);
|
||||
case TNL:
|
||||
case TEOF:
|
||||
case TWORD:
|
||||
case TRP:
|
||||
tokpushback++;
|
||||
n1 = simplecmd(rpp, redir);
|
||||
return n1;
|
||||
@@ -644,10 +610,7 @@ simplecmd(union node **rpp, union node *redir)
|
||||
for (;;) {
|
||||
checkkwd = savecheckkwd;
|
||||
if (readtoken() == TWORD) {
|
||||
n = (union node *)stalloc(sizeof (struct narg));
|
||||
n->type = NARG;
|
||||
n->narg.text = wordtext;
|
||||
n->narg.backquote = backquotelist;
|
||||
n = makename();
|
||||
*app = n;
|
||||
app = &n->narg.next;
|
||||
if (savecheckkwd != 0 && !isassignment(wordtext))
|
||||
@@ -659,8 +622,7 @@ simplecmd(union node **rpp, union node *redir)
|
||||
} else if (lasttoken == TLP && app == &args->narg.next
|
||||
&& rpp == orig_rpp) {
|
||||
/* We have a function */
|
||||
if (readtoken() != TRP)
|
||||
synexpect(TRP);
|
||||
consumetoken(TRP);
|
||||
funclinno = plinno;
|
||||
/*
|
||||
* - Require plain text.
|
||||
@@ -708,6 +670,18 @@ makename(void)
|
||||
return n;
|
||||
}
|
||||
|
||||
static union node *
|
||||
makebinary(int type, union node *n1, union node *n2)
|
||||
{
|
||||
union node *n;
|
||||
|
||||
n = (union node *)stalloc(sizeof (struct nbinary));
|
||||
n->type = type;
|
||||
n->nbinary.ch1 = n1;
|
||||
n->nbinary.ch2 = n2;
|
||||
return (n);
|
||||
}
|
||||
|
||||
void
|
||||
fixredir(union node *n, const char *text, int err)
|
||||
{
|
||||
@@ -734,8 +708,7 @@ parsefname(void)
|
||||
{
|
||||
union node *n = redirnode;
|
||||
|
||||
if (readtoken() != TWORD)
|
||||
synexpect(-1);
|
||||
consumetoken(TWORD);
|
||||
if (n->type == NHERE) {
|
||||
struct heredoc *here = heredoc;
|
||||
struct heredoc *p;
|
||||
@@ -786,11 +759,7 @@ parseheredoc(void)
|
||||
}
|
||||
readtoken1(pgetc(), here->here->type == NHERE? SQSYNTAX : DQSYNTAX,
|
||||
here->eofmark, here->striptabs);
|
||||
n = (union node *)stalloc(sizeof (struct narg));
|
||||
n->narg.type = NARG;
|
||||
n->narg.next = NULL;
|
||||
n->narg.text = wordtext;
|
||||
n->narg.backquote = backquotelist;
|
||||
n = makename();
|
||||
here->here->nhere.doc = n;
|
||||
}
|
||||
}
|
||||
@@ -1090,14 +1059,14 @@ parsebackq(char *out, struct nodelist **pbqlist,
|
||||
doprompt = 0;
|
||||
}
|
||||
|
||||
n = list(0, oldstyle);
|
||||
n = list(0);
|
||||
|
||||
if (oldstyle)
|
||||
if (oldstyle) {
|
||||
if (peektoken() != TEOF)
|
||||
synexpect(-1);
|
||||
doprompt = saveprompt;
|
||||
else {
|
||||
if (readtoken() != TRP)
|
||||
synexpect(TRP);
|
||||
}
|
||||
} else
|
||||
consumetoken(TRP);
|
||||
|
||||
(*nlpp)->n = n;
|
||||
if (oldstyle) {
|
||||
@@ -1819,14 +1788,6 @@ parsearith: {
|
||||
} /* end of readtoken */
|
||||
|
||||
|
||||
|
||||
#ifdef mkinit
|
||||
RESET {
|
||||
tokpushback = 0;
|
||||
checkkwd = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Returns true if the text contains nothing to expand (no dollar signs
|
||||
* or backquotes).
|
||||
@@ -1888,6 +1849,14 @@ isassignment(const char *p)
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
consumetoken(int token)
|
||||
{
|
||||
if (readtoken() != token)
|
||||
synexpect(token);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Called when an unexpected token is read during the parse. The argument
|
||||
* is the token that is expected, or -1 if more than one type of token can
|
||||
|
||||
+2
-4
@@ -68,11 +68,9 @@
|
||||
|
||||
/*
|
||||
* NEOF is returned by parsecmd when it encounters an end of file. It
|
||||
* must be distinct from NULL, so we use the address of a variable that
|
||||
* happens to be handy.
|
||||
* must be distinct from NULL.
|
||||
*/
|
||||
extern int tokpushback;
|
||||
#define NEOF ((union node *)&tokpushback)
|
||||
#define NEOF ((union node *)-1)
|
||||
extern int whichprompt; /* 1 == PS1, 2 == PS2 */
|
||||
extern const char *const parsekwd[];
|
||||
|
||||
|
||||
+3
-20
@@ -66,14 +66,13 @@ __FBSDID("$FreeBSD$");
|
||||
#define CLOSED -1 /* fd was not open before redir */
|
||||
|
||||
|
||||
MKINIT
|
||||
struct redirtab {
|
||||
struct redirtab *next;
|
||||
int renamed[10];
|
||||
};
|
||||
|
||||
|
||||
MKINIT struct redirtab *redirlist;
|
||||
static struct redirtab *redirlist;
|
||||
|
||||
/*
|
||||
* We keep track of whether or not fd0 has been redirected. This is for
|
||||
@@ -121,7 +120,7 @@ redirect(union node *redir, int flags)
|
||||
|
||||
if ((flags & REDIR_PUSH) && sv->renamed[fd] == EMPTY) {
|
||||
INTOFF;
|
||||
if ((i = fcntl(fd, F_DUPFD, 10)) == -1) {
|
||||
if ((i = fcntl(fd, F_DUPFD_CLOEXEC, 10)) == -1) {
|
||||
switch (errno) {
|
||||
case EBADF:
|
||||
i = CLOSED;
|
||||
@@ -131,8 +130,7 @@ redirect(union node *redir, int flags)
|
||||
error("%d: %s", fd, strerror(errno));
|
||||
break;
|
||||
}
|
||||
} else
|
||||
(void)fcntl(i, F_SETFD, FD_CLOEXEC);
|
||||
}
|
||||
sv->renamed[fd] = i;
|
||||
INTON;
|
||||
}
|
||||
@@ -321,21 +319,6 @@ popredir(void)
|
||||
INTON;
|
||||
}
|
||||
|
||||
/*
|
||||
* Undo all redirections. Called on error or interrupt.
|
||||
*/
|
||||
|
||||
#ifdef mkinit
|
||||
|
||||
INCLUDE "redir.h"
|
||||
|
||||
RESET {
|
||||
while (redirlist)
|
||||
popredir();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/* Return true if fd 0 has already been redirected at least once. */
|
||||
int
|
||||
fd0_redirected_p(void)
|
||||
|
||||
+48
-7
@@ -32,7 +32,7 @@
|
||||
.\" from: @(#)sh.1 8.6 (Berkeley) 5/4/95
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd March 24, 2013
|
||||
.Dd June 14, 2013
|
||||
.Dt SH 1
|
||||
.Os
|
||||
.Sh NAME
|
||||
@@ -1036,6 +1036,9 @@ The current working directory as set by
|
||||
The file creation mask as set by
|
||||
.Ic umask .
|
||||
.It
|
||||
Resource limits as set by
|
||||
.Ic ulimit .
|
||||
.It
|
||||
References to open files.
|
||||
.It
|
||||
Traps as set by
|
||||
@@ -1142,8 +1145,10 @@ command is
|
||||
.Pp
|
||||
.D1 Ic return Op Ar exitstatus
|
||||
.Pp
|
||||
It terminates the current executional scope, returning from the previous
|
||||
nested function, sourced script, or shell instance, in that order.
|
||||
It terminates the current executional scope, returning from the closest
|
||||
nested function or sourced script;
|
||||
if no function or sourced script is being executed,
|
||||
it exits the shell instance.
|
||||
The
|
||||
.Ic return
|
||||
command is implemented as a special built-in command.
|
||||
@@ -1340,9 +1345,33 @@ The primary prompt string, which defaults to
|
||||
.Dq Li "$ " ,
|
||||
unless you are the superuser, in which case it defaults to
|
||||
.Dq Li "# " .
|
||||
.Va PS1
|
||||
may include any of the following formatting sequences,
|
||||
which are replaced by the given information:
|
||||
.Bl -tag -width indent
|
||||
.It Li \eH
|
||||
The local hostname.
|
||||
.It Li \eh
|
||||
The fully-qualified hostname.
|
||||
.It Li \eW
|
||||
The final component of the current working directory.
|
||||
.It Li \ew
|
||||
The entire path of the current working directory.
|
||||
.It Li \e$
|
||||
Superuser status.
|
||||
.Dq Li "$ "
|
||||
for normal users and
|
||||
.Dq Li "# "
|
||||
for superusers.
|
||||
.It Li \e\e
|
||||
A literal backslash.
|
||||
.El
|
||||
.It Va PS2
|
||||
The secondary prompt string, which defaults to
|
||||
.Dq Li "> " .
|
||||
.Va PS2
|
||||
may include any of the formatting sequences from
|
||||
.Va PS1 .
|
||||
.It Va PS4
|
||||
The prefix for the trace output (if
|
||||
.Fl x
|
||||
@@ -2348,7 +2377,9 @@ option is specified and the
|
||||
elapses before a complete line of input is supplied,
|
||||
the
|
||||
.Ic read
|
||||
command will return an exit status of 1 without assigning any values.
|
||||
command will return an exit status as if terminated by
|
||||
.Dv SIGALRM
|
||||
without assigning any values.
|
||||
The
|
||||
.Ar timeout
|
||||
value may optionally be followed by one of
|
||||
@@ -2364,6 +2395,11 @@ is assumed.
|
||||
The
|
||||
.Fl e
|
||||
option exists only for backward compatibility with older scripts.
|
||||
.Pp
|
||||
The exit status is 0 on success, 1 on end of file,
|
||||
between 2 and 128 if an error occurs
|
||||
and greater than 128 if a trapped signal interrupts
|
||||
.Ic read .
|
||||
.It Ic readonly Oo Fl p Oc Op Ar name ...
|
||||
Each specified
|
||||
.Ar name
|
||||
@@ -2611,12 +2647,17 @@ If the
|
||||
option is specified, the
|
||||
.Ar name
|
||||
arguments are treated as function names.
|
||||
.It Ic wait Op Ar job
|
||||
Wait for the specified
|
||||
.It Ic wait Op Ar job ...
|
||||
Wait for each specified
|
||||
.Ar job
|
||||
to complete and return the exit status of the last process in the
|
||||
last specified
|
||||
.Ar job .
|
||||
If the argument is omitted, wait for all jobs to complete
|
||||
If any
|
||||
.Ar job
|
||||
specified is unknown to the shell, it is treated as if it
|
||||
were a known job that exited with exit status 127.
|
||||
If no operands are given, wait for all jobs to complete
|
||||
and return an exit status of zero.
|
||||
.El
|
||||
.Ss Commandline Editing
|
||||
|
||||
@@ -63,7 +63,6 @@ typedef intmax_t arith_t;
|
||||
#define ARITH_MAX INTMAX_MAX
|
||||
|
||||
typedef void *pointer;
|
||||
#define MKINIT /* empty */
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
|
||||
+5
-13
@@ -72,8 +72,9 @@ __FBSDID("$FreeBSD$");
|
||||
#define S_RESET 5 /* temporary - to reset a hard ignored sig */
|
||||
|
||||
|
||||
MKINIT char sigmode[NSIG]; /* current value of signal */
|
||||
static char sigmode[NSIG]; /* current value of signal */
|
||||
volatile sig_atomic_t pendingsig; /* indicates some signal received */
|
||||
volatile sig_atomic_t pendingsig_waitcmd; /* indicates SIGINT/SIGQUIT received */
|
||||
int in_dotrap; /* do we execute in a trap handler? */
|
||||
static char *volatile trap[NSIG]; /* trap handler commands */
|
||||
static volatile sig_atomic_t gotsig[NSIG];
|
||||
@@ -389,23 +390,13 @@ onsig(int signo)
|
||||
}
|
||||
|
||||
/* If we are currently in a wait builtin, prepare to break it */
|
||||
if ((signo == SIGINT || signo == SIGQUIT) && in_waitcmd != 0) {
|
||||
breakwaitcmd = 1;
|
||||
pendingsig = signo;
|
||||
}
|
||||
if (signo == SIGINT || signo == SIGQUIT)
|
||||
pendingsig_waitcmd = signo;
|
||||
|
||||
if (trap[signo] != NULL && trap[signo][0] != '\0' &&
|
||||
(signo != SIGCHLD || !ignore_sigchld)) {
|
||||
gotsig[signo] = 1;
|
||||
pendingsig = signo;
|
||||
|
||||
/*
|
||||
* If a trap is set, not ignored and not the null command, we
|
||||
* need to make sure traps are executed even when a child
|
||||
* blocks signals.
|
||||
*/
|
||||
if (Tflag && !(trap[signo][0] == ':' && trap[signo][1] == '\0'))
|
||||
breakwaitcmd = 1;
|
||||
}
|
||||
|
||||
#ifndef NO_HISTORY
|
||||
@@ -428,6 +419,7 @@ dotrap(void)
|
||||
in_dotrap++;
|
||||
for (;;) {
|
||||
pendingsig = 0;
|
||||
pendingsig_waitcmd = 0;
|
||||
for (i = 1; i < NSIG; i++) {
|
||||
if (gotsig[i]) {
|
||||
gotsig[i] = 0;
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
*/
|
||||
|
||||
extern volatile sig_atomic_t pendingsig;
|
||||
extern volatile sig_atomic_t pendingsig_waitcmd;
|
||||
extern int in_dotrap;
|
||||
extern volatile sig_atomic_t gotwinch;
|
||||
|
||||
|
||||
+3
-2
@@ -710,6 +710,7 @@ localcmd(int argc __unused, char **argv __unused)
|
||||
{
|
||||
char *name;
|
||||
|
||||
nextopt("");
|
||||
if (! in_function())
|
||||
error("Not in a function");
|
||||
while ((name = *argptr++) != NULL) {
|
||||
@@ -877,7 +878,7 @@ unsetvar(const char *s)
|
||||
|
||||
|
||||
/*
|
||||
* Returns true if the two strings specify the same varable. The first
|
||||
* Returns true if the two strings specify the same variable. The first
|
||||
* variable name is terminated by '='; the second may be terminated by
|
||||
* either '=' or '\0'.
|
||||
*/
|
||||
@@ -898,7 +899,7 @@ varequal(const char *p, const char *q)
|
||||
* Search for a variable.
|
||||
* 'name' may be terminated by '=' or a NUL.
|
||||
* vppp is set to the pointer to vp, or the list head if vp isn't found
|
||||
* lenp is set to the number of charactets in 'name'
|
||||
* lenp is set to the number of characters in 'name'
|
||||
*/
|
||||
|
||||
static struct var *
|
||||
|
||||
+9
-2
@@ -43,6 +43,7 @@ __FBSDID("$FreeBSD$");
|
||||
|
||||
#include <ctype.h>
|
||||
#include <err.h>
|
||||
#include <errno.h>
|
||||
#include <limits.h>
|
||||
#include <signal.h>
|
||||
#include <stdint.h>
|
||||
@@ -81,14 +82,20 @@ main(int argc, char *argv[])
|
||||
time_to_sleep.tv_nsec = 1e9 * (d - time_to_sleep.tv_sec);
|
||||
|
||||
signal(SIGINFO, report_request);
|
||||
|
||||
/*
|
||||
* Note: [EINTR] is supposed to happen only when a signal was handled
|
||||
* but the kernel also returns it when a ptrace-based debugger
|
||||
* attaches. This is a bug but it is hard to fix.
|
||||
*/
|
||||
while (nanosleep(&time_to_sleep, &time_to_sleep) != 0) {
|
||||
if (report_requested) {
|
||||
/* Reporting does not bother with nanoseconds. */
|
||||
warnx("about %d second(s) left out of the original %d",
|
||||
(int)time_to_sleep.tv_sec, (int)original);
|
||||
report_requested = 0;
|
||||
} else
|
||||
break;
|
||||
} else if (errno != EINTR)
|
||||
err(1, "nanosleep");
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
|
||||
+32
-55
@@ -32,7 +32,7 @@
|
||||
.\" @(#)test.1 8.1 (Berkeley) 5/31/93
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd December 27, 2012
|
||||
.Dd June 1, 2013
|
||||
.Dt TEST 1
|
||||
.Os
|
||||
.Sh NAME
|
||||
@@ -169,65 +169,15 @@ True if
|
||||
.Ar file
|
||||
exists and is a socket.
|
||||
.It Ar file1 Fl nt Ar file2
|
||||
True if both
|
||||
True if
|
||||
.Ar file1
|
||||
and
|
||||
.Ar file2
|
||||
exist and
|
||||
.Ar file1
|
||||
is newer than
|
||||
exists and is newer than
|
||||
.Ar file2 .
|
||||
.It Ar file1 Fl nt Ns Ar X Ns Ar Y Ar file2
|
||||
True if both
|
||||
.Ar file1
|
||||
and
|
||||
.Ar file2
|
||||
exist and
|
||||
.Ar file1
|
||||
has a more recent last access time
|
||||
.Pq Ar X Ns = Ns Cm a ,
|
||||
inode creation time
|
||||
.Pq Ar X Ns = Ns Cm b ,
|
||||
change time
|
||||
.Pq Ar X Ns = Ns Cm c ,
|
||||
or modification time
|
||||
.Pq Ar X Ns = Ns Cm m
|
||||
than the last access time
|
||||
.Pq Ar Y Ns = Ns Cm a ,
|
||||
inode creation time
|
||||
.Pq Ar Y Ns = Ns Cm b ,
|
||||
change time
|
||||
.Pq Ar Y Ns = Ns Cm c ,
|
||||
or modification time
|
||||
.Pq Ar Y Ns = Ns Cm m
|
||||
of
|
||||
.Ar file2 .
|
||||
Note that
|
||||
.Ic -ntmm
|
||||
is equivalent to
|
||||
.Ic -nt .
|
||||
.It Ar file1 Fl ot Ar file2
|
||||
True if both
|
||||
True if
|
||||
.Ar file1
|
||||
and
|
||||
.Ar file2
|
||||
exist and
|
||||
.Ar file1
|
||||
is older than
|
||||
exists and is older than
|
||||
.Ar file2 .
|
||||
Note that
|
||||
.Ar file1
|
||||
.Ic -ot
|
||||
.Ar file2
|
||||
is equivalent to
|
||||
.Ar file2
|
||||
.Ic -nt
|
||||
.Ar file1
|
||||
.It Ar file1 Fl ot Ns Ar X Ns Ar Y Ar file2
|
||||
Equivalent to
|
||||
.Ar file2
|
||||
.Ic -nt Ns Ar Y Ns Ar X
|
||||
.Ar file1 .
|
||||
.It Ar file1 Fl ef Ar file2
|
||||
True if
|
||||
.Ar file1
|
||||
@@ -381,6 +331,20 @@ missing.
|
||||
.It >1
|
||||
An error occurred.
|
||||
.El
|
||||
.Sh EXAMPLES
|
||||
Implement
|
||||
.Li test FILE1 -nt FILE2
|
||||
using only
|
||||
.Tn POSIX
|
||||
functionality:
|
||||
.Pp
|
||||
.Dl test -n \&"$(find -L -- FILE1 -prune -newer FILE2 2>/dev/null)\&"
|
||||
.Pp
|
||||
This can be modified using non-standard
|
||||
.Xr find 1
|
||||
primaries like
|
||||
.Cm -newerca
|
||||
to compare other timestamps.
|
||||
.Sh COMPATIBILITY
|
||||
For compatibility with some other implementations,
|
||||
the
|
||||
@@ -391,7 +355,9 @@ with the same meaning.
|
||||
.Sh SEE ALSO
|
||||
.Xr builtin 1 ,
|
||||
.Xr expr 1 ,
|
||||
.Xr find 1 ,
|
||||
.Xr sh 1 ,
|
||||
.Xr stat 1 ,
|
||||
.Xr symlink 7
|
||||
.Sh STANDARDS
|
||||
The
|
||||
@@ -399,6 +365,17 @@ The
|
||||
utility implements a superset of the
|
||||
.St -p1003.2
|
||||
specification.
|
||||
The primaries
|
||||
.Cm < ,
|
||||
.Cm == ,
|
||||
.Cm > ,
|
||||
.Fl ef ,
|
||||
.Fl nt ,
|
||||
.Fl ot ,
|
||||
.Fl G ,
|
||||
and
|
||||
.Fl O
|
||||
are extensions.
|
||||
.Sh BUGS
|
||||
Both sides are always evaluated in
|
||||
.Fl a
|
||||
|
||||
+23
-161
@@ -63,7 +63,7 @@ error(const char *msg, ...)
|
||||
"-u"|"-g"|"-k"|"-s"|"-t"|"-z"|"-n"|"-o"|"-O"|"-G"|"-L"|"-S";
|
||||
|
||||
binary-operator ::= "="|"!="|"-eq"|"-ne"|"-ge"|"-gt"|"-le"|"-lt"|
|
||||
"-nt"|"-nt[abcm][abcm]"|"-ot"|"-ot[abcm][abcm])"|"-ef";
|
||||
"-nt"|"-ot"|"-ef";
|
||||
operand ::= <any legal UNIX file name>
|
||||
*/
|
||||
|
||||
@@ -85,38 +85,8 @@ enum token {
|
||||
FILSUID,
|
||||
FILSGID,
|
||||
FILSTCK,
|
||||
FILNTAA,
|
||||
FILNTAB,
|
||||
FILNTAC,
|
||||
FILNTAM,
|
||||
FILNTBA,
|
||||
FILNTBB,
|
||||
FILNTBC,
|
||||
FILNTBM,
|
||||
FILNTCA,
|
||||
FILNTCB,
|
||||
FILNTCC,
|
||||
FILNTCM,
|
||||
FILNTMA,
|
||||
FILNTMB,
|
||||
FILNTMC,
|
||||
FILNTMM,
|
||||
FILOTAA,
|
||||
FILOTAB,
|
||||
FILOTAC,
|
||||
FILOTAM,
|
||||
FILOTBA,
|
||||
FILOTBB,
|
||||
FILOTBC,
|
||||
FILOTBM,
|
||||
FILOTCA,
|
||||
FILOTCB,
|
||||
FILOTCC,
|
||||
FILOTCM,
|
||||
FILOTMA,
|
||||
FILOTMB,
|
||||
FILOTMC,
|
||||
FILOTMM,
|
||||
FILNT,
|
||||
FILOT,
|
||||
FILEQ,
|
||||
FILUID,
|
||||
FILGID,
|
||||
@@ -148,16 +118,9 @@ enum token_types {
|
||||
PAREN
|
||||
};
|
||||
|
||||
enum time_types {
|
||||
ATIME,
|
||||
BTIME,
|
||||
CTIME,
|
||||
MTIME
|
||||
};
|
||||
|
||||
static struct t_op {
|
||||
char op_text[6];
|
||||
char op_num, op_type;
|
||||
char op_text[4];
|
||||
short op_num, op_type;
|
||||
} const ops [] = {
|
||||
{"-r", FILRD, UNOP},
|
||||
{"-w", FILWR, UNOP},
|
||||
@@ -191,40 +154,8 @@ static struct t_op {
|
||||
{"-gt", INTGT, BINOP},
|
||||
{"-le", INTLE, BINOP},
|
||||
{"-lt", INTLT, BINOP},
|
||||
{"-nt", FILNTMM, BINOP},
|
||||
{"-ntaa", FILNTAA, BINOP},
|
||||
{"-ntab", FILNTAB, BINOP},
|
||||
{"-ntac", FILNTAC, BINOP},
|
||||
{"-ntam", FILNTAM, BINOP},
|
||||
{"-ntba", FILNTBA, BINOP},
|
||||
{"-ntbb", FILNTBB, BINOP},
|
||||
{"-ntbc", FILNTBC, BINOP},
|
||||
{"-ntbm", FILNTBM, BINOP},
|
||||
{"-ntca", FILNTCA, BINOP},
|
||||
{"-ntcb", FILNTCB, BINOP},
|
||||
{"-ntcc", FILNTCC, BINOP},
|
||||
{"-ntcm", FILNTCM, BINOP},
|
||||
{"-ntma", FILNTMA, BINOP},
|
||||
{"-ntmb", FILNTMB, BINOP},
|
||||
{"-ntmc", FILNTMC, BINOP},
|
||||
{"-ntmm", FILNTMM, BINOP},
|
||||
{"-ot", FILOTMM, BINOP},
|
||||
{"-otaa", FILOTAA, BINOP},
|
||||
{"-otab", FILOTBB, BINOP},
|
||||
{"-otac", FILOTAC, BINOP},
|
||||
{"-otam", FILOTAM, BINOP},
|
||||
{"-otba", FILOTBA, BINOP},
|
||||
{"-otbb", FILOTBB, BINOP},
|
||||
{"-otbc", FILOTBC, BINOP},
|
||||
{"-otbm", FILOTBM, BINOP},
|
||||
{"-otca", FILOTCA, BINOP},
|
||||
{"-otcb", FILOTCB, BINOP},
|
||||
{"-otcc", FILOTCC, BINOP},
|
||||
{"-otcm", FILOTCM, BINOP},
|
||||
{"-otma", FILOTMA, BINOP},
|
||||
{"-otmb", FILOTMB, BINOP},
|
||||
{"-otmc", FILOTMC, BINOP},
|
||||
{"-otmm", FILOTMM, BINOP},
|
||||
{"-nt", FILNT, BINOP},
|
||||
{"-ot", FILOT, BINOP},
|
||||
{"-ef", FILEQ, BINOP},
|
||||
{"!", UNOT, BUNOP},
|
||||
{"-a", BAND, BBINOP},
|
||||
@@ -249,10 +180,10 @@ static int intcmp(const char *, const char *);
|
||||
static int isunopoperand(void);
|
||||
static int islparenoperand(void);
|
||||
static int isrparenoperand(void);
|
||||
static int newerf(const char *, const char *, enum time_types,
|
||||
enum time_types);
|
||||
static int newerf(const char *, const char *);
|
||||
static int nexpr(enum token);
|
||||
static int oexpr(enum token);
|
||||
static int olderf(const char *, const char *);
|
||||
static int primary(enum token);
|
||||
static void syntax(const char *, const char *);
|
||||
static enum token t_lex(char *);
|
||||
@@ -422,70 +353,10 @@ binop(void)
|
||||
return intcmp(opnd1, opnd2) <= 0;
|
||||
case INTLT:
|
||||
return intcmp(opnd1, opnd2) < 0;
|
||||
case FILNTAA:
|
||||
return newerf(opnd1, opnd2, ATIME, ATIME);
|
||||
case FILNTAB:
|
||||
return newerf(opnd1, opnd2, ATIME, BTIME);
|
||||
case FILNTAC:
|
||||
return newerf(opnd1, opnd2, ATIME, CTIME);
|
||||
case FILNTAM:
|
||||
return newerf(opnd1, opnd2, ATIME, MTIME);
|
||||
case FILNTBA:
|
||||
return newerf(opnd1, opnd2, BTIME, ATIME);
|
||||
case FILNTBB:
|
||||
return newerf(opnd1, opnd2, BTIME, BTIME);
|
||||
case FILNTBC:
|
||||
return newerf(opnd1, opnd2, BTIME, CTIME);
|
||||
case FILNTBM:
|
||||
return newerf(opnd1, opnd2, BTIME, MTIME);
|
||||
case FILNTCA:
|
||||
return newerf(opnd1, opnd2, CTIME, ATIME);
|
||||
case FILNTCB:
|
||||
return newerf(opnd1, opnd2, CTIME, BTIME);
|
||||
case FILNTCC:
|
||||
return newerf(opnd1, opnd2, CTIME, CTIME);
|
||||
case FILNTCM:
|
||||
return newerf(opnd1, opnd2, CTIME, MTIME);
|
||||
case FILNTMA:
|
||||
return newerf(opnd1, opnd2, MTIME, ATIME);
|
||||
case FILNTMB:
|
||||
return newerf(opnd1, opnd2, MTIME, BTIME);
|
||||
case FILNTMC:
|
||||
return newerf(opnd1, opnd2, MTIME, CTIME);
|
||||
case FILNTMM:
|
||||
return newerf(opnd1, opnd2, MTIME, MTIME);
|
||||
case FILOTAA:
|
||||
return newerf(opnd2, opnd1, ATIME, ATIME);
|
||||
case FILOTAB:
|
||||
return newerf(opnd2, opnd1, BTIME, ATIME);
|
||||
case FILOTAC:
|
||||
return newerf(opnd2, opnd1, CTIME, ATIME);
|
||||
case FILOTAM:
|
||||
return newerf(opnd2, opnd1, MTIME, ATIME);
|
||||
case FILOTBA:
|
||||
return newerf(opnd2, opnd1, ATIME, BTIME);
|
||||
case FILOTBB:
|
||||
return newerf(opnd2, opnd1, BTIME, BTIME);
|
||||
case FILOTBC:
|
||||
return newerf(opnd2, opnd1, CTIME, BTIME);
|
||||
case FILOTBM:
|
||||
return newerf(opnd2, opnd1, MTIME, BTIME);
|
||||
case FILOTCA:
|
||||
return newerf(opnd2, opnd1, ATIME, CTIME);
|
||||
case FILOTCB:
|
||||
return newerf(opnd2, opnd1, BTIME, CTIME);
|
||||
case FILOTCC:
|
||||
return newerf(opnd2, opnd1, CTIME, CTIME);
|
||||
case FILOTCM:
|
||||
return newerf(opnd2, opnd1, MTIME, CTIME);
|
||||
case FILOTMA:
|
||||
return newerf(opnd2, opnd1, ATIME, MTIME);
|
||||
case FILOTMB:
|
||||
return newerf(opnd2, opnd1, BTIME, MTIME);
|
||||
case FILOTMC:
|
||||
return newerf(opnd2, opnd1, CTIME, MTIME);
|
||||
case FILOTMM:
|
||||
return newerf(opnd2, opnd1, MTIME, MTIME);
|
||||
case FILNT:
|
||||
return newerf (opnd1, opnd2);
|
||||
case FILOT:
|
||||
return olderf (opnd1, opnd2);
|
||||
case FILEQ:
|
||||
return equalf (opnd1, opnd2);
|
||||
default:
|
||||
@@ -699,34 +570,25 @@ intcmp (const char *s1, const char *s2)
|
||||
}
|
||||
|
||||
static int
|
||||
newerf (const char *f1, const char *f2, enum time_types t1, enum time_types t2)
|
||||
newerf (const char *f1, const char *f2)
|
||||
{
|
||||
struct stat b1, b2;
|
||||
struct timespec *ts1, *ts2;
|
||||
|
||||
if (stat(f1, &b1) != 0 || stat(f2, &b2) != 0)
|
||||
return 0;
|
||||
|
||||
switch (t1) {
|
||||
case ATIME: ts1 = &b1.st_atim; break;
|
||||
case BTIME: ts1 = &b1.st_birthtim; break;
|
||||
case CTIME: ts1 = &b1.st_ctim; break;
|
||||
default: ts1 = &b1.st_mtim; break;
|
||||
}
|
||||
|
||||
switch (t2) {
|
||||
case ATIME: ts2 = &b2.st_atim; break;
|
||||
case BTIME: ts2 = &b2.st_birthtim; break;
|
||||
case CTIME: ts2 = &b2.st_ctim; break;
|
||||
default: ts2 = &b2.st_mtim; break;
|
||||
}
|
||||
|
||||
if (ts1->tv_sec > ts2->tv_sec)
|
||||
if (b1.st_mtim.tv_sec > b2.st_mtim.tv_sec)
|
||||
return 1;
|
||||
if (ts1->tv_sec < ts2->tv_sec)
|
||||
if (b1.st_mtim.tv_sec < b2.st_mtim.tv_sec)
|
||||
return 0;
|
||||
|
||||
return (ts1->tv_nsec > ts2->tv_nsec);
|
||||
return (b1.st_mtim.tv_nsec > b2.st_mtim.tv_nsec);
|
||||
}
|
||||
|
||||
static int
|
||||
olderf (const char *f1, const char *f2)
|
||||
{
|
||||
return (newerf(f2, f1));
|
||||
}
|
||||
|
||||
static int
|
||||
|
||||
@@ -23,9 +23,8 @@
|
||||
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
/*
|
||||
* Copyright (c) 2012 by Delphix. All rights reserved.
|
||||
*/
|
||||
|
||||
#pragma ident "%Z%%M% %I% %E% SMI"
|
||||
|
||||
/*
|
||||
* ASSERTION:
|
||||
@@ -38,20 +37,19 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
* We make some regrettable assumptions about the implementation in this
|
||||
* test. First, we assume that each entry for the printf() of an int
|
||||
* takes _exactly_ 16 bytes (4 bytes for the EPID, 8 bytes for the
|
||||
* timestamp, 4 bytes for the payload). Second, we assume that by
|
||||
* allocating storage for n + 1 records, we will get exactly n. Here is
|
||||
* why: the final predicate that evaluates to false will reserve space
|
||||
* that it won't use. This act of reservation will advance the wrapped
|
||||
* offset. That record won't be subsequently used, but the wrapped
|
||||
* offset has advanced. (And in this case, that old record is clobbered
|
||||
* by the exit() anyway.) Thirdly: we rely on t_cpu/cpu_id. Finally:
|
||||
* we rely on being able to run on the CPU that we first ran on.
|
||||
* We make some regrettable assumptions about the implementation in this test.
|
||||
* First, we assume that each entry for the printf() of an int takes _exactly_
|
||||
* eight bytes (four bytes for the EPID, four bytes for the payload). Second,
|
||||
* we assume that by allocating storage for n + 1 records, we will get exactly
|
||||
* n. Here is why: the final predicate that evaluates to false will reserve
|
||||
* space that it won't use. This act of reservation will advance the wrapped
|
||||
* offset. That record won't be subsequently used, but the wrapped offset has
|
||||
* advanced. (And in this case, that old record is clobbered by the exit()
|
||||
* anyway.) Thirdly: we rely on t_cpu/cpu_id. Finally: we rely on being
|
||||
* able to run on the CPU that we first ran on.
|
||||
*/
|
||||
#pragma D option bufpolicy=ring
|
||||
#pragma D option bufsize=80
|
||||
#pragma D option bufsize=40
|
||||
#pragma D option quiet
|
||||
|
||||
int n;
|
||||
|
||||
@@ -36,12 +36,12 @@
|
||||
#pragma D option quiet
|
||||
#pragma D option statusrate=10ms
|
||||
|
||||
fbt::ioctl:entry
|
||||
fbt::kern_ioctl:entry
|
||||
{
|
||||
printf("Entering the ioctl function\n");
|
||||
}
|
||||
|
||||
fbt::ioctl:return
|
||||
fbt::kern_ioctl:return
|
||||
{
|
||||
printf("Returning from ioctl function\n");
|
||||
exit(0);
|
||||
|
||||
+1
-1
@@ -36,7 +36,7 @@
|
||||
#pragma D option quiet
|
||||
#pragma D option statusrate=10ms
|
||||
|
||||
fbt::ioctl:return
|
||||
fbt::kern_ioctl:return
|
||||
{
|
||||
printf("The function return value is stored in %u\n", arg1);
|
||||
exit(0);
|
||||
|
||||
@@ -36,13 +36,13 @@
|
||||
#pragma D option quiet
|
||||
#pragma D option statusrate=10ms
|
||||
|
||||
fbt::ioctl:entry
|
||||
fbt::kern_ioctl:entry
|
||||
{
|
||||
printf("Entering the ioctl function\n");
|
||||
printf("The few arguments are %u %u %u %u\n", arg0, arg1, arg2, arg3);
|
||||
}
|
||||
|
||||
fbt::ioctl:return
|
||||
fbt::kern_ioctl:return
|
||||
{
|
||||
printf("Returning from ioctl function\n");
|
||||
printf("The few arguments are %u %u %u %u\n", arg0, arg1, arg2, arg3);
|
||||
|
||||
@@ -41,12 +41,12 @@ BEGIN
|
||||
self->traceme = 1;
|
||||
}
|
||||
|
||||
fbt::ioctl:entry
|
||||
fbt::kern_ioctl:entry
|
||||
{
|
||||
printf("Entering the function\n");
|
||||
}
|
||||
|
||||
fbt::ioctl:return
|
||||
fbt::kern_ioctl:return
|
||||
{
|
||||
printf("The offset = %u\n", arg0);
|
||||
exit(0);
|
||||
|
||||
@@ -36,14 +36,14 @@
|
||||
#pragma D option quiet
|
||||
#pragma D option statusrate=10ms
|
||||
|
||||
fbt::ioctl:entry
|
||||
fbt::kern_ioctl:entry
|
||||
{
|
||||
printf("Entering the ioctl function\n");
|
||||
printf("The few arguments are %u %u %u %u\n", arg0, arg1, arg2, arg3);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
fbt::ioctl:return
|
||||
fbt::kern_ioctl:return
|
||||
{
|
||||
printf("Returning from ioctl function\n");
|
||||
printf("The few arguments are %u %u %u %u\n", arg0, arg1, arg2, arg3);
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
#pragma D option quiet
|
||||
#pragma D option statusrate=10ms
|
||||
|
||||
fbt::ioctl:return
|
||||
fbt::kern_ioctl:return
|
||||
/arg1 == 0/
|
||||
{
|
||||
printf("%s %x returned 0", probefunc, arg0);
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
#pragma D option quiet
|
||||
#pragma D option statusrate=10ms
|
||||
|
||||
fbt::ioctl:entry
|
||||
fbt::kern_ioctl:entry
|
||||
{
|
||||
self->traceme = 1;
|
||||
}
|
||||
@@ -47,7 +47,7 @@ fbt:::entry
|
||||
printf("called %s\n", probefunc);
|
||||
}
|
||||
|
||||
fbt::ioctl:return
|
||||
fbt::kern_ioctl:return
|
||||
/self->traceme/
|
||||
{
|
||||
self->traceme = 0;
|
||||
|
||||
@@ -24,7 +24,9 @@
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
|
||||
#pragma ident "%Z%%M% %I% %E% SMI"
|
||||
/*
|
||||
* Copyright (c) 2012 by Delphix. All rights reserved.
|
||||
*/
|
||||
|
||||
#pragma D option quiet
|
||||
|
||||
@@ -36,3 +38,8 @@ BEGIN
|
||||
printf("%s\n", strjoin("", ""));
|
||||
exit(0);
|
||||
}
|
||||
|
||||
BEGIN
|
||||
{
|
||||
exit(1);
|
||||
}
|
||||
|
||||
@@ -73,7 +73,7 @@ die "Could not determine local IP address" if $local eq "";
|
||||
# Find the first remote host that responds to an icmp echo,
|
||||
# which isn't a local address.
|
||||
#
|
||||
open PING, "/sbin/ping -ns $Broadcast{$local} 56 $MAXHOSTS |" or
|
||||
open PING, "/sbin/ping -n -s 56 -c $MAXHOSTS $Broadcast{$local} |" or
|
||||
die "Couldn't run ping: $!\n";
|
||||
while (<PING>) {
|
||||
if (/bytes from (.*): / and not defined $Broadcast{$1}) {
|
||||
|
||||
@@ -48,7 +48,9 @@ my $MULTICAST = "FF02::1"; # IPv6 multicast address
|
||||
#
|
||||
my $local = "";
|
||||
my $remote = "";
|
||||
my $interf = "";
|
||||
my %Local;
|
||||
my %Addr;
|
||||
my $up;
|
||||
open IFCONFIG, '/sbin/ifconfig -a inet6 |'
|
||||
or die "Couldn't run ifconfig: $!\n";
|
||||
@@ -59,27 +61,34 @@ while (<IFCONFIG>) {
|
||||
$up = 1 if /^[a-z].*<UP,/;
|
||||
$up = 0 if /^[a-z].*<,/;
|
||||
|
||||
if (m:(\S+\d+)\: :) {
|
||||
$interf = $1;
|
||||
}
|
||||
|
||||
# assume output is "inet6 ...":
|
||||
if (m:inet6 (\S+)/:) {
|
||||
if (m:inet6 (\S+) :) {
|
||||
my $addr = $1;
|
||||
$Local{$addr} = 1;
|
||||
$local = $addr if $up and $local eq "";
|
||||
$Addr{$interf} = $addr;
|
||||
$up = 0;
|
||||
$interf = "";
|
||||
}
|
||||
}
|
||||
close IFCONFIG;
|
||||
exit 1 if $local eq "";
|
||||
|
||||
#
|
||||
# Find the first remote host that responds to an icmp echo,
|
||||
# which isn't a local address.
|
||||
# which isn't a local address. Try each IPv6-enabled interface.
|
||||
#
|
||||
open PING, "/sbin/ping -ns -A inet6 $MULTICAST 56 $MAXHOSTS |" or
|
||||
die "Couldn't run ping: $!\n";
|
||||
while (<PING>) {
|
||||
if (/bytes from (.*): / and not defined $Local{$1}) {
|
||||
$remote = $1;
|
||||
last;
|
||||
foreach $interf (split(' ', `ifconfig -l -u inet6`)) {
|
||||
next if $interf =~ /lo[0-9]+/;
|
||||
open PING, "/sbin/ping6 -n -s 56 -c $MAXHOSTS $MULTICAST\%$interf |" or next;
|
||||
while (<PING>) {
|
||||
if (/bytes from (.*), / and not defined $Local{$1}) {
|
||||
$remote = $1;
|
||||
$local = $Addr{$interf};
|
||||
last;
|
||||
}
|
||||
}
|
||||
}
|
||||
close PING;
|
||||
|
||||
@@ -24,9 +24,7 @@
|
||||
# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
|
||||
# Use is subject to license terms.
|
||||
#
|
||||
|
||||
#
|
||||
# Copyright (c) 2012 by Delphix. All rights reserved.
|
||||
# ident "%Z%%M% %I% %E% SMI"
|
||||
#
|
||||
|
||||
if [ $# != 1 ]; then
|
||||
@@ -51,13 +49,13 @@ tick-1s
|
||||
tick-1s
|
||||
/(i % 2) == 0/
|
||||
{
|
||||
system("dtrace -c date -n 'pid\$target::main:entry' >/dev/null");
|
||||
system("dtrace -c date -ln 'pid\$target::main:entry' >/dev/null");
|
||||
}
|
||||
|
||||
tick-1s
|
||||
/(i % 2) == 1/
|
||||
{
|
||||
system("dtrace -c date -n 'pid\$target::main:return' >/dev/null");
|
||||
system("dtrace -c date -ln 'pid\$target::main:return' >/dev/null");
|
||||
}
|
||||
EOF
|
||||
|
||||
|
||||
@@ -24,7 +24,9 @@
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
|
||||
#pragma ident "%Z%%M% %I% %E% SMI"
|
||||
/*
|
||||
* Copyright (c) 2012 by Delphix. All rights reserved.
|
||||
*/
|
||||
|
||||
/*
|
||||
* ASSERTION: This test reproduces the alignment error.
|
||||
@@ -39,9 +41,10 @@
|
||||
|
||||
BEGIN
|
||||
{
|
||||
x = (int *) 64;
|
||||
x = (int *)64;
|
||||
y = *x;
|
||||
trace(y);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
ERROR
|
||||
|
||||
@@ -24,7 +24,9 @@
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
|
||||
#pragma ident "%Z%%M% %I% %E% SMI"
|
||||
/*
|
||||
* Copyright (c) 2012 by Delphix. All rights reserved.
|
||||
*/
|
||||
|
||||
/*
|
||||
* ASSERTION: D pointers do not allow invalid pointer accesses.
|
||||
@@ -44,6 +46,7 @@ BEGIN
|
||||
y = (int *) (x - 3300778156056);
|
||||
*y = 3;
|
||||
trace(*y);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
ERROR
|
||||
|
||||
@@ -24,7 +24,9 @@
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
|
||||
#pragma ident "%Z%%M% %I% %E% SMI"
|
||||
/*
|
||||
* Copyright (c) 2012 by Delphix. All rights reserved.
|
||||
*/
|
||||
|
||||
/*
|
||||
* ASSERTION: D pointers do not allow invalid pointer accesses.
|
||||
@@ -39,9 +41,10 @@
|
||||
|
||||
BEGIN
|
||||
{
|
||||
y = (int *) (-33007);
|
||||
y = (int *)-33007;
|
||||
*y = 3;
|
||||
trace(*y);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
ERROR
|
||||
|
||||
@@ -24,7 +24,9 @@
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
|
||||
#pragma ident "%Z%%M% %I% %E% SMI"
|
||||
/*
|
||||
* Copyright (c) 2012 by Delphix. All rights reserved.
|
||||
*/
|
||||
|
||||
/*
|
||||
* ASSERTION: Demonstrating valid memory access.
|
||||
@@ -40,10 +42,11 @@
|
||||
BEGIN
|
||||
{
|
||||
x = (int *)alloca(sizeof (int));
|
||||
printf("Address x: %x\n", (int) x);
|
||||
y = (int *) (x - 2);
|
||||
printf("Address x: %x\n", (int)x);
|
||||
y = (int *)(x - 2);
|
||||
*y = 3;
|
||||
printf("Address y: %x\tValue: %d\n", (int) y, *y);
|
||||
printf("Address y: %x\tValue: %d\n", (int)y, *y);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
ERROR
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
/*
|
||||
* CDDL HEADER START
|
||||
*
|
||||
* This file and its contents are supplied under the terms of the
|
||||
* Common Development and Distribution License ("CDDL"), version 1.0.
|
||||
* You may only use this file in accordance with the terms of version
|
||||
* 1.0 of the CDDL.
|
||||
*
|
||||
* A full copy of the text of the CDDL should have accompanied this
|
||||
* source. A copy of the CDDL is also available via the Internet at
|
||||
* http://www.illumos.org/license/CDDL.
|
||||
*
|
||||
* CDDL HEADER END
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2012 by Delphix. All rights reserved.
|
||||
*/
|
||||
|
||||
BEGIN
|
||||
{
|
||||
*((int *)alloca(4)) = 1;
|
||||
}
|
||||
|
||||
BEGIN
|
||||
{
|
||||
exit(0);
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
/*
|
||||
* CDDL HEADER START
|
||||
*
|
||||
* This file and its contents are supplied under the terms of the
|
||||
* Common Development and Distribution License ("CDDL"), version 1.0.
|
||||
* You may only use this file in accordance with the terms of version
|
||||
* 1.0 of the CDDL.
|
||||
*
|
||||
* A full copy of the text of the CDDL should have accompanied this
|
||||
* source. A copy of the CDDL is also available via the Internet at
|
||||
* http://www.illumos.org/license/CDDL.
|
||||
*
|
||||
* CDDL HEADER END
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2012 by Delphix. All rights reserved.
|
||||
*/
|
||||
|
||||
BEGIN
|
||||
{
|
||||
this->a = alloca(4);
|
||||
*((int *)this->a) = 1;
|
||||
}
|
||||
|
||||
BEGIN
|
||||
{
|
||||
exit(0);
|
||||
}
|
||||
@@ -73,8 +73,8 @@ if [ "$status" -ne 0 ]; then
|
||||
fi
|
||||
|
||||
# dtrace outputs a blank line at the end, which will sort to the beginning,
|
||||
# so use head to remove the blank line.
|
||||
head -n -1 $file > $file.2
|
||||
# so use sed to remove the blank line.
|
||||
sed '$d' $file > $file.2
|
||||
|
||||
sort -n $file.2 | diff $file.2 -
|
||||
status=$?
|
||||
|
||||
@@ -89,8 +89,8 @@ if [ "$status" -ne 0 ]; then
|
||||
fi
|
||||
|
||||
# dtrace outputs a blank line at the end, which will sort to the beginning,
|
||||
# so use grep to remove the blank line.
|
||||
head -n -1 $file > $file.2
|
||||
# so use sed to remove the blank line.
|
||||
sed '$d' $file > $file.2
|
||||
|
||||
sort -n $file.2 | diff $file.2 -
|
||||
status=$?
|
||||
|
||||
@@ -0,0 +1,197 @@
|
||||
#
|
||||
# CDDL HEADER START
|
||||
#
|
||||
# The contents of this file are subject to the terms of the
|
||||
# Common Development and Distribution License (the "License").
|
||||
# You may not use this file except in compliance with the License.
|
||||
#
|
||||
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||
# or http://www.opensolaris.org/os/licensing.
|
||||
# See the License for the specific language governing permissions
|
||||
# and limitations under the License.
|
||||
#
|
||||
# When distributing Covered Code, include this CDDL HEADER in each
|
||||
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||
# If applicable, add the following below this CDDL HEADER, with the
|
||||
# fields enclosed by brackets "[]" replaced with your own identifying
|
||||
# information: Portions Copyright [yyyy] [name of copyright owner]
|
||||
#
|
||||
# CDDL HEADER END
|
||||
#
|
||||
|
||||
#
|
||||
# Copyright 2007 Sun Microsystems, Inc. All rights reserved.
|
||||
# Use is subject to license terms.
|
||||
#
|
||||
# ident "%Z%%M% %I% %E% SMI"
|
||||
|
||||
unload()
|
||||
{
|
||||
#
|
||||
# Get the list of services whose processes have USDT probes. Ideally
|
||||
# it would be possible to unload the fasttrap provider while USDT
|
||||
# probes exist -- once that fix is integrated, this hack can go away
|
||||
# We create two lists -- one of regular SMF services and one of legacy
|
||||
# services -- since each must be enabled and disabled using a specific
|
||||
# mechanism.
|
||||
#
|
||||
pids=$(dtrace -l | \
|
||||
perl -ne 'print "$1\n" if (/^\s*\S+\s+\S*\D(\d+)\s+/);' | \
|
||||
sort | uniq | tr '\n' ',')
|
||||
|
||||
ctids=$(ps -p $pids -o ctid | tail +2 | sort | uniq)
|
||||
svcs=
|
||||
lrcs=
|
||||
|
||||
for ct in $ctids
|
||||
do
|
||||
line=$(svcs -o fmri,ctid | grep " $ct\$")
|
||||
svc=$(echo $line | cut -d' ' -f1)
|
||||
|
||||
if [[ $(svcs -Ho STA $svc) == "LRC" ]]; then
|
||||
lrc=$(svcs -Ho SVC $svc | tr _ '?')
|
||||
lrcs="$lrcs $lrc"
|
||||
else
|
||||
svcs="$svcs $svc"
|
||||
fi
|
||||
done
|
||||
|
||||
for svc in $svcs
|
||||
do
|
||||
svcadm disable -ts $svc
|
||||
done
|
||||
|
||||
for lrc in $lrcs
|
||||
do
|
||||
#
|
||||
# Does it seem a little paternalistic that lsvcrun requires
|
||||
# this environment variable to be set? I'd say so...
|
||||
#
|
||||
SMF_RESTARTER=svc:/system/svc/restarter:default \
|
||||
/lib/svc/bin/lsvcrun $lrc stop
|
||||
done
|
||||
|
||||
modunload -i 0
|
||||
modunload -i 0
|
||||
modunload -i 0
|
||||
modinfo | grep dtrace
|
||||
success=$?
|
||||
|
||||
for svc in $svcs
|
||||
do
|
||||
svcadm enable -ts $svc
|
||||
done
|
||||
|
||||
for lrc in $lrcs
|
||||
do
|
||||
SMF_RESTARTER=svc:/system/svc/restarter:default \
|
||||
/lib/svc/bin/lsvcrun $lrc start
|
||||
done
|
||||
|
||||
if [ ! $success ]; then
|
||||
echo $tst: could not unload dtrace
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
script1()
|
||||
{
|
||||
$dtrace -s /dev/stdin <<EOF
|
||||
syscall:::entry
|
||||
/pid != $ppid/
|
||||
{
|
||||
@a[probefunc] = count();
|
||||
}
|
||||
|
||||
tick-1sec
|
||||
/i++ == 5/
|
||||
{
|
||||
exit(0);
|
||||
}
|
||||
EOF
|
||||
}
|
||||
|
||||
script2()
|
||||
{
|
||||
$dtrace -s /dev/stdin <<EOF
|
||||
|
||||
#pragma D option statusrate=1ms
|
||||
|
||||
syscall:::entry
|
||||
/pid == $ppid/
|
||||
{
|
||||
ttl++;
|
||||
}
|
||||
|
||||
tick-1sec
|
||||
/i++ == 5/
|
||||
{
|
||||
exit(2);
|
||||
}
|
||||
|
||||
END
|
||||
/ttl/
|
||||
{
|
||||
printf("success; ttl is %d", ttl);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
END
|
||||
/ttl == 0/
|
||||
{
|
||||
printf("error -- total should be non-zero");
|
||||
exit(1);
|
||||
}
|
||||
EOF
|
||||
}
|
||||
|
||||
if [ $# != 1 ]; then
|
||||
echo expected one argument: '<'dtrace-path'>'
|
||||
exit 2
|
||||
fi
|
||||
|
||||
ppid=$$
|
||||
dtrace=$1
|
||||
|
||||
unload
|
||||
script1 &
|
||||
child=$!
|
||||
|
||||
let waited=0
|
||||
|
||||
while [ "$waited" -lt 5 ]; do
|
||||
seconds=`date +%S`
|
||||
|
||||
if [ "$seconds" -ne "$last" ]; then
|
||||
last=$seconds
|
||||
let waited=waited+1
|
||||
fi
|
||||
done
|
||||
|
||||
wait $child
|
||||
status=$?
|
||||
|
||||
if [ "$status" -ne 0 ]; then
|
||||
echo $tst: first dtrace failed
|
||||
exit $status
|
||||
fi
|
||||
|
||||
unload
|
||||
script2 &
|
||||
child=$!
|
||||
|
||||
let waited=0
|
||||
|
||||
while [ "$waited" -lt 10 ]; do
|
||||
seconds=`date +%S`
|
||||
|
||||
if [ "$seconds" -ne "$last" ]; then
|
||||
last=$seconds
|
||||
let waited=waited+1
|
||||
fi
|
||||
done
|
||||
|
||||
wait $child
|
||||
status=$?
|
||||
|
||||
exit $status
|
||||
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* CDDL HEADER START
|
||||
*
|
||||
* This file and its contents are supplied under the terms of the
|
||||
* Common Development and Distribution License ("CDDL"), version 1.0.
|
||||
* You may only use this file in accordance with the terms of version
|
||||
* 1.0 of the CDDL.
|
||||
*
|
||||
* A full copy of the text of the CDDL should have accompanied this
|
||||
* source. A copy of the CDDL is also available via the Internet at
|
||||
* http://www.illumos.org/license/CDDL.
|
||||
*
|
||||
* CDDL HEADER END
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2012 by Delphix. All rights reserved.
|
||||
*/
|
||||
|
||||
BEGIN
|
||||
{
|
||||
@ = count();
|
||||
print(@);
|
||||
}
|
||||
|
||||
BEGIN
|
||||
{
|
||||
exit(0);
|
||||
}
|
||||
@@ -20,10 +20,15 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2011 by Delphix. All rights reserved.
|
||||
* Copyright (c) 2012 by Delphix. All rights reserved.
|
||||
*/
|
||||
|
||||
BEGIN
|
||||
{
|
||||
print((void)`p0);
|
||||
}
|
||||
|
||||
BEGIN
|
||||
{
|
||||
exit(0);
|
||||
}
|
||||
|
||||
@@ -20,10 +20,15 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2011 by Delphix. All rights reserved.
|
||||
* Copyright (c) 2012 by Delphix. All rights reserved.
|
||||
*/
|
||||
|
||||
BEGIN
|
||||
{
|
||||
print();
|
||||
}
|
||||
|
||||
BEGIN
|
||||
{
|
||||
exit(0);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* This file and its contents are supplied under the terms of the
|
||||
* Common Development and Distribution License ("CDDL"), version 1.0.
|
||||
* You may only use this file in accordance with the terms of version
|
||||
* 1.0 of the CDDL.
|
||||
*
|
||||
* A full copy of the text of the CDDL should have accompanied this
|
||||
* source. A copy of the CDDL is also available via the Internet at
|
||||
* http://www.illumos.org/license/CDDL.
|
||||
*/
|
||||
/*
|
||||
* Copyright (c) 2013, Joyent, Inc. All rights reserved.
|
||||
*/
|
||||
|
||||
#pragma D option quiet
|
||||
|
||||
enum simpson {
|
||||
homer,
|
||||
marge,
|
||||
bart,
|
||||
lisa,
|
||||
maggie,
|
||||
snowball_ii,
|
||||
santas_little_helper
|
||||
};
|
||||
|
||||
BEGIN
|
||||
{
|
||||
print(bart);
|
||||
print((enum simpson)4);
|
||||
print(snowball_ii);
|
||||
exit(0);
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
enum simpson bart
|
||||
enum simpson maggie
|
||||
enum simpson snowball_ii
|
||||
|
||||
@@ -24,7 +24,9 @@
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
|
||||
#pragma ident "%Z%%M% %I% %E% SMI"
|
||||
/*
|
||||
* Copyright (c) 2012 by Delphix. All rights reserved.
|
||||
*/
|
||||
|
||||
/*
|
||||
* ASSERTION:
|
||||
@@ -39,7 +41,7 @@
|
||||
*/
|
||||
|
||||
|
||||
#pragma D option bufsize=16
|
||||
#pragma D option bufsize=32
|
||||
#pragma D option bufpolicy=ring
|
||||
#pragma D option statusrate=1nsec
|
||||
|
||||
|
||||
@@ -26,26 +26,24 @@
|
||||
|
||||
#pragma ident "%Z%%M% %I% %E% SMI"
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/sysctl.h>
|
||||
|
||||
#include <err.h>
|
||||
#include <unistd.h>
|
||||
#ifndef __FreeBSD__
|
||||
#include <sys/uadmin.h>
|
||||
#endif
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
#ifdef __FreeBSD__
|
||||
return (1);
|
||||
#else
|
||||
int val = 1;
|
||||
|
||||
while (1) {
|
||||
if (uadmin(A_SDTTEST, 0, 0) < 0) {
|
||||
perror("uadmin");
|
||||
return (1);
|
||||
}
|
||||
if (sysctlbyname("debug.dtracetest.sdttest", NULL, NULL, &val,
|
||||
sizeof(val)))
|
||||
err(1, "sysctlbyname");
|
||||
|
||||
sleep(1);
|
||||
}
|
||||
|
||||
return (0);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ ERROR
|
||||
exit(1);
|
||||
}
|
||||
|
||||
sdt:::test
|
||||
test:::sdttest
|
||||
/arg0 != 1 || arg1 != 2 || arg2 != 3 || arg3 != 4 || arg4 != 5 || arg5 != 6 ||
|
||||
arg6 != 7/
|
||||
{
|
||||
@@ -54,7 +54,7 @@ sdt:::test
|
||||
exit(1);
|
||||
}
|
||||
|
||||
sdt:::test
|
||||
test:::sdttest
|
||||
{
|
||||
exit(0);
|
||||
}
|
||||
|
||||
+3
-1
@@ -24,7 +24,9 @@
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
|
||||
#pragma ident "%Z%%M% %I% %E% SMI"
|
||||
/*
|
||||
* Copyright (c) 2012 by Delphix. All rights reserved.
|
||||
*/
|
||||
|
||||
/*
|
||||
* ASSERTION:
|
||||
|
||||
+2
-5
@@ -24,10 +24,7 @@
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2012 by Delphix. All rights reserved.
|
||||
*/
|
||||
|
||||
#pragma ident "%Z%%M% %I% %E% SMI"
|
||||
/*
|
||||
* ASSERTION:
|
||||
* Verify the behavior of speculations with changes in specsize.
|
||||
@@ -38,7 +35,7 @@
|
||||
*/
|
||||
|
||||
#pragma D option quiet
|
||||
#pragma D option specsize=48
|
||||
#pragma D option specsize=40
|
||||
|
||||
BEGIN
|
||||
{
|
||||
|
||||
@@ -24,8 +24,9 @@
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
|
||||
#pragma ident "%Z%%M% %I% %E% SMI"
|
||||
|
||||
/*
|
||||
* Copyright (c) 2012 by Delphix. All rights reserved.
|
||||
*/
|
||||
|
||||
/*
|
||||
* ASSERTION:
|
||||
@@ -39,3 +40,8 @@ BEGIN
|
||||
|
||||
trace();
|
||||
}
|
||||
|
||||
BEGIN
|
||||
{
|
||||
exit(0);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* CDDL HEADER START
|
||||
*
|
||||
* This file and its contents are supplied under the terms of the
|
||||
* Common Development and Distribution License ("CDDL"), version 1.0.
|
||||
* You may only use this file in accordance with the terms of version
|
||||
* 1.0 of the CDDL.
|
||||
*
|
||||
* A full copy of the text of the CDDL should have accompanied this
|
||||
* source. A copy of the CDDL is also available via the Internet at
|
||||
* http://www.illumos.org/license/CDDL.
|
||||
*
|
||||
* CDDL HEADER END
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2012 by Delphix. All rights reserved.
|
||||
*/
|
||||
|
||||
BEGIN
|
||||
{
|
||||
@ = count();
|
||||
trace(@);
|
||||
}
|
||||
|
||||
BEGIN
|
||||
{
|
||||
exit(0);
|
||||
}
|
||||
@@ -24,7 +24,9 @@
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
|
||||
#pragma ident "%Z%%M% %I% %E% SMI"
|
||||
/*
|
||||
* Copyright (c) 2012 by Delphix. All rights reserved.
|
||||
*/
|
||||
|
||||
/*
|
||||
* ASSERTION:
|
||||
@@ -37,3 +39,8 @@ BEGIN
|
||||
{
|
||||
trace((void)`kmem_flags);
|
||||
}
|
||||
|
||||
BEGIN
|
||||
{
|
||||
exit(0);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* CDDL HEADER START
|
||||
*
|
||||
* This file and its contents are supplied under the terms of the
|
||||
* Common Development and Distribution License ("CDDL"), version 1.0.
|
||||
* You may only use this file in accordance with the terms of version
|
||||
* 1.0 of the CDDL.
|
||||
*
|
||||
* A full copy of the text of the CDDL should have accompanied this
|
||||
* source. A copy of the CDDL is also available via the Internet at
|
||||
* http://www.illumos.org/license/CDDL.
|
||||
*
|
||||
* CDDL HEADER END
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2012 by Delphix. All rights reserved.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Make sure we can scope types with modifiers.
|
||||
*/
|
||||
|
||||
BEGIN
|
||||
{
|
||||
trace((D`int *)0);
|
||||
trace((const D`int *)0);
|
||||
exit(0);
|
||||
}
|
||||
@@ -28,6 +28,7 @@
|
||||
* Copyright (c) 2011-2012 Pawel Jakub Dawidek <pawel@dawidek.net>.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2012 Martin Matuska <mm@FreeBSD.org>. All rights reserved.
|
||||
* Copyright (c) 2013 Steven Hartland. All rights reserved.
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
@@ -56,6 +57,7 @@
|
||||
#include <sys/fs/zfs.h>
|
||||
#include <sys/types.h>
|
||||
#include <time.h>
|
||||
#include <err.h>
|
||||
|
||||
#include <libzfs.h>
|
||||
#include <libzfs_core.h>
|
||||
@@ -3529,6 +3531,12 @@ zfs_snapshot_cb(zfs_handle_t *zhp, void *arg)
|
||||
int rv = 0;
|
||||
int error;
|
||||
|
||||
if (sd->sd_recursive &&
|
||||
zfs_prop_get_int(zhp, ZFS_PROP_INCONSISTENT) != 0) {
|
||||
zfs_close(zhp);
|
||||
return (0);
|
||||
}
|
||||
|
||||
error = asprintf(&name, "%s@%s", zfs_get_name(zhp), sd->sd_snapname);
|
||||
if (error == -1)
|
||||
nomem();
|
||||
@@ -5233,8 +5241,7 @@ zfs_do_hold_rele_impl(int argc, char **argv, boolean_t holding)
|
||||
continue;
|
||||
}
|
||||
if (holding) {
|
||||
if (zfs_hold(zhp, delim+1, tag, recursive,
|
||||
B_FALSE, -1) != 0)
|
||||
if (zfs_hold(zhp, delim+1, tag, recursive, -1) != 0)
|
||||
++errors;
|
||||
} else {
|
||||
if (zfs_release(zhp, delim+1, tag, recursive) != 0)
|
||||
@@ -5601,8 +5608,8 @@ share_mount_one(zfs_handle_t *zhp, int op, int flags, char *protocol,
|
||||
|
||||
(void) fprintf(stderr, gettext("cannot share '%s': "
|
||||
"legacy share\n"), zfs_get_name(zhp));
|
||||
(void) fprintf(stderr, gettext("use share(1M) to "
|
||||
"share this filesystem, or set "
|
||||
(void) fprintf(stderr, gettext("to "
|
||||
"share this filesystem set "
|
||||
"sharenfs property on\n"));
|
||||
return (1);
|
||||
}
|
||||
@@ -5618,7 +5625,7 @@ share_mount_one(zfs_handle_t *zhp, int op, int flags, char *protocol,
|
||||
|
||||
(void) fprintf(stderr, gettext("cannot %s '%s': "
|
||||
"legacy mountpoint\n"), cmdname, zfs_get_name(zhp));
|
||||
(void) fprintf(stderr, gettext("use %s(1M) to "
|
||||
(void) fprintf(stderr, gettext("use %s(8) to "
|
||||
"%s this filesystem\n"), cmdname, cmdname);
|
||||
return (1);
|
||||
}
|
||||
@@ -6056,8 +6063,10 @@ unshare_unmount_path(int op, char *path, int flags, boolean_t is_manual)
|
||||
strcmp(smbshare_prop, "off") == 0) {
|
||||
(void) fprintf(stderr, gettext("cannot unshare "
|
||||
"'%s': legacy share\n"), path);
|
||||
#ifdef illumos
|
||||
(void) fprintf(stderr, gettext("use "
|
||||
"unshare(1M) to unshare this filesystem\n"));
|
||||
#endif
|
||||
} else if (!zfs_is_shared(zhp)) {
|
||||
(void) fprintf(stderr, gettext("cannot unshare '%s': "
|
||||
"not currently shared\n"), path);
|
||||
@@ -6076,7 +6085,7 @@ unshare_unmount_path(int op, char *path, int flags, boolean_t is_manual)
|
||||
(void) fprintf(stderr, gettext("cannot unmount "
|
||||
"'%s': legacy mountpoint\n"),
|
||||
zfs_get_name(zhp));
|
||||
(void) fprintf(stderr, gettext("use umount(1M) "
|
||||
(void) fprintf(stderr, gettext("use umount(8) "
|
||||
"to unmount this filesystem\n"));
|
||||
} else {
|
||||
ret = zfs_unmountall(zhp, flags);
|
||||
@@ -6298,9 +6307,11 @@ unshare_unmount(int op, int argc, char **argv)
|
||||
(void) fprintf(stderr, gettext("cannot "
|
||||
"unshare '%s': legacy share\n"),
|
||||
zfs_get_name(zhp));
|
||||
#ifdef illumos
|
||||
(void) fprintf(stderr, gettext("use "
|
||||
"unshare(1M) to unshare this "
|
||||
"filesystem\n"));
|
||||
#endif
|
||||
ret = 1;
|
||||
} else if (!zfs_is_shared(zhp)) {
|
||||
(void) fprintf(stderr, gettext("cannot "
|
||||
@@ -6318,7 +6329,7 @@ unshare_unmount(int op, int argc, char **argv)
|
||||
"unmount '%s': legacy "
|
||||
"mountpoint\n"), zfs_get_name(zhp));
|
||||
(void) fprintf(stderr, gettext("use "
|
||||
"umount(1M) to unmount this "
|
||||
"umount(8) to unmount this "
|
||||
"filesystem\n"));
|
||||
ret = 1;
|
||||
} else if (!zfs_is_mounted(zhp, NULL)) {
|
||||
@@ -6504,12 +6515,12 @@ manual_mount(int argc, char **argv)
|
||||
}
|
||||
} else {
|
||||
(void) fprintf(stderr, gettext("filesystem '%s' cannot be "
|
||||
"mounted using 'mount -F zfs'\n"), dataset);
|
||||
"mounted using 'mount -t zfs'\n"), dataset);
|
||||
(void) fprintf(stderr, gettext("Use 'zfs set mountpoint=%s' "
|
||||
"instead.\n"), path);
|
||||
(void) fprintf(stderr, gettext("If you must use 'mount -F zfs' "
|
||||
"or /etc/vfstab, use 'zfs set mountpoint=legacy'.\n"));
|
||||
(void) fprintf(stderr, gettext("See zfs(1M) for more "
|
||||
(void) fprintf(stderr, gettext("If you must use 'mount -t zfs' "
|
||||
"or /etc/fstab, use 'zfs set mountpoint=legacy'.\n"));
|
||||
(void) fprintf(stderr, gettext("See zfs(8) for more "
|
||||
"information.\n"));
|
||||
ret = 1;
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
|
||||
/*
|
||||
* Copyright (c) 2012 by Delphix. All rights reserved.
|
||||
* Copyright (c) 2013 Steven Hartland. All rights reserved.
|
||||
*/
|
||||
|
||||
/*
|
||||
@@ -153,7 +154,7 @@ import_pool(const char *target, boolean_t readonly)
|
||||
g_importargs.poolname = g_pool;
|
||||
pools = zpool_search_import(g_zfs, &g_importargs);
|
||||
|
||||
if (pools == NULL || nvlist_next_nvpair(pools, NULL) == NULL) {
|
||||
if (nvlist_empty(pools)) {
|
||||
if (!g_importargs.can_be_active) {
|
||||
g_importargs.can_be_active = B_TRUE;
|
||||
if (zpool_search_import(g_zfs, &g_importargs) != NULL ||
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
* Copyright (c) 2012 by Delphix. All rights reserved.
|
||||
* Copyright (c) 2012 by Frederik Wessels. All rights reserved.
|
||||
* Copyright (c) 2012 Martin Matuska <mm@FreeBSD.org>. All rights reserved.
|
||||
* Copyright (c) 2013 by Prasad Joshi (sTec). All rights reserved.
|
||||
*/
|
||||
|
||||
#include <solaris.h>
|
||||
@@ -804,6 +805,7 @@ zpool_do_create(int argc, char **argv)
|
||||
goto errout;
|
||||
break;
|
||||
case 'm':
|
||||
/* Equivalent to -O mountpoint=optarg */
|
||||
mountpoint = optarg;
|
||||
break;
|
||||
case 'o':
|
||||
@@ -842,8 +844,18 @@ zpool_do_create(int argc, char **argv)
|
||||
*propval = '\0';
|
||||
propval++;
|
||||
|
||||
if (add_prop_list(optarg, propval, &fsprops, B_FALSE))
|
||||
/*
|
||||
* Mountpoints are checked and then added later.
|
||||
* Uniquely among properties, they can be specified
|
||||
* more than once, to avoid conflict with -m.
|
||||
*/
|
||||
if (0 == strcmp(optarg,
|
||||
zfs_prop_to_name(ZFS_PROP_MOUNTPOINT))) {
|
||||
mountpoint = propval;
|
||||
} else if (add_prop_list(optarg, propval, &fsprops,
|
||||
B_FALSE)) {
|
||||
goto errout;
|
||||
}
|
||||
break;
|
||||
case ':':
|
||||
(void) fprintf(stderr, gettext("missing argument for "
|
||||
@@ -961,6 +973,18 @@ zpool_do_create(int argc, char **argv)
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Now that the mountpoint's validity has been checked, ensure that
|
||||
* the property is set appropriately prior to creating the pool.
|
||||
*/
|
||||
if (mountpoint != NULL) {
|
||||
ret = add_prop_list(zfs_prop_to_name(ZFS_PROP_MOUNTPOINT),
|
||||
mountpoint, &fsprops, B_FALSE);
|
||||
if (ret != 0)
|
||||
goto errout;
|
||||
}
|
||||
|
||||
ret = 1;
|
||||
if (dryrun) {
|
||||
/*
|
||||
* For a dry run invocation, print out a basic message and run
|
||||
@@ -995,21 +1019,19 @@ zpool_do_create(int argc, char **argv)
|
||||
if (nvlist_exists(props, propname))
|
||||
continue;
|
||||
|
||||
if (add_prop_list(propname, ZFS_FEATURE_ENABLED,
|
||||
&props, B_TRUE) != 0)
|
||||
ret = add_prop_list(propname,
|
||||
ZFS_FEATURE_ENABLED, &props, B_TRUE);
|
||||
if (ret != 0)
|
||||
goto errout;
|
||||
}
|
||||
}
|
||||
|
||||
ret = 1;
|
||||
if (zpool_create(g_zfs, poolname,
|
||||
nvroot, props, fsprops) == 0) {
|
||||
zfs_handle_t *pool = zfs_open(g_zfs, poolname,
|
||||
ZFS_TYPE_FILESYSTEM);
|
||||
if (pool != NULL) {
|
||||
if (mountpoint != NULL)
|
||||
verify(zfs_prop_set(pool,
|
||||
zfs_prop_to_name(
|
||||
ZFS_PROP_MOUNTPOINT),
|
||||
mountpoint) == 0);
|
||||
if (zfs_mount(pool, NULL, 0) == 0)
|
||||
ret = zfs_shareall(pool);
|
||||
zfs_close(pool);
|
||||
@@ -1274,12 +1296,13 @@ print_status_config(zpool_handle_t *zhp, const char *name, nvlist_t *nv,
|
||||
int namewidth, int depth, boolean_t isspare)
|
||||
{
|
||||
nvlist_t **child;
|
||||
uint_t c, children;
|
||||
uint_t c, vsc, children;
|
||||
pool_scan_stat_t *ps = NULL;
|
||||
vdev_stat_t *vs;
|
||||
char rbuf[6], wbuf[6], cbuf[6];
|
||||
char *vname;
|
||||
uint64_t notpresent;
|
||||
uint64_t ashift;
|
||||
spare_cbdata_t cb;
|
||||
const char *state;
|
||||
|
||||
@@ -1288,7 +1311,7 @@ print_status_config(zpool_handle_t *zhp, const char *name, nvlist_t *nv,
|
||||
children = 0;
|
||||
|
||||
verify(nvlist_lookup_uint64_array(nv, ZPOOL_CONFIG_VDEV_STATS,
|
||||
(uint64_t **)&vs, &c) == 0);
|
||||
(uint64_t **)&vs, &vsc) == 0);
|
||||
|
||||
state = zpool_state_to_name(vs->vs_state, vs->vs_aux);
|
||||
if (isspare) {
|
||||
@@ -1342,6 +1365,10 @@ print_status_config(zpool_handle_t *zhp, const char *name, nvlist_t *nv,
|
||||
(void) printf(gettext("unsupported feature(s)"));
|
||||
break;
|
||||
|
||||
case VDEV_AUX_ASHIFT_TOO_BIG:
|
||||
(void) printf(gettext("unsupported minimum blocksize"));
|
||||
break;
|
||||
|
||||
case VDEV_AUX_SPARED:
|
||||
verify(nvlist_lookup_uint64(nv, ZPOOL_CONFIG_GUID,
|
||||
&cb.cb_guid) == 0);
|
||||
@@ -1384,6 +1411,12 @@ print_status_config(zpool_handle_t *zhp, const char *name, nvlist_t *nv,
|
||||
(void) printf(gettext("corrupted data"));
|
||||
break;
|
||||
}
|
||||
} else if (children == 0 && !isspare &&
|
||||
VDEV_STAT_VALID(vs_physical_ashift, vsc) &&
|
||||
vs->vs_configured_ashift < vs->vs_physical_ashift) {
|
||||
(void) printf(
|
||||
gettext(" block size: %dB configured, %dB native"),
|
||||
1 << vs->vs_configured_ashift, 1 << vs->vs_physical_ashift);
|
||||
}
|
||||
|
||||
(void) nvlist_lookup_uint64_array(nv, ZPOOL_CONFIG_SCAN_STATS,
|
||||
@@ -2096,8 +2129,10 @@ zpool_do_import(int argc, char **argv)
|
||||
|
||||
errno = 0;
|
||||
searchguid = strtoull(argv[0], &endptr, 10);
|
||||
if (errno != 0 || *endptr != '\0')
|
||||
if (errno != 0 || *endptr != '\0') {
|
||||
searchname = argv[0];
|
||||
searchguid = 0;
|
||||
}
|
||||
found_config = NULL;
|
||||
|
||||
/*
|
||||
@@ -3976,7 +4011,7 @@ print_dedup_stats(nvlist_t *config)
|
||||
|
||||
/*
|
||||
* If the pool was faulted then we may not have been able to
|
||||
* obtain the config. Otherwise, if have anything in the dedup
|
||||
* obtain the config. Otherwise, if we have anything in the dedup
|
||||
* table continue processing the stats.
|
||||
*/
|
||||
if (nvlist_lookup_uint64_array(config, ZPOOL_CONFIG_DDT_OBJ_STATS,
|
||||
@@ -4247,6 +4282,15 @@ status_callback(zpool_handle_t *zhp, void *data)
|
||||
"'zpool clear'.\n"));
|
||||
break;
|
||||
|
||||
case ZPOOL_STATUS_NON_NATIVE_ASHIFT:
|
||||
(void) printf(gettext("status: One or more devices are "
|
||||
"configured to use a non-native block size.\n"
|
||||
"\tExpect reduced performance.\n"));
|
||||
(void) printf(gettext("action: Replace affected devices with "
|
||||
"devices that support the\n\tconfigured block size, or "
|
||||
"migrate data to a properly configured\n\tpool.\n"));
|
||||
break;
|
||||
|
||||
default:
|
||||
/*
|
||||
* The remaining errors can't actually be generated, yet.
|
||||
@@ -5323,10 +5367,9 @@ main(int argc, char **argv)
|
||||
* 'freeze' is a vile debugging abomination, so we treat
|
||||
* it as such.
|
||||
*/
|
||||
char buf[16384];
|
||||
int fd = open(ZFS_DEV, O_RDWR);
|
||||
(void) strcpy((void *)buf, argv[2]);
|
||||
return (!!ioctl(fd, ZFS_IOC_POOL_FREEZE, buf));
|
||||
zfs_cmd_t zc = { 0 };
|
||||
(void) strlcpy(zc.zc_name, argv[2], sizeof (zc.zc_name));
|
||||
return (!!zfs_ioctl(g_zfs, ZFS_IOC_POOL_FREEZE, &zc));
|
||||
} else {
|
||||
(void) fprintf(stderr, gettext("unrecognized "
|
||||
"command '%s'\n"), cmdname);
|
||||
|
||||
@@ -20,9 +20,10 @@
|
||||
*/
|
||||
/*
|
||||
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2012 by Delphix. All rights reserved.
|
||||
* Copyright (c) 2013 by Delphix. All rights reserved.
|
||||
* Copyright 2011 Nexenta Systems, Inc. All rights reserved.
|
||||
* Copyright (c) 2012 Martin Matuska <mm@FreeBSD.org>. All rights reserved.
|
||||
* Copyright (c) 2013 Steven Hartland. All rights reserved.
|
||||
*/
|
||||
|
||||
/*
|
||||
@@ -185,6 +186,7 @@ static const ztest_shared_opts_t ztest_opts_defaults = {
|
||||
|
||||
extern uint64_t metaslab_gang_bang;
|
||||
extern uint64_t metaslab_df_alloc_threshold;
|
||||
extern uint64_t zfs_deadman_synctime;
|
||||
|
||||
static ztest_shared_opts_t *ztest_shared_opts;
|
||||
static ztest_shared_opts_t ztest_opts;
|
||||
@@ -364,7 +366,7 @@ ztest_info_t ztest_info[] = {
|
||||
{ ztest_fault_inject, 1, &zopt_sometimes },
|
||||
{ ztest_ddt_repair, 1, &zopt_sometimes },
|
||||
{ ztest_dmu_snapshot_hold, 1, &zopt_sometimes },
|
||||
{ ztest_reguid, 1, &zopt_sometimes },
|
||||
{ ztest_reguid, 1, &zopt_rarely },
|
||||
{ ztest_spa_rename, 1, &zopt_rarely },
|
||||
{ ztest_scrub, 1, &zopt_rarely },
|
||||
{ ztest_spa_upgrade, 1, &zopt_rarely },
|
||||
@@ -767,6 +769,16 @@ ztest_kill(ztest_shared_t *zs)
|
||||
{
|
||||
zs->zs_alloc = metaslab_class_get_alloc(spa_normal_class(ztest_spa));
|
||||
zs->zs_space = metaslab_class_get_space(spa_normal_class(ztest_spa));
|
||||
|
||||
/*
|
||||
* Before we kill off ztest, make sure that the config is updated.
|
||||
* See comment above spa_config_sync().
|
||||
*/
|
||||
mutex_enter(&spa_namespace_lock);
|
||||
spa_config_sync(ztest_spa, B_FALSE, B_FALSE);
|
||||
mutex_exit(&spa_namespace_lock);
|
||||
|
||||
zfs_dbgmsg_print(FTAG);
|
||||
(void) kill(getpid(), SIGKILL);
|
||||
}
|
||||
|
||||
@@ -2731,7 +2743,7 @@ ztest_vdev_attach_detach(ztest_ds_t *zd, uint64_t id)
|
||||
uint64_t leaf, top;
|
||||
uint64_t ashift = ztest_get_ashift();
|
||||
uint64_t oldguid, pguid;
|
||||
size_t oldsize, newsize;
|
||||
uint64_t oldsize, newsize;
|
||||
char oldpath[MAXPATHLEN], newpath[MAXPATHLEN];
|
||||
int replacing;
|
||||
int oldvd_has_siblings = B_FALSE;
|
||||
@@ -2890,8 +2902,8 @@ ztest_vdev_attach_detach(ztest_ds_t *zd, uint64_t id)
|
||||
if (error != expected_error && expected_error != EBUSY) {
|
||||
fatal(0, "attach (%s %llu, %s %llu, %d) "
|
||||
"returned %d, expected %d",
|
||||
oldpath, (longlong_t)oldsize, newpath,
|
||||
(longlong_t)newsize, replacing, error, expected_error);
|
||||
oldpath, oldsize, newpath,
|
||||
newsize, replacing, error, expected_error);
|
||||
}
|
||||
|
||||
VERIFY(mutex_unlock(&ztest_vdev_lock) == 0);
|
||||
@@ -3605,6 +3617,9 @@ ztest_dmu_read_write(ztest_ds_t *zd, uint64_t id)
|
||||
else
|
||||
dmu_tx_hold_write(tx, bigobj, bigoff, bigsize);
|
||||
|
||||
/* This accounts for setting the checksum/compression. */
|
||||
dmu_tx_hold_bonus(tx, bigobj);
|
||||
|
||||
txg = ztest_tx_assign(tx, TXG_MIGHTWAIT, FTAG);
|
||||
if (txg == 0) {
|
||||
umem_free(packbuf, packsize);
|
||||
@@ -4509,7 +4524,7 @@ ztest_dmu_commit_callbacks(ztest_ds_t *zd, uint64_t id)
|
||||
*/
|
||||
tmp_cb = list_head(&zcl.zcl_callbacks);
|
||||
if (tmp_cb != NULL &&
|
||||
tmp_cb->zcd_txg > txg - ZTEST_COMMIT_CALLBACK_THRESH) {
|
||||
(txg - ZTEST_COMMIT_CALLBACK_THRESH) > tmp_cb->zcd_txg) {
|
||||
fatal(0, "Commit callback threshold exceeded, oldest txg: %"
|
||||
PRIu64 ", open txg: %" PRIu64 "\n", tmp_cb->zcd_txg, txg);
|
||||
}
|
||||
@@ -4713,7 +4728,7 @@ ztest_dmu_snapshot_hold(ztest_ds_t *zd, uint64_t id)
|
||||
|
||||
error = user_release_one(fullname, tag);
|
||||
if (error)
|
||||
fatal(0, "user_release_one(%s)", fullname, tag);
|
||||
fatal(0, "user_release_one(%s, %s) = %d", fullname, tag, error);
|
||||
|
||||
VERIFY3U(dmu_objset_hold(fullname, FTAG, &origin), ==, ENOENT);
|
||||
|
||||
@@ -4754,6 +4769,14 @@ ztest_fault_inject(ztest_ds_t *zd, uint64_t id)
|
||||
|
||||
ASSERT(leaves >= 1);
|
||||
|
||||
/*
|
||||
* Grab the name lock as reader. There are some operations
|
||||
* which don't like to have their vdevs changed while
|
||||
* they are in progress (i.e. spa_change_guid). Those
|
||||
* operations will have grabbed the name lock as writer.
|
||||
*/
|
||||
(void) rw_rdlock(&ztest_name_lock);
|
||||
|
||||
/*
|
||||
* We need SCL_STATE here because we're going to look at vd0->vdev_tsd.
|
||||
*/
|
||||
@@ -4783,7 +4806,14 @@ ztest_fault_inject(ztest_ds_t *zd, uint64_t id)
|
||||
if (vd0 != NULL && vd0->vdev_top->vdev_islog)
|
||||
islog = B_TRUE;
|
||||
|
||||
if (vd0 != NULL && maxfaults != 1) {
|
||||
/*
|
||||
* If the top-level vdev needs to be resilvered
|
||||
* then we only allow faults on the device that is
|
||||
* resilvering.
|
||||
*/
|
||||
if (vd0 != NULL && maxfaults != 1 &&
|
||||
(!vdev_resilver_needed(vd0->vdev_top, NULL, NULL) ||
|
||||
vd0->vdev_resilver_txg != 0)) {
|
||||
/*
|
||||
* Make vd0 explicitly claim to be unreadable,
|
||||
* or unwriteable, or reach behind its back
|
||||
@@ -4814,6 +4844,7 @@ ztest_fault_inject(ztest_ds_t *zd, uint64_t id)
|
||||
|
||||
if (sav->sav_count == 0) {
|
||||
spa_config_exit(spa, SCL_STATE, FTAG);
|
||||
(void) rw_unlock(&ztest_name_lock);
|
||||
return;
|
||||
}
|
||||
vd0 = sav->sav_vdevs[ztest_random(sav->sav_count)];
|
||||
@@ -4827,6 +4858,7 @@ ztest_fault_inject(ztest_ds_t *zd, uint64_t id)
|
||||
}
|
||||
|
||||
spa_config_exit(spa, SCL_STATE, FTAG);
|
||||
(void) rw_unlock(&ztest_name_lock);
|
||||
|
||||
/*
|
||||
* If we can tolerate two or more faults, or we're dealing
|
||||
@@ -5292,16 +5324,33 @@ static void *
|
||||
ztest_deadman_thread(void *arg)
|
||||
{
|
||||
ztest_shared_t *zs = arg;
|
||||
int grace = 300;
|
||||
hrtime_t delta;
|
||||
spa_t *spa = ztest_spa;
|
||||
hrtime_t delta, total = 0;
|
||||
|
||||
delta = (zs->zs_thread_stop - zs->zs_thread_start) / NANOSEC + grace;
|
||||
for (;;) {
|
||||
delta = (zs->zs_thread_stop - zs->zs_thread_start) /
|
||||
NANOSEC + zfs_deadman_synctime;
|
||||
|
||||
(void) poll(NULL, 0, (int)(1000 * delta));
|
||||
(void) poll(NULL, 0, (int)(1000 * delta));
|
||||
|
||||
fatal(0, "failed to complete within %d seconds of deadline", grace);
|
||||
/*
|
||||
* If the pool is suspended then fail immediately. Otherwise,
|
||||
* check to see if the pool is making any progress. If
|
||||
* vdev_deadman() discovers that there hasn't been any recent
|
||||
* I/Os then it will end up aborting the tests.
|
||||
*/
|
||||
if (spa_suspended(spa)) {
|
||||
fatal(0, "aborting test after %llu seconds because "
|
||||
"pool has transitioned to a suspended state.",
|
||||
zfs_deadman_synctime);
|
||||
return (NULL);
|
||||
}
|
||||
vdev_deadman(spa->spa_root_vdev);
|
||||
|
||||
return (NULL);
|
||||
total += zfs_deadman_synctime;
|
||||
(void) printf("ztest has been running for %lld seconds\n",
|
||||
total);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -5615,6 +5664,7 @@ ztest_run(ztest_shared_t *zs)
|
||||
|
||||
zs->zs_alloc = metaslab_class_get_alloc(spa_normal_class(spa));
|
||||
zs->zs_space = metaslab_class_get_space(spa_normal_class(spa));
|
||||
zfs_dbgmsg_print(FTAG);
|
||||
|
||||
umem_free(tid, ztest_opts.zo_threads * sizeof (thread_t));
|
||||
|
||||
@@ -6030,6 +6080,7 @@ main(int argc, char **argv)
|
||||
(void) setvbuf(stdout, NULL, _IOLBF, 0);
|
||||
|
||||
dprintf_setup(&argc, argv);
|
||||
zfs_deadman_synctime = 300;
|
||||
|
||||
ztest_fd_rand = open("/dev/urandom", O_RDONLY);
|
||||
ASSERT3S(ztest_fd_rand, >=, 0);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user