Sync from head

This commit is contained in:
Simon J. Gerraty
2012-11-04 02:52:03 +00:00
9137 changed files with 1010448 additions and 342617 deletions
+5 -19
View File
@@ -3,7 +3,7 @@ $FreeBSD$
Please note that the content of this file is strictly advisory. Please note that the content of this file is strictly advisory.
No locks listed here are valid. The only strict review requirements No locks listed here are valid. The only strict review requirements
are granted by core. These are documented in head/LOCKS and enforced are granted by core. These are documented in head/LOCKS and enforced
by CVSROOT/approvers. by svnadmin/conf/approvers.
The source tree is a community effort. However, some folks go to the The source tree is a community effort. However, some folks go to the
trouble of looking after particular areas of the tree. In return for trouble of looking after particular areas of the tree. In return for
@@ -21,7 +21,6 @@ It is not a registry of 'turf' or private property.
subsystem login notes subsystem login notes
----------------------------- -----------------------------
kqueue jmg Pre-commit review requested. kqueue jmg Pre-commit review requested.
mergemaster dougb Prefers to pre-approve commits
libc/posix1e rwatson Pre-commit review requested. libc/posix1e rwatson Pre-commit review requested.
POSIX.1e ACLs rwatson Pre-commit review requested. POSIX.1e ACLs rwatson Pre-commit review requested.
UFS EAs rwatson Pre-commit review requested. UFS EAs rwatson Pre-commit review requested.
@@ -75,8 +74,6 @@ drm rnoland Just keep me informed of changes, try not to break it.
unifdef(1) fanf Pre-commit review requested. unifdef(1) fanf Pre-commit review requested.
ntp roberto Pre-commit review requested. ntp roberto Pre-commit review requested.
inetd dwmalone Recommends pre-commit review. inetd dwmalone Recommends pre-commit review.
nwfs bp In case of functional changes pre-commit review
requested.
contrib/smbfs bp Open for in-tree committs. In case of functional contrib/smbfs bp Open for in-tree committs. In case of functional
changes pre-commit review requested. changes pre-commit review requested.
contrib/pf mlaier Pre-commit review requested. contrib/pf mlaier Pre-commit review requested.
@@ -101,8 +98,6 @@ nfs alfred Will be happy to review code, but not mandatory.
rpc.lockd alfred Will be happy to review code, but not mandatory. rpc.lockd alfred Will be happy to review code, but not mandatory.
truss alfred Will be happy to review code, but not mandatory. truss alfred Will be happy to review code, but not mandatory.
rpc alfred Pre-commit review requested. rpc alfred Pre-commit review requested.
xfs kan@FreeBSD.org,rodrigc@FreeBSD.org,cattelan@xfs.org
Pre-commit review preferred.
pkg_install portmgr Pre-commit review or approval from portmgr@ requested. pkg_install portmgr Pre-commit review or approval from portmgr@ requested.
linux emul emulation Please discuss changes here. linux emul emulation Please discuss changes here.
bs{diff,patch} cperciva Pre-commit review requested. bs{diff,patch} cperciva Pre-commit review requested.
@@ -125,16 +120,7 @@ lib/libc/stdtime edwin Heads-up appreciated, since parts of this code
is maintained by a third party source. is maintained by a third party source.
sbin/routed bms Pre-commit review; notify vendor at rhyolite.com sbin/routed bms Pre-commit review; notify vendor at rhyolite.com
isci(4) jimharris Pre-commit review requested. isci(4) jimharris Pre-commit review requested.
3dfx cokane Pre-commit review preferred.
Following are the entries from the Makefiles, and a few other sources. cmx daniel@roe.ch Pre-commit review preferred.
Please remove stale entries from both their origin, and this file. filemon obrien Pre-commit review preferred.
sysdoc trhodes Pre-commit review preferred.
Please also consider removing the lines from the files listed below and
stating your preferences here instead.
List below generated with:
$ cd /usr/src; find */* -type f|xargs egrep 'MAINTAINER[ <tab>]*='
sys/modules/3dfx/Makefile:MAINTAINER= cokane@FreeBSD.org
sys/modules/urio/Makefile:MAINTAINER= Iwasa Kazmi <kzmi@ca2.so-net.ne.jp>
tools/tools/sysdoc/Makefile:MAINTAINER= trhodes@FreeBSD.org
+13 -19
View File
@@ -92,7 +92,7 @@ TGTS= all all-man buildenv buildenvvars buildkernel buildworld \
delete-old delete-old-dirs delete-old-files delete-old-libs \ delete-old delete-old-dirs delete-old-files delete-old-libs \
depend distribute distributekernel distributekernel.debug \ depend distribute distributekernel distributekernel.debug \
distributeworld distrib-dirs distribution doxygen \ distributeworld distrib-dirs distribution doxygen \
everything hierarchy install installcheck installkernel \ everything hier hierarchy install installcheck installkernel \
installkernel.debug packagekernel packageworld \ installkernel.debug packagekernel packageworld \
reinstallkernel reinstallkernel.debug \ reinstallkernel reinstallkernel.debug \
installworld kernel-toolchain libraries lint maninstall \ installworld kernel-toolchain libraries lint maninstall \
@@ -124,9 +124,9 @@ _MAKEOBJDIRPREFIX!= /usr/bin/env -i PATH=${PATH} ${MAKE} \
.error MAKEOBJDIRPREFIX can only be set in environment, not as a global\ .error MAKEOBJDIRPREFIX can only be set in environment, not as a global\
(in make.conf(5)) or command-line variable. (in make.conf(5)) or command-line variable.
.endif .endif
MAKEPATH= ${MAKEOBJDIRPREFIX}${.CURDIR}/${MAKE:T}.${MACHINE} MAKEPATH= ${MAKEOBJDIRPREFIX}${.CURDIR}/make.${MACHINE}
BINMAKE= \ BINMAKE= \
`if [ -x ${MAKEPATH}/${MAKE:T} ]; then echo ${MAKEPATH}/${MAKE:T}; else echo ${MAKE}; fi` \ `if [ -x ${MAKEPATH}/make ]; then echo ${MAKEPATH}/make; else echo ${MAKE}; fi` \
-m ${.CURDIR}/share/mk -m ${.CURDIR}/share/mk
_MAKE= PATH=${PATH} ${BINMAKE} -f Makefile.inc1 TARGET=${_TARGET} TARGET_ARCH=${_TARGET_ARCH} _MAKE= PATH=${PATH} ${BINMAKE} -f Makefile.inc1 TARGET=${_TARGET} TARGET_ARCH=${_TARGET_ARCH}
@@ -135,7 +135,7 @@ _MAKE= PATH=${PATH} ${BINMAKE} -f Makefile.inc1 TARGET=${_TARGET} TARGET_ARCH=${
_TARGET_ARCH= ${TARGET:S/pc98/i386/} _TARGET_ARCH= ${TARGET:S/pc98/i386/}
.elif !defined(TARGET) && defined(TARGET_ARCH) && \ .elif !defined(TARGET) && defined(TARGET_ARCH) && \
${TARGET_ARCH} != ${MACHINE_ARCH} ${TARGET_ARCH} != ${MACHINE_ARCH}
_TARGET= ${TARGET_ARCH:C/mips(n32|64)?(el)?/mips/:C/armeb/arm/} _TARGET= ${TARGET_ARCH:C/mips(n32|64)?(el)?/mips/:C/arm(v6)?(eb)?/arm/}
.endif .endif
# Legacy names, for another transition period mips:mips(n32|64)?eb -> mips:mips\1 # Legacy names, for another transition period mips:mips(n32|64)?eb -> mips:mips\1
.if defined(TARGET) && defined(TARGET_ARCH) && \ .if defined(TARGET) && defined(TARGET_ARCH) && \
@@ -280,12 +280,14 @@ kernel: buildkernel installkernel
# for building the world. # for building the world.
# #
upgrade_checks: upgrade_checks:
.if !defined(.PARSEDIR)
@if ! (cd ${.CURDIR}/tools/build/make_check && \ @if ! (cd ${.CURDIR}/tools/build/make_check && \
PATH=${PATH} ${BINMAKE} obj >/dev/null 2>&1 && \ PATH=${PATH} ${BINMAKE} obj >/dev/null 2>&1 && \
PATH=${PATH} ${BINMAKE} >/dev/null 2>&1); \ PATH=${PATH} ${BINMAKE} >/dev/null 2>&1); \
then \ then \
(cd ${.CURDIR} && ${MAKE} ${MAKE:T}); \ (cd ${.CURDIR} && ${MAKE} make); \
fi fi
.endif
# #
# Upgrade make(1) to the current version using the installed # Upgrade make(1) to the current version using the installed
@@ -303,20 +305,9 @@ MMAKE= ${MMAKEENV} ${MAKE} \
make: .PHONY make: .PHONY
@echo @echo
@echo "--------------------------------------------------------------" @echo "--------------------------------------------------------------"
@echo ">>> Building an up-to-date ${MAKE:T}(1)" @echo ">>> Building an up-to-date make(1)"
@echo "--------------------------------------------------------------" @echo "--------------------------------------------------------------"
${_+_}@cd ${.CURDIR}/usr.bin/${MAKE:T}; \ ${_+_}@cd ${.CURDIR}/usr.bin/make; \
${MMAKE} obj && \
${MMAKE} depend && \
${MMAKE} all && \
${MMAKE} install DESTDIR=${MAKEPATH} BINDIR=
bmake: .PHONY
@echo
@echo "--------------------------------------------------------------"
@echo ">>> Building an up-to-date bmake(1)"
@echo "--------------------------------------------------------------"
${_+_}@cd ${.CURDIR}/external/bsd/bmake/usr.bin/bmake; \
${MMAKE} obj && \ ${MMAKE} obj && \
${MMAKE} depend && \ ${MMAKE} depend && \
${MMAKE} all && \ ${MMAKE} all && \
@@ -340,7 +331,7 @@ kernel-toolchains:
# #
.if make(universe) || make(universe_kernels) || make(tinderbox) || make(targets) .if make(universe) || make(universe_kernels) || make(tinderbox) || make(targets)
TARGETS?=amd64 arm i386 ia64 mips pc98 powerpc sparc64 TARGETS?=amd64 arm i386 ia64 mips pc98 powerpc sparc64
TARGET_ARCHES_arm?= arm armeb TARGET_ARCHES_arm?= arm armeb armv6 armv6eb
TARGET_ARCHES_mips?= mipsel mips mips64el mips64 mipsn32 TARGET_ARCHES_mips?= mipsel mips mips64el mips64 mipsn32
TARGET_ARCHES_powerpc?= powerpc powerpc64 TARGET_ARCHES_powerpc?= powerpc powerpc64
TARGET_ARCHES_pc98?= i386 TARGET_ARCHES_pc98?= i386
@@ -452,3 +443,6 @@ universe_epilogue:
fi fi
.endif .endif
.endif .endif
buildLINT:
${MAKE} -C ${.CURDIR}/sys/${_TARGET}/conf LINT
+69 -24
View File
@@ -15,6 +15,9 @@
# -DNO_WWWUPDATE do not update www in ${MAKE} update # -DNO_WWWUPDATE do not update www in ${MAKE} update
# -DNO_CTF do not run the DTrace CTF conversion tools on built objects # -DNO_CTF do not run the DTrace CTF conversion tools on built objects
# LOCAL_DIRS="list of dirs" to add additional dirs to the SUBDIR list # LOCAL_DIRS="list of dirs" to add additional dirs to the SUBDIR list
# LOCAL_LIB_DIRS="list of dirs" to add additional dirs to libraries target
# LOCAL_MTREE="list of mtree files" to process to allow local directories
# to be created before files are installed
# LOCAL_TOOL_DIRS="list of dirs" to add additional dirs to the build-tools # LOCAL_TOOL_DIRS="list of dirs" to add additional dirs to the build-tools
# list # list
# TARGET="machine" to crossbuild world for a different machine type # TARGET="machine" to crossbuild world for a different machine type
@@ -45,6 +48,7 @@ TARGET_ARCH=${TARGET}
.include <bsd.own.mk> .include <bsd.own.mk>
.include <bsd.arch.inc.mk> .include <bsd.arch.inc.mk>
.include <bsd.compiler.mk>
# We must do share/info early so that installation of info `dir' # We must do share/info early so that installation of info `dir'
# entries works correctly. Do it first since it is less likely to # entries works correctly. Do it first since it is less likely to
@@ -90,7 +94,7 @@ SUBDIR+=etc
# These are last, since it is nice to at least get the base system # These are last, since it is nice to at least get the base system
# rebuilt before you do them. # rebuilt before you do them.
.for _DIR in ${LOCAL_DIRS} .for _DIR in ${LOCAL_LIB_DIRS} ${LOCAL_DIRS}
.if exists(${.CURDIR}/${_DIR}/Makefile) .if exists(${.CURDIR}/${_DIR}/Makefile)
SUBDIR+= ${_DIR} SUBDIR+= ${_DIR}
.endif .endif
@@ -138,7 +142,7 @@ VERSION!= uname -srp
VERSION+= ${OSRELDATE} VERSION+= ${OSRELDATE}
.endif .endif
KNOWN_ARCHES?= amd64 arm armeb/arm i386 i386/pc98 ia64 mips mipsel/mips mips64el/mips mips64/mips mipsn32el/mips mipsn32/mips powerpc powerpc64/powerpc sparc64 KNOWN_ARCHES?= amd64 arm armeb/arm armv6/arm armv6eb/arm i386 i386/pc98 ia64 mips mipsel/mips mips64el/mips mips64/mips mipsn32el/mips mipsn32/mips powerpc powerpc64/powerpc sparc64
.if ${TARGET} == ${TARGET_ARCH} .if ${TARGET} == ${TARGET_ARCH}
_t= ${TARGET} _t= ${TARGET}
.else .else
@@ -236,7 +240,8 @@ BMAKEENV= INSTALL="sh ${.CURDIR}/tools/install.sh" \
PATH=${BPATH}:${PATH} \ PATH=${BPATH}:${PATH} \
WORLDTMP=${WORLDTMP} \ WORLDTMP=${WORLDTMP} \
VERSION="${VERSION}" \ VERSION="${VERSION}" \
MAKEFLAGS="-m ${.CURDIR}/tools/build/mk ${.MAKEFLAGS}" MAKEFLAGS="-m ${.CURDIR}/tools/build/mk ${.MAKEFLAGS}" \
COMPILER_TYPE=${COMPILER_TYPE}
BMAKE= MAKEOBJDIRPREFIX=${WORLDTMP} \ BMAKE= MAKEOBJDIRPREFIX=${WORLDTMP} \
${BMAKEENV} ${MAKE} -f Makefile.inc1 \ ${BMAKEENV} ${MAKE} -f Makefile.inc1 \
DESTDIR= \ DESTDIR= \
@@ -245,7 +250,7 @@ BMAKE= MAKEOBJDIRPREFIX=${WORLDTMP} \
-DWITHOUT_META_MODE \ -DWITHOUT_META_MODE \
-DWITHOUT_HTML -DWITHOUT_INFO -DNO_LINT -DWITHOUT_MAN \ -DWITHOUT_HTML -DWITHOUT_INFO -DNO_LINT -DWITHOUT_MAN \
-DNO_PIC -DNO_PROFILE -DNO_SHARED \ -DNO_PIC -DNO_PROFILE -DNO_SHARED \
-DNO_CPU_CFLAGS -DNO_WARNS -DNO_CTF -DNO_CPU_CFLAGS -DNO_WARNS -DNO_CTF -DEARLY_BUILD
# build-tools stage # build-tools stage
TMAKE= MAKEOBJDIRPREFIX=${OBJTREE} \ TMAKE= MAKEOBJDIRPREFIX=${OBJTREE} \
@@ -256,7 +261,7 @@ TMAKE= MAKEOBJDIRPREFIX=${OBJTREE} \
SSP_CFLAGS= \ SSP_CFLAGS= \
-DWITHOUT_META_MODE \ -DWITHOUT_META_MODE \
-DNO_LINT \ -DNO_LINT \
-DNO_CPU_CFLAGS -DNO_WARNS -DNO_CTF -DNO_CPU_CFLAGS -DNO_WARNS -DNO_CTF -DEARLY_BUILD
# cross-tools stage # cross-tools stage
XMAKE= TOOLS_PREFIX=${WORLDTMP} ${BMAKE} \ XMAKE= TOOLS_PREFIX=${WORLDTMP} ${BMAKE} \
@@ -274,6 +279,16 @@ WMAKEENV= ${CROSSENV} \
.if ${MK_CDDL} == "no" .if ${MK_CDDL} == "no"
WMAKEENV+= NO_CTF=1 WMAKEENV+= NO_CTF=1
.endif .endif
.if ${CC:T:Mgcc} == "gcc"
WMAKE_COMPILER_TYPE= gcc
.elif ${CC:T:Mclang} == "clang"
WMAKE_COMPILER_TYPE= clang
.elif ${MK_CLANG_IS_CC} == "no"
WMAKE_COMPILER_TYPE= gcc
.else
WMAKE_COMPILER_TYPE= clang
.endif
WMAKEENV+= COMPILER_TYPE=${WMAKE_COMPILER_TYPE}
WMAKE= ${WMAKEENV} ${MAKE} -f Makefile.inc1 DESTDIR=${WORLDTMP} WMAKE= ${WMAKEENV} ${MAKE} -f Makefile.inc1 DESTDIR=${WORLDTMP}
.if ${TARGET_ARCH} == "amd64" || ${TARGET_ARCH} == "powerpc64" .if ${TARGET_ARCH} == "amd64" || ${TARGET_ARCH} == "powerpc64"
@@ -287,9 +302,10 @@ LIB32CPUFLAGS= -march=i686 -mmmx -msse -msse2
LIB32CPUFLAGS= -march=${TARGET_CPUTYPE} LIB32CPUFLAGS= -march=${TARGET_CPUTYPE}
.endif .endif
LIB32WMAKEENV= MACHINE=i386 MACHINE_ARCH=i386 \ LIB32WMAKEENV= MACHINE=i386 MACHINE_ARCH=i386 \
MACHINE_CPU="i686 mmx sse sse2" \ MACHINE_CPU="i686 mmx sse sse2"
LD="${LD} -m elf_i386_fbsd -Y P,${LIB32TMP}/usr/lib32" \ LIB32WMAKEFLAGS= \
AS="${AS} --32" AS="${AS} --32" \
LD="${LD} -m elf_i386_fbsd -Y P,${LIB32TMP}/usr/lib32"
.elif ${TARGET_ARCH} == "powerpc64" .elif ${TARGET_ARCH} == "powerpc64"
.if empty(TARGET_CPUTYPE) .if empty(TARGET_CPUTYPE)
@@ -297,7 +313,8 @@ LIB32CPUFLAGS= -mcpu=powerpc
.else .else
LIB32CPUFLAGS= -mcpu=${TARGET_CPUTYPE} LIB32CPUFLAGS= -mcpu=${TARGET_CPUTYPE}
.endif .endif
LIB32WMAKEENV= MACHINE=powerpc MACHINE_ARCH=powerpc \ LIB32WMAKEENV= MACHINE=powerpc MACHINE_ARCH=powerpc
LIB32WMAKEFLAGS= \
LD="${LD} -m elf32ppc_fbsd" LD="${LD} -m elf32ppc_fbsd"
.endif .endif
@@ -314,15 +331,20 @@ LIB32WMAKEENV+= MAKEOBJDIRPREFIX=${OBJTREE}/lib32 \
VERSION="${VERSION}" \ VERSION="${VERSION}" \
INSTALL="sh ${.CURDIR}/tools/install.sh" \ INSTALL="sh ${.CURDIR}/tools/install.sh" \
PATH=${TMPPATH} \ PATH=${TMPPATH} \
LIBDIR=/usr/lib32 \
SHLIBDIR=/usr/lib32 \
COMPILER_TYPE=${WMAKE_COMPILER_TYPE}
LIB32WMAKEFLAGS+= \
CC="${CC} ${LIB32FLAGS}" \ CC="${CC} ${LIB32FLAGS}" \
CXX="${CXX} ${LIB32FLAGS}" \ CXX="${CXX} ${LIB32FLAGS}" \
LIBDIR=/usr/lib32 \ DESTDIR=${LIB32TMP} \
SHLIBDIR=/usr/lib32 -DCOMPAT_32BIT \
-DNO_CPU_CFLAGS \
-DNO_CTF \
-DNO_LINT
LIB32WMAKE= ${LIB32WMAKEENV} ${MAKE} -DNO_CPU_CFLAGS -DCOMPAT_32BIT \ LIB32WMAKE= ${LIB32WMAKEENV} ${MAKE} ${LIB32WMAKEFLAGS} \
-DWITHOUT_BIND -DWITHOUT_MAN -DWITHOUT_INFO \ -DWITHOUT_BIND -DWITHOUT_MAN -DWITHOUT_INFO -DWITHOUT_HTML
-DWITHOUT_HTML -DNO_CTF -DNO_LINT -ECC -ECXX -EAS -ELD \
DESTDIR=${LIB32TMP}
LIB32IMAKE= ${LIB32WMAKE:NINSTALL=*:NDESTDIR=*:N_LDSCRIPTROOT=*} -DNO_INCS LIB32IMAKE= ${LIB32WMAKE:NINSTALL=*:NDESTDIR=*:N_LDSCRIPTROOT=*} -DNO_INCS
.endif .endif
@@ -392,6 +414,9 @@ _worldtmp:
mtree -deU -f ${.CURDIR}/etc/mtree/BIND.include.dist \ mtree -deU -f ${.CURDIR}/etc/mtree/BIND.include.dist \
-p ${WORLDTMP}/usr/include >/dev/null -p ${WORLDTMP}/usr/include >/dev/null
.endif .endif
.for _mtree in ${LOCAL_MTREE}
mtree -deU -f ${.CURDIR}/${_mtree} -p ${WORLDTMP} > /dev/null
.endfor
_legacy: _legacy:
@echo @echo
@echo "--------------------------------------------------------------" @echo "--------------------------------------------------------------"
@@ -492,7 +517,8 @@ build32:
.for _dir in lib/ncurses/ncurses lib/ncurses/ncursesw lib/libmagic .for _dir in lib/ncurses/ncurses lib/ncurses/ncursesw lib/libmagic
cd ${.CURDIR}/${_dir}; \ cd ${.CURDIR}/${_dir}; \
MAKEOBJDIRPREFIX=${OBJTREE}/lib32 ${MAKE} SSP_CFLAGS= DESTDIR= \ MAKEOBJDIRPREFIX=${OBJTREE}/lib32 ${MAKE} SSP_CFLAGS= DESTDIR= \
DIRPRFX=${_dir}/ build-tools DIRPRFX=${_dir}/ -DNO_LINT -DNO_CPU_CFLAGS -DNO_WARNS -DNO_CTF \
-DEARLY_BUILD build-tools
.endfor .endfor
cd ${.CURDIR}; \ cd ${.CURDIR}; \
${LIB32WMAKE} -f Makefile.inc1 libraries ${LIB32WMAKE} -f Makefile.inc1 libraries
@@ -639,7 +665,10 @@ ITOOLS= [ awk cap_mkdb cat chflags chmod chown \
# #
# Non-base distributions produced by the base system # Non-base distributions produced by the base system
EXTRA_DISTRIBUTIONS= doc games EXTRA_DISTRIBUTIONS= doc
.if ${MK_GAMES} != "no"
EXTRA_DISTRIBUTIONS+= games
.endif
.if defined(LIB32TMP) && ${MK_LIB32} != "no" .if defined(LIB32TMP) && ${MK_LIB32} != "no"
EXTRA_DISTRIBUTIONS+= lib32 EXTRA_DISTRIBUTIONS+= lib32
.endif .endif
@@ -705,7 +734,8 @@ reinstall:
@echo "--------------------------------------------------------------" @echo "--------------------------------------------------------------"
@echo ">>> Making hierarchy" @echo ">>> Making hierarchy"
@echo "--------------------------------------------------------------" @echo "--------------------------------------------------------------"
${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 hierarchy ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 \
LOCAL_MTREE=${LOCAL_MTREE} hierarchy
@echo @echo
@echo "--------------------------------------------------------------" @echo "--------------------------------------------------------------"
@echo ">>> Installing everything" @echo ">>> Installing everything"
@@ -834,7 +864,7 @@ buildkernel:
cd ${KRNLOBJDIR}/${_kernel}; \ cd ${KRNLOBJDIR}/${_kernel}; \
PATH=${BPATH}:${PATH} \ PATH=${BPATH}:${PATH} \
MAKESRCPATH=${KERNSRCDIR}/dev/aic7xxx/aicasm \ MAKESRCPATH=${KERNSRCDIR}/dev/aic7xxx/aicasm \
${MAKE} SSP_CFLAGS= -DNO_CPU_CFLAGS -DNO_CTF \ ${MAKE} SSP_CFLAGS= -DNO_CPU_CFLAGS -DNO_CTF -DEARLY_BUILD \
-f ${KERNSRCDIR}/dev/aic7xxx/aicasm/Makefile -f ${KERNSRCDIR}/dev/aic7xxx/aicasm/Makefile
# XXX - Gratuitously builds aicasm in the ``makeoptions NO_MODULES'' case. # XXX - Gratuitously builds aicasm in the ``makeoptions NO_MODULES'' case.
.if !defined(MODULES_WITH_WORLD) && !defined(NO_MODULES) && exists(${KERNSRCDIR}/modules) .if !defined(MODULES_WITH_WORLD) && !defined(NO_MODULES) && exists(${KERNSRCDIR}/modules)
@@ -842,7 +872,7 @@ buildkernel:
cd ${KERNSRCDIR}/modules/aic7xxx/aicasm; \ cd ${KERNSRCDIR}/modules/aic7xxx/aicasm; \
PATH=${BPATH}:${PATH} \ PATH=${BPATH}:${PATH} \
MAKEOBJDIRPREFIX=${KRNLOBJDIR}/${_kernel}/modules \ MAKEOBJDIRPREFIX=${KRNLOBJDIR}/${_kernel}/modules \
${MAKE} SSP_CFLAGS= -DNO_CPU_CFLAGS -DNO_CTF ${target} ${MAKE} SSP_CFLAGS= -DNO_CPU_CFLAGS -DNO_CTF -DEARLY_BUILD ${target}
.endfor .endfor
.endif .endif
.if !defined(NO_KERNELDEPEND) .if !defined(NO_KERNELDEPEND)
@@ -1200,8 +1230,12 @@ cross-tools:
# #
# hierarchy - ensure that all the needed directories are present # hierarchy - ensure that all the needed directories are present
# #
hierarchy: hierarchy hier:
cd ${.CURDIR}/etc; ${MAKE} distrib-dirs cd ${.CURDIR}/etc; ${MAKE} distrib-dirs
.for _mtree in ${LOCAL_MTREE}
mtree -eU ${MTREE_FOLLOWS_SYMLINKS} -f ${.CURDIR}/${_mtree} \
-p ${DESTDIR}/
.endfor
# #
# libraries - build all libraries, and install them under ${DESTDIR}. # libraries - build all libraries, and install them under ${DESTDIR}.
@@ -1256,6 +1290,7 @@ _prebuild_libs= ${_kerberos5_lib_libasn1} \
${_kerberos5_lib_libhx509} ${_kerberos5_lib_libkrb5} \ ${_kerberos5_lib_libhx509} ${_kerberos5_lib_libkrb5} \
${_kerberos5_lib_libroken} \ ${_kerberos5_lib_libroken} \
${_kerberos5_lib_libwind} \ ${_kerberos5_lib_libwind} \
${_lib_atf_libatf_c} \
lib/libbz2 ${_libcom_err} lib/libcrypt \ lib/libbz2 ${_libcom_err} lib/libcrypt \
lib/libexpat \ lib/libexpat \
${_lib_libgssapi} ${_lib_libipx} \ ${_lib_libgssapi} ${_lib_libipx} \
@@ -1263,11 +1298,15 @@ _prebuild_libs= ${_kerberos5_lib_libasn1} \
lib/ncurses/ncurses lib/ncurses/ncursesw \ lib/ncurses/ncurses lib/ncurses/ncursesw \
lib/libopie lib/libpam ${_lib_libthr} \ lib/libopie lib/libpam ${_lib_libthr} \
lib/libradius lib/libsbuf lib/libtacplus \ lib/libradius lib/libsbuf lib/libtacplus \
${_cddl_lib_libumem} \ ${_cddl_lib_libumem} ${_cddl_lib_libnvpair} \
lib/libutil ${_lib_libypclnt} lib/libz lib/msun \ lib/libutil ${_lib_libypclnt} lib/libz lib/msun \
${_secure_lib_libcrypto} ${_secure_lib_libssh} \ ${_secure_lib_libcrypto} ${_secure_lib_libssh} \
${_secure_lib_libssl} ${_secure_lib_libssl}
.if ${MK_ATF} != "no"
_lib_atf_libatf_c= lib/atf/libatf-c
.endif
.if ${MK_LIBTHR} != "no" .if ${MK_LIBTHR} != "no"
_lib_libthr= lib/libthr _lib_libthr= lib/libthr
.endif .endif
@@ -1277,11 +1316,17 @@ _ofed_lib= contrib/ofed/usr.lib/
.endif .endif
_generic_libs= ${_cddl_lib} gnu/lib ${_kerberos5_lib} lib ${_secure_lib} usr.bin/lex/lib ${_ofed_lib} _generic_libs= ${_cddl_lib} gnu/lib ${_kerberos5_lib} lib ${_secure_lib} usr.bin/lex/lib ${_ofed_lib}
.for _DIR in ${LOCAL_LIB_DIRS}
.if exists(${.CURDIR}/${_DIR}/Makefile)
_generic_libs+= ${_DIR}
.endif
.endfor
lib/libopie__L lib/libtacplus__L: lib/libmd__L lib/libopie__L lib/libtacplus__L: lib/libmd__L
.if ${MK_CDDL} != "no" .if ${MK_CDDL} != "no"
_cddl_lib_libumem= cddl/lib/libumem _cddl_lib_libumem= cddl/lib/libumem
_cddl_lib_libnvpair= cddl/lib/libnvpair
_cddl_lib= cddl/lib _cddl_lib= cddl/lib
.endif .endif
@@ -1544,7 +1589,7 @@ check-old: check-old-files check-old-libs check-old-dirs
# showconfig - show build configuration. # showconfig - show build configuration.
# #
showconfig: showconfig:
@${MAKE} -n -f bsd.own.mk -V dummy -dg1 | grep ^MK_ | sort @${MAKE} -n -f bsd.own.mk -V dummy -dg1 2>&1 | grep ^MK_ | sort
.if !empty(KRNLOBJDIR) && !empty(KERNCONF) .if !empty(KRNLOBJDIR) && !empty(KERNCONF)
DTBOUTPUTPATH= ${KRNLOBJDIR}/${KERNCONF}/ DTBOUTPUTPATH= ${KRNLOBJDIR}/${KERNCONF}/
@@ -1552,7 +1597,7 @@ DTBOUTPUTPATH= ${KRNLOBJDIR}/${KERNCONF}/
.if !defined(FDT_DTS_FILE) || empty(FDT_DTS_FILE) .if !defined(FDT_DTS_FILE) || empty(FDT_DTS_FILE)
.if exists(${KERNCONFDIR}/${KERNCONF}) .if exists(${KERNCONFDIR}/${KERNCONF})
FDT_DTS_FILE!= awk 'BEGIN {FS="="} /^makeoptions[[:space:]]+FDT_DTS_FILE/ {print $$2}' \ FDT_DTS_FILE!= awk 'BEGIN {FS="="} /^makeoptions[[:space:]]+FDT_DTS_FILE/ {print $$2}' \
${KERNCONFDIR}/${KERNCONF} ${KERNCONFDIR}/${KERNCONF} ; echo
.endif .endif
.endif .endif
+73 -1
View File
@@ -38,8 +38,75 @@
# xargs -n1 | sort | uniq -d; # xargs -n1 | sort | uniq -d;
# done # done
# 20121022: VFS_LOCK_GIANT elimination
OLD_FILES+=usr/share/man/man9/VFS_LOCK_GIANT.9.gz
OLD_FILES+=usr/share/man/man9/VFS_UNLOCK_GIANT.9.gz
# 20121004: remove incomplete unwind.h
OLD_FILES+=usr/include/clang/3.2/unwind.h
# 20120910: NetBSD compat shims removed
OLD_FILES+=usr/include/cam/scsi/scsi_low_pisa.h
OLD_FILES+=usr/include/sys/device_port.h
# 20120908: pf cleanup
OLD_FILES+=usr/include/net/if_pflow.h
# 20120816: new clang import which bumps version from 3.1 to 3.2
OLD_FILES+=usr/bin/llvm-ld
OLD_FILES+=usr/bin/llvm-stub
OLD_FILES+=usr/include/clang/3.1/altivec.h
OLD_FILES+=usr/include/clang/3.1/avx2intrin.h
OLD_FILES+=usr/include/clang/3.1/avxintrin.h
OLD_FILES+=usr/include/clang/3.1/bmi2intrin.h
OLD_FILES+=usr/include/clang/3.1/bmiintrin.h
OLD_FILES+=usr/include/clang/3.1/cpuid.h
OLD_FILES+=usr/include/clang/3.1/emmintrin.h
OLD_FILES+=usr/include/clang/3.1/fma4intrin.h
OLD_FILES+=usr/include/clang/3.1/immintrin.h
OLD_FILES+=usr/include/clang/3.1/lzcntintrin.h
OLD_FILES+=usr/include/clang/3.1/mm3dnow.h
OLD_FILES+=usr/include/clang/3.1/mm_malloc.h
OLD_FILES+=usr/include/clang/3.1/mmintrin.h
OLD_FILES+=usr/include/clang/3.1/module.map
OLD_FILES+=usr/include/clang/3.1/nmmintrin.h
OLD_FILES+=usr/include/clang/3.1/pmmintrin.h
OLD_FILES+=usr/include/clang/3.1/popcntintrin.h
OLD_FILES+=usr/include/clang/3.1/smmintrin.h
OLD_FILES+=usr/include/clang/3.1/tmmintrin.h
OLD_FILES+=usr/include/clang/3.1/unwind.h
OLD_FILES+=usr/include/clang/3.1/wmmintrin.h
OLD_FILES+=usr/include/clang/3.1/x86intrin.h
OLD_FILES+=usr/include/clang/3.1/xmmintrin.h
OLD_DIRS+=usr/include/clang/3.1
OLD_FILES+=usr/share/man/man1/llvm-ld.1.gz
# 20120712: OpenSSL 1.0.1c import
OLD_LIBS+=lib/libcrypto.so.6
OLD_LIBS+=usr/lib/libssl.so.6
OLD_LIBS+=usr/lib32/libcrypto.so.6
OLD_LIBS+=usr/lib32/libssl.so.6
OLD_FILES+=usr/include/openssl/aes_locl.h
OLD_FILES+=usr/include/openssl/bio_lcl.h
OLD_FILES+=usr/include/openssl/e_os.h
OLD_FILES+=usr/include/openssl/fips.h
OLD_FILES+=usr/include/openssl/fips_rand.h
OLD_FILES+=usr/include/openssl/md2.h
OLD_FILES+=usr/include/openssl/pq_compat.h
OLD_FILES+=usr/include/openssl/store.h
OLD_FILES+=usr/include/openssl/tmdiff.h
OLD_FILES+=usr/include/openssl/ui_locl.h
OLD_FILES+=usr/share/openssl/man/man3/CRYPTO_set_id_callback.3.gz
# 20120621: remove old man page
OLD_FILES+=usr/share/man/man8/vnconfig.8.gz
# 20120619: TOE support updated
OLD_FILES+=usr/include/netinet/toedev.h
# 20120613: auth.conf removed
OLD_FILES+=etc/auth.conf
OLD_FILES+=usr/share/examples/etc/auth.conf
OLD_FILES+=usr/share/man/man3/auth.3.gz
OLD_FILES+=usr/share/man/man3/auth_getval.3.gz
OLD_FILES+=usr/share/man/man5/auth.conf.5.gz
# 20120530: kde pam lives now in ports # 20120530: kde pam lives now in ports
OLD_FILES+=/etc/pam.d/kde OLD_FILES+=etc/pam.d/kde
# 20120521: byacc import
OLD_FILES+=usr/bin/yyfix
OLD_FILES+=usr/share/man/man1/yyfix.1.gz
# 20120505: new clang import installed a redundant internal header # 20120505: new clang import installed a redundant internal header
OLD_FILES+=usr/include/clang/3.1/stdalign.h OLD_FILES+=usr/include/clang/3.1/stdalign.h
# 20120428: MD2 removed from libmd # 20120428: MD2 removed from libmd
@@ -1335,6 +1402,11 @@ OLD_FILES+=usr/share/man/man2/kse_thr_interrupt.2.gz
OLD_FILES+=usr/share/man/man2/kse_wakeup.2.gz OLD_FILES+=usr/share/man/man2/kse_wakeup.2.gz
OLD_FILES+=usr/lib32/libkse.so OLD_FILES+=usr/lib32/libkse.so
OLD_LIBS+=usr/lib32/libkse.so.3 OLD_LIBS+=usr/lib32/libkse.so.3
# 20080225: bsdar/bsdranlib rename to ar/ranlib
OLD_FILES+=usr/bin/bsdar
OLD_FILES+=usr/bin/bsdranlib
OLD_FILES+=usr/share/man/man1/bsdar.1.gz
OLD_FILES+=usr/share/man/man1/bsdranlib.1.gz
# 20080220: geom_lvm rename to geom_linux_lvm # 20080220: geom_lvm rename to geom_linux_lvm
OLD_FILES+=usr/share/man/man4/geom_lvm.4.gz OLD_FILES+=usr/share/man/man4/geom_lvm.4.gz
# 20080126: oldcard.4 removal # 20080126: oldcard.4 removal
+116 -1
View File
@@ -24,6 +24,121 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 10.x IS SLOW:
disable the most expensive debugging functionality run disable the most expensive debugging functionality run
"ln -s 'abort:false,junk:false' /etc/malloc.conf".) "ln -s 'abort:false,junk:false' /etc/malloc.conf".)
20121102:
The IPFIREWALL_FORWARD kernel option has been removed. Its
functionality now turned on by default.
20121023:
The ZERO_COPY_SOCKET kernel option has been removed and
split into SOCKET_SEND_COW and SOCKET_RECV_PFLIP.
NB: SOCKET_SEND_COW uses the VM page based copy-on-write
mechanism which is not safe and may result in kernel crashes.
NB: The SOCKET_RECV_PFLIP mechanism is useless as no current
driver supports disposeable external page sized mbuf storage.
Proper replacements for both zero-copy mechanisms are under
consideration and will eventually lead to complete removal
of the two kernel options.
20121023:
The IPv4 network stack has been converted to network byte
order. The following modules need to be recompiled together
with kernel: carp(4), divert(4), gif(4), siftr(4), gre(4),
pf(4), ipfw(4), ng_ipfw(4), stf(4).
20121022:
Support for non-MPSAFE filesystems was removed from VFS. The
VFS_VERSION was bumped, all filesystem modules shall be
recompiled.
20121018:
All the non-MPSAFE filesystems have been disconnected from
the build. The full list includes: codafs, hpfs, ntfs, nwfs,
portalfs, smbfs, xfs.
20121016:
The interface cloning API and ABI has changed. The following
modules need to be recompiled together with kernel:
ipfw(4), pfsync(4), pflog(4), usb(4), wlan(4), stf(4),
vlan(4), disc(4), edsc(4), if_bridge(4), gif(4), tap(4),
faith(4), epair(4), enc(4), tun(4), if_lagg(4), gre(4).
20121015:
The sdhci driver was split in two parts: sdhci (generic SD Host
Controller logic) and sdhci_pci (actual hardware driver).
No kernel config modifications are required, but if you
load sdhc as a module you must switch to sdhci_pci instead.
20121014:
Import the FUSE kernel and userland support into base system.
20121013:
The GNU sort(1) program has been removed since the BSD-licensed
sort(1) has been the default for quite some time and no serious
problems have been reported. The corresponding WITH_GNU_SORT
knob has also gone.
20121006:
The pfil(9) API/ABI for AF_INET family has been changed. Packet
filtering modules: pf(4), ipfw(4), ipfilter(4) need to be recompiled
with new kernel.
20121001:
The net80211(4) ABI has been changed to allow for improved driver
PS-POLL and power-save support. All wireless drivers need to be
recompiled to work with the new kernel.
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
needed. The GENERIC kernels on i386 and amd64 do include the
option, so the change only affects the custom kernel
configurations.
20120908:
The pf(4) packet filter ABI has been changed. pfctl(8) and
snmp_pf module need to be recompiled to work with new kernel.
20120828:
A new ZFS feature flag "com.delphix:empty_bpobj" has been merged
to -HEAD. Pools that have empty_bpobj in active state can not be
imported read-write with ZFS implementations that do not support
this feature. For more information read the zpool-features(5)
manual page.
20120727:
The sparc64 ZFS loader has been changed to no longer try to auto-
detect ZFS providers based on diskN aliases but now requires these
to be explicitly listed in the OFW boot-device environment variable.
20120712:
The OpenSSL has been upgraded to 1.0.1c. Any binaries requiring
libcrypto.so.6 or libssl.so.6 must be recompiled. Also, there are
configuration changes. Make sure to merge /etc/ssl/openssl.cnf.
20120712:
The following sysctls and tunables have been renamed for consistency
with other variables:
kern.cam.da.da_send_ordered -> kern.cam.da.send_ordered
kern.cam.ada.ada_send_ordered -> kern.cam.ada.send_ordered
20120628:
The sort utility has been replaced with BSD sort. For now, GNU sort
is also available as "gnusort" or the default can be set back to
GNU sort by setting WITH_GNU_SORT. In this case, BSD sort will be
installed as "bsdsort".
20120611:
A new version of ZFS (pool version 5000) has been merged to -HEAD.
Starting with this version the old system of ZFS pool versioning
is superseded by "feature flags". This concept enables forward
compatibility against certain future changes in functionality of ZFS
pools. The first read-only compatible "feature flag" for ZFS pools
is named "com.delphix:async_destroy". For more information
read the new zpool-features(5) manual page.
Please refer to the "ZFS notes" section of this file for information
on upgrading boot ZFS pools.
20120417: 20120417:
The malloc(3) implementation embedded in libc now uses sources imported The malloc(3) implementation embedded in libc now uses sources imported
as contrib/jemalloc. The most disruptive API change is to as contrib/jemalloc. The most disruptive API change is to
@@ -1479,7 +1594,7 @@ COMMON ITEMS:
<reboot> <reboot>
To upgrade in-place from 8.x-stable to current To upgrade in-place from stable to current
---------------------------------------------- ----------------------------------------------
<make sure you have good level 0 dumps> <make sure you have good level 0 dumps>
make buildworld [9] make buildworld [9]
+1 -1
View File
@@ -127,7 +127,7 @@ to the file
truncating truncating
.Pa file3 .Pa file3
if it already exists. if it already exists.
See the manual page for your shell (i.e., See the manual page for your shell (e.g.,
.Xr sh 1 ) .Xr sh 1 )
for more information on redirection. for more information on redirection.
.Pp .Pp
+13 -10
View File
@@ -58,11 +58,11 @@ __FBSDID("$FreeBSD$");
#include <err.h> #include <err.h>
#include <fcntl.h> #include <fcntl.h>
#include <locale.h> #include <locale.h>
#include <stddef.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <unistd.h> #include <unistd.h>
#include <stddef.h>
static int bflag, eflag, nflag, sflag, tflag, vflag; static int bflag, eflag, nflag, sflag, tflag, vflag;
static int rval; static int rval;
@@ -77,15 +77,19 @@ static void raw_cat(int);
static int udom_open(const char *path, int flags); static int udom_open(const char *path, int flags);
#endif #endif
/* Memory strategy threshold, in pages: if physmem is larger then this, use a /*
* large buffer */ * Memory strategy threshold, in pages: if physmem is larger than this,
* use a large buffer.
*/
#define PHYSPAGES_THRESHOLD (32 * 1024) #define PHYSPAGES_THRESHOLD (32 * 1024)
/* Maximum buffer size in bytes - do not allow it to grow larger than this */ /* Maximum buffer size in bytes - do not allow it to grow larger than this. */
#define BUFSIZE_MAX (2 * 1024 * 1024) #define BUFSIZE_MAX (2 * 1024 * 1024)
/* Small (default) buffer size in bytes. It's inefficient for this to be /*
* smaller than MAXPHYS */ * Small (default) buffer size in bytes. It's inefficient for this to be
* smaller than MAXPHYS.
*/
#define BUFSIZE_SMALL (MAXPHYS) #define BUFSIZE_SMALL (MAXPHYS)
int int
@@ -144,13 +148,12 @@ usage(void)
static void static void
scanfiles(char *argv[], int cooked) scanfiles(char *argv[], int cooked)
{ {
int i = 0; int fd, i;
char *path; char *path;
FILE *fp; FILE *fp;
i = 0;
while ((path = argv[i]) != NULL || i == 0) { while ((path = argv[i]) != NULL || i == 0) {
int fd;
if (path == NULL || strcmp(path, "-") == 0) { if (path == NULL || strcmp(path, "-") == 0) {
filename = "stdin"; filename = "stdin";
fd = STDIN_FILENO; fd = STDIN_FILENO;
@@ -257,7 +260,7 @@ raw_cat(int rfd)
wfd = fileno(stdout); wfd = fileno(stdout);
if (buf == NULL) { if (buf == NULL) {
if (fstat(wfd, &sbuf)) if (fstat(wfd, &sbuf))
err(1, "%s", filename); err(1, "stdout");
if (S_ISREG(sbuf.st_mode)) { if (S_ISREG(sbuf.st_mode)) {
/* If there's plenty of RAM, use a large copy buffer */ /* If there's plenty of RAM, use a large copy buffer */
if (sysconf(_SC_PHYS_PAGES) > PHYSPAGES_THRESHOLD) if (sysconf(_SC_PHYS_PAGES) > PHYSPAGES_THRESHOLD)
+2 -2
View File
@@ -32,7 +32,7 @@
.\" @(#)cp.1 8.3 (Berkeley) 4/18/94 .\" @(#)cp.1 8.3 (Berkeley) 4/18/94
.\" $FreeBSD$ .\" $FreeBSD$
.\" .\"
.Dd January 17, 2010 .Dd September 4, 2012
.Dt CP 1 .Dt CP 1
.Os .Os
.Sh NAME .Sh NAME
@@ -164,7 +164,7 @@ Cause
.Nm .Nm
to preserve the following attributes of each source to preserve the following attributes of each source
file in the copy: modification time, access time, file in the copy: modification time, access time,
file flags, file mode, user ID, and group ID, as allowed by permissions. file flags, file mode, ACL, user ID, and group ID, as allowed by permissions.
.Pp .Pp
If the user ID and group ID cannot be preserved, no error message If the user ID and group ID cannot be preserved, no error message
is displayed and the exit value is not altered. is displayed and the exit value is not altered.
+4 -4
View File
@@ -137,7 +137,7 @@ main(int argc, char *argv[])
* If -d or -t, set the timezone or daylight savings time; this * If -d or -t, set the timezone or daylight savings time; this
* doesn't belong here; the kernel should not know about either. * doesn't belong here; the kernel should not know about either.
*/ */
if (set_timezone && settimeofday((struct timeval *)NULL, &tz)) if (set_timezone && settimeofday(NULL, &tz) != 0)
err(1, "settimeofday (timezone)"); err(1, "settimeofday (timezone)");
if (!rflag && time(&tval) == -1) if (!rflag && time(&tval) == -1)
@@ -273,14 +273,14 @@ setthetime(const char *fmt, const char *p, int jflag, int nflag)
/* set the time */ /* set the time */
if (nflag || netsettime(tval)) { if (nflag || netsettime(tval)) {
utx.ut_type = OLD_TIME; utx.ut_type = OLD_TIME;
gettimeofday(&utx.ut_tv, NULL); (void)gettimeofday(&utx.ut_tv, NULL);
pututxline(&utx); pututxline(&utx);
tv.tv_sec = tval; tv.tv_sec = tval;
tv.tv_usec = 0; tv.tv_usec = 0;
if (settimeofday(&tv, (struct timezone *)NULL)) if (settimeofday(&tv, NULL) != 0)
err(1, "settimeofday (timeval)"); err(1, "settimeofday (timeval)");
utx.ut_type = NEW_TIME; utx.ut_type = NEW_TIME;
gettimeofday(&utx.ut_tv, NULL); (void)gettimeofday(&utx.ut_tv, NULL);
pututxline(&utx); pututxline(&utx);
} }
+2
View File
@@ -30,4 +30,6 @@
* $FreeBSD$ * $FreeBSD$
*/ */
extern int retval;
int netsettime(time_t); int netsettime(time_t);
-2
View File
@@ -55,8 +55,6 @@ __FBSDID("$FreeBSD$");
#define WAITACK 2 /* seconds */ #define WAITACK 2 /* seconds */
#define WAITDATEACK 5 /* seconds */ #define WAITDATEACK 5 /* seconds */
extern int retval;
/* /*
* Set the date in the machines controlled by timedaemons by communicating the * Set the date in the machines controlled by timedaemons by communicating the
* new date to the local timedaemon. If the timedaemon is in the master state, * new date to the local timedaemon. If the timedaemon is in the master state,
+5
View File
@@ -41,6 +41,11 @@ __FBSDID("$FreeBSD$");
#include <sys/types.h> #include <sys/types.h>
#include <stdint.h>
#include "dd.h"
#include "extern.h"
/* /*
* There are currently six tables: * There are currently six tables:
* *
+1 -1
View File
@@ -232,7 +232,7 @@ setup(void)
ctab = casetab; ctab = casetab;
} }
(void)gettimeofday(&tv, (struct timezone *)NULL); (void)gettimeofday(&tv, NULL);
st.start = tv.tv_sec + tv.tv_usec * 1e-6; st.start = tv.tv_sec + tv.tv_usec * 1e-6;
} }
+1 -1
View File
@@ -59,7 +59,7 @@ summary(void)
double secs; double secs;
char buf[100]; char buf[100];
(void)gettimeofday(&tv, (struct timezone *)NULL); (void)gettimeofday(&tv, NULL);
secs = tv.tv_sec + tv.tv_usec * 1e-6 - st.start; secs = tv.tv_sec + tv.tv_usec * 1e-6 - st.start;
if (secs < 1e-6) if (secs < 1e-6)
secs = 1e-6; secs = 1e-6;
+6 -9
View File
@@ -35,10 +35,10 @@ __FBSDID("$FreeBSD$");
#include "ed.h" #include "ed.h"
FILE *sfp; /* scratch file pointer */ static FILE *sfp; /* scratch file pointer */
off_t sfseek; /* scratch file position */ static off_t sfseek; /* scratch file position */
int seek_write; /* seek before writing */ static int seek_write; /* seek before writing */
line_t buffer_head; /* incore buffer */ static line_t buffer_head; /* incore buffer */
/* get_sbuf_line: get a line of text from the scratch file; return pointer /* get_sbuf_line: get a line of text from the scratch file; return pointer
to the text */ to the text */
@@ -185,10 +185,7 @@ get_addressed_line_node(long n)
return lp; return lp;
} }
static char sfn[15] = ""; /* scratch file name */
extern int newline_added;
char sfn[15] = ""; /* scratch file name */
/* open_sbuf: open scratch file */ /* open_sbuf: open scratch file */
int int
@@ -244,7 +241,7 @@ quit(int n)
} }
unsigned char ctab[256]; /* character translation table */ static unsigned char ctab[256]; /* character translation table */
/* init_buffers: open scratch buffer; initialize line queue */ /* init_buffers: open scratch buffer; initialize line queue */
void void
+8 -12
View File
@@ -68,28 +68,24 @@ __FBSDID("$FreeBSD$");
* global variables and related macros * global variables and related macros
*/ */
enum { /* encrypt, decrypt, authenticate */
MODE_ENCRYPT, MODE_DECRYPT, MODE_AUTHENTICATE
} mode = MODE_ENCRYPT;
#ifdef DES #ifdef DES
DES_cblock ivec; /* initialization vector */ static DES_cblock ivec; /* initialization vector */
DES_cblock pvec; /* padding vector */ static DES_cblock pvec; /* padding vector */
#endif #endif
char bits[] = { /* used to extract bits from a char */ static char bits[] = { /* used to extract bits from a char */
'\200', '\100', '\040', '\020', '\010', '\004', '\002', '\001' '\200', '\100', '\040', '\020', '\010', '\004', '\002', '\001'
}; };
int pflag; /* 1 to preserve parity bits */ static int pflag; /* 1 to preserve parity bits */
#ifdef DES #ifdef DES
DES_key_schedule schedule; /* expanded DES key */ static DES_key_schedule schedule; /* expanded DES key */
#endif #endif
unsigned char des_buf[8]; /* shared buffer for get_des_char/put_des_char */ static unsigned char des_buf[8];/* shared buffer for get_des_char/put_des_char */
int des_ct = 0; /* count for get_des_char/put_des_char */ static int des_ct = 0; /* count for get_des_char/put_des_char */
int des_n = 0; /* index for put_des_char/get_des_char */ static int des_n = 0; /* index for put_des_char/get_des_char */
/* init_des_cipher: initialize DES */ /* init_des_cipher: initialize DES */
void void
+6
View File
@@ -277,3 +277,9 @@ extern int lineno;
extern long second_addr; extern long second_addr;
extern long u_addr_last; extern long u_addr_last;
extern long u_current_addr; extern long u_current_addr;
extern long rows;
extern int cols;
extern int newline_added;
extern int des;
extern int scripted;
extern int patlock;
+5 -5
View File
@@ -135,11 +135,11 @@ exec_global(int interact, int gflag)
} }
line_t **active_list; /* list of lines active in a global command */ static line_t **active_list; /* list of lines active in a global command */
long active_last; /* index of last active line in active_list */ static long active_last; /* index of last active line in active_list */
long active_size; /* size of active_list */ static long active_size; /* size of active_list */
long active_ptr; /* active_list index (non-decreasing) */ static long active_ptr; /* active_list index (non-decreasing) */
long active_ndx; /* active_list index (modulo active_last) */ static long active_ndx; /* active_list index (modulo active_last) */
/* set_active_node: add a line node to the global-active list */ /* set_active_node: add a line node to the global-active list */
int int
+2 -11
View File
@@ -30,9 +30,6 @@ __FBSDID("$FreeBSD$");
#include "ed.h" #include "ed.h"
extern int scripted;
/* read_file: read a named file/pipe into the buffer; return line count */ /* read_file: read a named file/pipe into the buffer; return line count */
long long
read_file(char *fn, long n) read_file(char *fn, long n)
@@ -58,11 +55,8 @@ read_file(char *fn, long n)
return current_addr - n; return current_addr - n;
} }
static char *sbuf; /* file i/o buffer */
extern int des; static int sbufsz; /* file i/o buffer size */
char *sbuf; /* file i/o buffer */
int sbufsz; /* file i/o buffer size */
int newline_added; /* if set, newline appended to input file */ int newline_added; /* if set, newline appended to input file */
/* read_stream: read a stream into the editor buffer; return status */ /* read_stream: read a stream into the editor buffer; return status */
@@ -298,9 +292,6 @@ get_tty_line(void)
#define ESCAPES "\a\b\f\n\r\t\v\\" #define ESCAPES "\a\b\f\n\r\t\v\\"
#define ESCCHARS "abfnrtv\\" #define ESCCHARS "abfnrtv\\"
extern int rows;
extern int cols;
/* put_tty_line: print text to stdout */ /* put_tty_line: print text to stdout */
int int
put_tty_line(const char *s, int l, long n, int gflag) put_tty_line(const char *s, int l, long n, int gflag)
+16 -15
View File
@@ -66,40 +66,40 @@ __FBSDID("$FreeBSD$");
#ifdef _POSIX_SOURCE #ifdef _POSIX_SOURCE
sigjmp_buf env; static sigjmp_buf env;
#else #else
jmp_buf env; static jmp_buf env;
#endif #endif
/* static buffers */ /* static buffers */
char stdinbuf[1]; /* stdin buffer */ char stdinbuf[1]; /* stdin buffer */
char *shcmd; /* shell command buffer */ static char *shcmd; /* shell command buffer */
int shcmdsz; /* shell command buffer size */ static int shcmdsz; /* shell command buffer size */
int shcmdi; /* shell command buffer index */ static int shcmdi; /* shell command buffer index */
char *ibuf; /* ed command-line buffer */ char *ibuf; /* ed command-line buffer */
int ibufsz; /* ed command-line buffer size */ int ibufsz; /* ed command-line buffer size */
char *ibufp; /* pointer to ed command-line buffer */ char *ibufp; /* pointer to ed command-line buffer */
/* global flags */ /* global flags */
int des = 0; /* if set, use crypt(3) for i/o */ int des = 0; /* if set, use crypt(3) for i/o */
int garrulous = 0; /* if set, print all error messages */ static int garrulous = 0; /* if set, print all error messages */
int isbinary; /* if set, buffer contains ASCII NULs */ int isbinary; /* if set, buffer contains ASCII NULs */
int isglobal; /* if set, doing a global command */ int isglobal; /* if set, doing a global command */
int modified; /* if set, buffer modified since last write */ int modified; /* if set, buffer modified since last write */
int mutex = 0; /* if set, signals set "sigflags" */ int mutex = 0; /* if set, signals set "sigflags" */
int red = 0; /* if set, restrict shell/directory access */ static int red = 0; /* if set, restrict shell/directory access */
int scripted = 0; /* if set, suppress diagnostics */ int scripted = 0; /* if set, suppress diagnostics */
int sigflags = 0; /* if set, signals received while mutex set */ int sigflags = 0; /* if set, signals received while mutex set */
int sigactive = 0; /* if set, signal handlers are enabled */ static int sigactive = 0; /* if set, signal handlers are enabled */
char old_filename[PATH_MAX] = ""; /* default filename */ static char old_filename[PATH_MAX] = ""; /* default filename */
long current_addr; /* current address in editor buffer */ long current_addr; /* current address in editor buffer */
long addr_last; /* last address in editor buffer */ long addr_last; /* last address in editor buffer */
int lineno; /* script line number */ int lineno; /* script line number */
const char *prompt; /* command-line prompt */ static const char *prompt; /* command-line prompt */
const char *dps = "*"; /* default command-line prompt */ static const char *dps = "*"; /* default command-line prompt */
const char usage[] = "usage: %s [-] [-sx] [-p string] [file]\n"; static const char *usage = "usage: %s [-] [-sx] [-p string] [file]\n";
/* ed: line editor */ /* ed: line editor */
int int
@@ -254,7 +254,8 @@ main(volatile int argc, char ** volatile argv)
/*NOTREACHED*/ /*NOTREACHED*/
} }
long first_addr, second_addr, addr_cnt; long first_addr, second_addr;
static long addr_cnt;
/* extract_addr_range: get line addresses from the command buffer until an /* extract_addr_range: get line addresses from the command buffer until an
illegal address is seen; return status */ illegal address is seen; return status */
@@ -1241,8 +1242,8 @@ display_lines(long from, long to, int gflag)
#define MAXMARK 26 /* max number of marks */ #define MAXMARK 26 /* max number of marks */
line_t *mark[MAXMARK]; /* line markers */ static line_t *mark[MAXMARK]; /* line markers */
int markno; /* line marker count */ static int markno; /* line marker count */
/* mark_line_node: set a line node mark */ /* mark_line_node: set a line node mark */
int int
-3
View File
@@ -31,9 +31,6 @@ __FBSDID("$FreeBSD$");
#include "ed.h" #include "ed.h"
extern int patlock;
const char *errmsg = ""; const char *errmsg = "";
/* get_compiled_pattern: return pointer to compiled pattern from command /* get_compiled_pattern: return pointer to compiled pattern from command
+5 -5
View File
@@ -32,9 +32,9 @@ __FBSDID("$FreeBSD$");
#include "ed.h" #include "ed.h"
char *rhbuf; /* rhs substitution buffer */ static char *rhbuf; /* rhs substitution buffer */
int rhbufsz; /* rhs substitution buffer size */ static int rhbufsz; /* rhs substitution buffer size */
int rhbufi; /* rhs substitution buffer index */ static int rhbufi; /* rhs substitution buffer index */
/* extract_subst_tail: extract substitution tail from the command buffer */ /* extract_subst_tail: extract substitution tail from the command buffer */
int int
@@ -105,8 +105,8 @@ extract_subst_template(void)
} }
char *rbuf; /* substitute_matching_text buffer */ static char *rbuf; /* substitute_matching_text buffer */
int rbufsz; /* substitute_matching_text buffer size */ static int rbufsz; /* substitute_matching_text buffer size */
/* search_and_replace: for each line in a range, change text matching a pattern /* search_and_replace: for each line in a range, change text matching a pattern
according to a substitution template; return status */ according to a substitution template; return status */
+3 -3
View File
@@ -32,9 +32,9 @@ __FBSDID("$FreeBSD$");
#define USIZE 100 /* undo stack size */ #define USIZE 100 /* undo stack size */
undo_t *ustack = NULL; /* undo stack */ static undo_t *ustack = NULL; /* undo stack */
long usize = 0; /* stack size variable */ static long usize = 0; /* stack size variable */
long u_p = 0; /* undo stack pointer */ static long u_p = 0; /* undo stack pointer */
/* push_undo_stack: return pointer to initialized undo node */ /* push_undo_stack: return pointer to initialized undo node */
undo_t * undo_t *
+4
View File
@@ -97,6 +97,10 @@ then
reads a list of pathnames, each terminated by one newline character, reads a list of pathnames, each terminated by one newline character,
from the standard input. from the standard input.
.El .El
.Pp
For an explanation of the ACL syntax, see the
.Xr setfacl 1
manual page.
.Sh EXIT STATUS .Sh EXIT STATUS
.Ex -std .Ex -std
.Sh EXAMPLES .Sh EXAMPLES
+1 -1
View File
@@ -48,7 +48,7 @@ __FBSDID("$FreeBSD$");
#include <string.h> #include <string.h>
#include <unistd.h> #include <unistd.h>
int more_than_one = 0; static int more_than_one = 0;
static void static void
usage(void) usage(void)
+65 -1
View File
@@ -32,7 +32,7 @@
.\" @(#)ln.1 8.2 (Berkeley) 12/30/93 .\" @(#)ln.1 8.2 (Berkeley) 12/30/93
.\" $FreeBSD$ .\" $FreeBSD$
.\" .\"
.Dd July 17, 2009 .Dd November 2, 2012
.Dt LN 1 .Dt LN 1
.Os .Os
.Sh NAME .Sh NAME
@@ -212,6 +212,70 @@ No options may be supplied in this simple mode of operation,
which performs a which performs a
.Xr link 2 .Xr link 2
operation using the two passed arguments. operation using the two passed arguments.
.Sh EXAMPLES
Create a symbolic link named
.Pa /home/src
and point it to
.Pa /usr/src :
.Pp
.Dl # ln -s /usr/src /home/src
.Pp
Hard link
.Pa /usr/local/bin/fooprog
to file
.Pa /usr/local/bin/fooprog-1.0 :
.Pp
.Dl # ln /usr/local/bin/fooprog-1.0 /usr/local/bin/fooprog
.Pp
As an exercise, try the following commands:
.Bd -literal -offset indent
# ls -i /bin/[
11553 /bin/[
# ls -i /bin/test
11553 /bin/test
.Ed
.Pp
Note that both files have the same inode; that is,
.Pa /bin/[
is essentially an alias for the
.Xr test 1
command.
This hard link exists so
.Xr test 1
may be invoked from shell scripts, for example, using the
.Li "if [ ]"
construct.
.Pp
In the next example, the second call to
.Nm
removes the original
.Pa foo
and creates a replacement pointing to
.Pa baz :
.Bd -literal -offset indent
# mkdir bar baz
# ln -s bar foo
# ln -shf baz foo
.Ed
.Pp
Without the
.Fl h
option, this would instead leave
.Pa foo
pointing to
.Pa bar
and inside
.Pa foo
create a new symlink
.Pa baz
pointing to itself.
This results from directory-walking.
.Pp
An easy rule to remember is that the argument order for
.Nm
is the same as for
.Xr cp 1 :
The first argument needs to exist, the second one is created.
.Sh COMPATIBILITY .Sh COMPATIBILITY
The The
.Fl h , .Fl h ,
+6 -4
View File
@@ -561,7 +561,8 @@ display(const FTSENT *p, FTSENT *list, int options)
NAMES *np; NAMES *np;
off_t maxsize; off_t maxsize;
long maxblock; long maxblock;
u_long btotal, labelstrlen, maxinode, maxlen, maxnlink; uintmax_t maxinode;
u_long btotal, labelstrlen, maxlen, maxnlink;
u_long maxlabelstr; u_long maxlabelstr;
u_int sizelen; u_int sizelen;
int maxflags; int maxflags;
@@ -580,8 +581,9 @@ display(const FTSENT *p, FTSENT *list, int options)
btotal = 0; btotal = 0;
initmax = getenv("LS_COLWIDTHS"); initmax = getenv("LS_COLWIDTHS");
/* Fields match -lios order. New ones should be added at the end. */ /* Fields match -lios order. New ones should be added at the end. */
maxlabelstr = maxblock = maxinode = maxlen = maxnlink = maxlabelstr = maxblock = maxlen = maxnlink = 0;
maxuser = maxgroup = maxflags = maxsize = 0; maxuser = maxgroup = maxflags = maxsize = 0;
maxinode = 0;
if (initmax != NULL && *initmax != '\0') { if (initmax != NULL && *initmax != '\0') {
char *initmax2, *jinitmax; char *initmax2, *jinitmax;
int ninitmax; int ninitmax;
@@ -609,7 +611,7 @@ display(const FTSENT *p, FTSENT *list, int options)
strcpy(initmax2, "0"); strcpy(initmax2, "0");
ninitmax = sscanf(jinitmax, ninitmax = sscanf(jinitmax,
" %lu : %ld : %lu : %u : %u : %i : %jd : %lu : %lu ", " %ju : %ld : %lu : %u : %u : %i : %jd : %lu : %lu ",
&maxinode, &maxblock, &maxnlink, &maxuser, &maxinode, &maxblock, &maxnlink, &maxuser,
&maxgroup, &maxflags, &maxsize, &maxlen, &maxlabelstr); &maxgroup, &maxflags, &maxsize, &maxlen, &maxlabelstr);
f_notabs = 1; f_notabs = 1;
@@ -839,7 +841,7 @@ display(const FTSENT *p, FTSENT *list, int options)
d.s_flags = maxflags; d.s_flags = maxflags;
d.s_label = maxlabelstr; d.s_label = maxlabelstr;
d.s_group = maxgroup; d.s_group = maxgroup;
d.s_inode = snprintf(NULL, 0, "%lu", maxinode); d.s_inode = snprintf(NULL, 0, "%ju", maxinode);
d.s_nlink = snprintf(NULL, 0, "%lu", maxnlink); d.s_nlink = snprintf(NULL, 0, "%lu", maxnlink);
sizelen = f_humanval ? HUMANVALSTR_LEN : sizelen = f_humanval ? HUMANVALSTR_LEN :
snprintf(NULL, 0, "%ju", maxsize); snprintf(NULL, 0, "%ju", maxsize);
+4 -2
View File
@@ -152,7 +152,8 @@ printlong(const DISPLAY *dp)
continue; continue;
sp = p->fts_statp; sp = p->fts_statp;
if (f_inode) if (f_inode)
(void)printf("%*lu ", dp->s_inode, (u_long)sp->st_ino); (void)printf("%*ju ",
dp->s_inode, (uintmax_t)sp->st_ino);
if (f_size) if (f_size)
(void)printf("%*jd ", (void)printf("%*jd ",
dp->s_block, howmany(sp->st_blocks, blocksize)); dp->s_block, howmany(sp->st_blocks, blocksize));
@@ -328,7 +329,8 @@ printaname(const FTSENT *p, u_long inodefield, u_long sizefield)
sp = p->fts_statp; sp = p->fts_statp;
chcnt = 0; chcnt = 0;
if (f_inode) if (f_inode)
chcnt += printf("%*lu ", (int)inodefield, (u_long)sp->st_ino); chcnt += printf("%*ju ",
(int)inodefield, (uintmax_t)sp->st_ino);
if (f_size) if (f_size)
chcnt += printf("%*jd ", chcnt += printf("%*jd ",
(int)sizefield, howmany(sp->st_blocks, blocksize)); (int)sizefield, howmany(sp->st_blocks, blocksize));
+19 -3
View File
@@ -32,7 +32,7 @@
.\" @(#)mv.1 8.1 (Berkeley) 5/31/93 .\" @(#)mv.1 8.1 (Berkeley) 5/31/93
.\" $FreeBSD$ .\" $FreeBSD$
.\" .\"
.Dd May 12, 2007 .Dd August 28, 2012
.Dt MV 1 .Dt MV 1
.Os .Os
.Sh NAME .Sh NAME
@@ -41,7 +41,7 @@
.Sh SYNOPSIS .Sh SYNOPSIS
.Nm .Nm
.Op Fl f | i | n .Op Fl f | i | n
.Op Fl v .Op Fl hv
.Ar source target .Ar source target
.Nm .Nm
.Op Fl f | i | n .Op Fl f | i | n
@@ -81,6 +81,21 @@ option overrides any previous
or or
.Fl n .Fl n
options.) options.)
.It Fl h
If the
.Ar target
operand is a symbolic link to a directory,
do not follow it.
This causes the
.Nm
utility to rename the file
.Ar source
to the destination path
.Ar target
rather than moving
.Ar source
into the directory referenced by
.Ar target .
.It Fl i .It Fl i
Cause Cause
.Nm .Nm
@@ -142,7 +157,8 @@ rm -rf source_file
.Ex -std .Ex -std
.Sh COMPATIBILITY .Sh COMPATIBILITY
The The
.Fl n .Fl h ,
.Fl n ,
and and
.Fl v .Fl v
options are non-standard and their use in scripts is not recommended. options are non-standard and their use in scripts is not recommended.
+17 -3
View File
@@ -68,7 +68,7 @@ __FBSDID("$FreeBSD$");
/* Exit code for a failed exec. */ /* Exit code for a failed exec. */
#define EXEC_FAILED 127 #define EXEC_FAILED 127
static int fflg, iflg, nflg, vflg; static int fflg, hflg, iflg, nflg, vflg;
static int copy(const char *, const char *); static int copy(const char *, const char *);
static int do_move(const char *, const char *); static int do_move(const char *, const char *);
@@ -87,8 +87,11 @@ main(int argc, char *argv[])
int ch; int ch;
char path[PATH_MAX]; char path[PATH_MAX];
while ((ch = getopt(argc, argv, "finv")) != -1) while ((ch = getopt(argc, argv, "fhinv")) != -1)
switch (ch) { switch (ch) {
case 'h':
hflg = 1;
break;
case 'i': case 'i':
iflg = 1; iflg = 1;
fflg = nflg = 0; fflg = nflg = 0;
@@ -123,6 +126,17 @@ main(int argc, char *argv[])
exit(do_move(argv[0], argv[1])); exit(do_move(argv[0], argv[1]));
} }
/*
* If -h was specified, treat the target as a symlink instead of
* directory.
*/
if (hflg) {
if (argc > 2)
usage();
if (lstat(argv[1], &sb) == 0 && S_ISLNK(sb.st_mode))
exit(do_move(argv[0], argv[1]));
}
/* It's a directory, move each file into it. */ /* It's a directory, move each file into it. */
if (strlen(argv[argc - 1]) > sizeof(path) - 1) if (strlen(argv[argc - 1]) > sizeof(path) - 1)
errx(1, "%s: destination pathname too long", *argv); errx(1, "%s: destination pathname too long", *argv);
@@ -483,7 +497,7 @@ usage(void)
{ {
(void)fprintf(stderr, "%s\n%s\n", (void)fprintf(stderr, "%s\n%s\n",
"usage: mv [-f | -i | -n] [-v] source target", "usage: mv [-f | -i | -n] [-hv] source target",
" mv [-f | -i | -n] [-v] source ... directory"); " mv [-f | -i | -n] [-v] source ... directory");
exit(EX_USAGE); exit(EX_USAGE);
} }
-1
View File
@@ -85,7 +85,6 @@ const char *gzip_program; /* name of gzip program */
static pid_t zpid = -1; /* pid of child process */ static pid_t zpid = -1; /* pid of child process */
static int get_phys(void); static int get_phys(void);
extern sigset_t s_mask;
static void ar_start_gzip(int, const char *, int); static void ar_start_gzip(int, const char *, int);
/* /*
-1
View File
@@ -55,7 +55,6 @@ __FBSDID("$FreeBSD$");
static void wr_archive(ARCHD *, int is_app); static void wr_archive(ARCHD *, int is_app);
static int get_arc(void); static int get_arc(void);
static int next_head(ARCHD *); static int next_head(ARCHD *);
extern sigset_t s_mask;
/* /*
* Routines which control the overall operation modes of pax as specified by * Routines which control the overall operation modes of pax as specified by
+2 -1
View File
@@ -186,7 +186,7 @@ void options(int, char **);
OPLIST * opt_next(void); OPLIST * opt_next(void);
int opt_add(const char *); int opt_add(const char *);
int bad_opt(void); int bad_opt(void);
char *chdname; extern char *chdname;
/* /*
* pat_rep.c * pat_rep.c
@@ -231,6 +231,7 @@ extern int exit_val;
extern int docrc; extern int docrc;
extern char *dirptr; extern char *dirptr;
extern const char *argv0; extern const char *argv0;
extern sigset_t s_mask;
extern FILE *listf; extern FILE *listf;
extern char *tempfile; extern char *tempfile;
extern char *tempbase; extern char *tempbase;
+1
View File
@@ -81,6 +81,7 @@ static void cpio_usage(void);
#define GETLINE_OUT_OF_MEM 2 #define GETLINE_OUT_OF_MEM 2
static int getline_error; static int getline_error;
char *chdname;
#define GZIP_CMD "gzip" /* command to run as gzip */ #define GZIP_CMD "gzip" /* command to run as gzip */
#define COMPRESS_CMD "compress" /* command to run as compress */ #define COMPRESS_CMD "compress" /* command to run as compress */
+2
View File
@@ -79,6 +79,7 @@ static VAR var[] = {
{"cow", "COW", NULL, 0, kvar, KOFF(ki_cow), UINT, "u", 0}, {"cow", "COW", NULL, 0, kvar, KOFF(ki_cow), UINT, "u", 0},
{"cpu", "CPU", NULL, 0, kvar, KOFF(ki_estcpu), UINT, "d", 0}, {"cpu", "CPU", NULL, 0, kvar, KOFF(ki_estcpu), UINT, "d", 0},
{"cputime", "", "time", 0, NULL, 0, CHAR, NULL, 0}, {"cputime", "", "time", 0, NULL, 0, CHAR, NULL, 0},
{"dsiz", "DSIZ", NULL, 0, kvar, KOFF(ki_dsize), PGTOK, "ld", 0},
{"egid", "", "gid", 0, NULL, 0, CHAR, NULL, 0}, {"egid", "", "gid", 0, NULL, 0, CHAR, NULL, 0},
{"egroup", "", "group", 0, NULL, 0, CHAR, NULL, 0}, {"egroup", "", "group", 0, NULL, 0, CHAR, NULL, 0},
{"emul", "EMUL", NULL, LJUST, emulname, 0, CHAR, NULL, 0}, {"emul", "EMUL", NULL, LJUST, emulname, 0, CHAR, NULL, 0},
@@ -141,6 +142,7 @@ static VAR var[] = {
UINT, "x", 0}, UINT, "x", 0},
{"sigmask", "BLOCKED", NULL, 0, kvar, KOFF(ki_sigmask), UINT, "x", 0}, {"sigmask", "BLOCKED", NULL, 0, kvar, KOFF(ki_sigmask), UINT, "x", 0},
{"sl", "SL", NULL, INF127, kvar, KOFF(ki_slptime), UINT, "d", 0}, {"sl", "SL", NULL, INF127, kvar, KOFF(ki_slptime), UINT, "d", 0},
{"ssiz", "SSIZ", NULL, 0, kvar, KOFF(ki_ssize), PGTOK, "ld", 0},
{"start", "STARTED", NULL, LJUST|USER, started, 0, CHAR, NULL, 0}, {"start", "STARTED", NULL, LJUST|USER, started, 0, CHAR, NULL, 0},
{"stat", "", "state", 0, NULL, 0, CHAR, NULL, 0}, {"stat", "", "state", 0, NULL, 0, CHAR, NULL, 0},
{"state", "STAT", NULL, LJUST, state, 0, CHAR, NULL, 0}, {"state", "STAT", NULL, LJUST, state, 0, CHAR, NULL, 0},
+6 -4
View File
@@ -387,12 +387,13 @@ started(KINFO *k, VARENT *ve __unused)
size_t buflen = 100; size_t buflen = 100;
char *buf; char *buf;
if (!k->ki_valid)
return (NULL);
buf = malloc(buflen); buf = malloc(buflen);
if (buf == NULL) if (buf == NULL)
errx(1, "malloc failed"); errx(1, "malloc failed");
if (!k->ki_valid)
return (NULL);
if (use_ampm < 0) if (use_ampm < 0)
use_ampm = (*nl_langinfo(T_FMT_AMPM) != '\0'); use_ampm = (*nl_langinfo(T_FMT_AMPM) != '\0');
then = k->ki_p->ki_start.tv_sec; then = k->ki_p->ki_start.tv_sec;
@@ -415,12 +416,13 @@ lstarted(KINFO *k, VARENT *ve __unused)
char *buf; char *buf;
size_t buflen = 100; size_t buflen = 100;
if (!k->ki_valid)
return (NULL);
buf = malloc(buflen); buf = malloc(buflen);
if (buf == NULL) if (buf == NULL)
errx(1, "malloc failed"); errx(1, "malloc failed");
if (!k->ki_valid)
return (NULL);
then = k->ki_p->ki_start.tv_sec; then = k->ki_p->ki_start.tv_sec;
(void)strftime(buf, buflen, "%c", localtime(&then)); (void)strftime(buf, buflen, "%c", localtime(&then));
return (buf); return (buf);
+5 -1
View File
@@ -29,7 +29,7 @@
.\" @(#)ps.1 8.3 (Berkeley) 4/18/94 .\" @(#)ps.1 8.3 (Berkeley) 4/18/94
.\" $FreeBSD$ .\" $FreeBSD$
.\" .\"
.Dd May 20, 2012 .Dd September 18, 2012
.Dt PS 1 .Dt PS 1
.Os .Os
.Sh NAME .Sh NAME
@@ -500,6 +500,8 @@ command and arguments
number of copy-on-write faults number of copy-on-write faults
.It Cm cpu .It Cm cpu
short-term CPU usage factor (for scheduling) short-term CPU usage factor (for scheduling)
.It Cm dsiz
data size (in Kbytes)
.It Cm emul .It Cm emul
system-call emulation environment system-call emulation environment
.It Cm etime .It Cm etime
@@ -610,6 +612,8 @@ blocked signals (alias
.Cm blocked ) .Cm blocked )
.It Cm sl .It Cm sl
sleep time (in seconds; 127 = infinity) sleep time (in seconds; 127 = infinity)
.It Cm ssiz
stack size (in Kbytes)
.It Cm start .It Cm start
time started time started
.It Cm state .It Cm state
+2 -2
View File
@@ -889,8 +889,8 @@ add_list(struct listinfo *inf, const char *argp)
int toolong; int toolong;
char elemcopy[PATH_MAX]; char elemcopy[PATH_MAX];
if (*argp == 0) if (*argp == '\0')
inf->addelem(inf, elemcopy); inf->addelem(inf, argp);
while (*argp != '\0') { while (*argp != '\0') {
while (*argp != '\0' && strchr(W_SEP, *argp) != NULL) while (*argp != '\0' && strchr(W_SEP, *argp) != NULL)
argp++; argp++;
-6
View File
@@ -116,17 +116,11 @@ The
.Nm .Nm
utility handles third party copies, where neither source nor target files utility handles third party copies, where neither source nor target files
are on the current machine. are on the current machine.
.Sh FILES
.Bl -tag -width ".Pa /etc/auth.conf" -compact
.It Pa /etc/auth.conf
configure authentication services
.El
.Sh SEE ALSO .Sh SEE ALSO
.Xr cp 1 , .Xr cp 1 ,
.Xr ftp 1 , .Xr ftp 1 ,
.Xr rlogin 1 , .Xr rlogin 1 ,
.Xr rsh 1 , .Xr rsh 1 ,
.Xr auth.conf 5 ,
.Xr hosts.equiv 5 .Xr hosts.equiv 5
.Sh HISTORY .Sh HISTORY
The The
+8 -7
View File
@@ -76,12 +76,13 @@ __FBSDID("$FreeBSD$");
#define OPTIONS "46dfprt" #define OPTIONS "46dfprt"
struct passwd *pwd; static struct passwd *pwd;
u_short port; static u_short port;
uid_t userid; static uid_t userid;
int errs, rem; static int errs, rem;
int pflag, iamremote, iamrecursive, targetshouldbedirectory; int iamremote;
int family = PF_UNSPEC; static int pflag, iamrecursive, targetshouldbedirectory;
static int family = PF_UNSPEC;
static int argc_copy; static int argc_copy;
static const char **argv_copy; static const char **argv_copy;
@@ -89,7 +90,7 @@ static const char **argv_copy;
static char period[] = "."; static char period[] = ".";
#define CMDNEEDS 64 #define CMDNEEDS 64
char cmd[CMDNEEDS]; /* must hold "rcp -r -p -d\0" */ static char cmd[CMDNEEDS]; /* must hold "rcp -r -p -d\0" */
int response(void); int response(void);
void rsource(char *, struct stat *); void rsource(char *, struct stat *);
+20 -6
View File
@@ -51,6 +51,7 @@ __FBSDID("$FreeBSD$");
#include <fts.h> #include <fts.h>
#include <grp.h> #include <grp.h>
#include <pwd.h> #include <pwd.h>
#include <stdint.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
@@ -301,10 +302,16 @@ rm_tree(char **argv)
if (fflag) if (fflag)
continue; continue;
/* FALLTHROUGH */ /* FALLTHROUGH */
default:
case FTS_F:
case FTS_NSOK:
if (Pflag) if (Pflag)
if (!rm_overwrite(p->fts_accpath, NULL)) if (!rm_overwrite(p->fts_accpath, p->fts_info ==
FTS_NSOK ? NULL : p->fts_statp))
continue; continue;
/* FALLTHROUGH */
default:
rval = unlink(p->fts_accpath); rval = unlink(p->fts_accpath);
if (rval == 0 || (fflag && errno == ENOENT)) { if (rval == 0 || (fflag && errno == ENOENT)) {
if (rval == 0 && vflag) if (rval == 0 && vflag)
@@ -408,7 +415,7 @@ rm_file(char **argv)
int int
rm_overwrite(char *file, struct stat *sbp) rm_overwrite(char *file, struct stat *sbp)
{ {
struct stat sb; struct stat sb, sb2;
struct statfs fsb; struct statfs fsb;
off_t len; off_t len;
int bsize, fd, wlen; int bsize, fd, wlen;
@@ -423,12 +430,19 @@ rm_overwrite(char *file, struct stat *sbp)
if (!S_ISREG(sbp->st_mode)) if (!S_ISREG(sbp->st_mode))
return (1); return (1);
if (sbp->st_nlink > 1 && !fflag) { if (sbp->st_nlink > 1 && !fflag) {
warnx("%s (inode %u): not overwritten due to multiple links", warnx("%s (inode %ju): not overwritten due to multiple links",
file, sbp->st_ino); file, (uintmax_t)sbp->st_ino);
return (0); return (0);
} }
if ((fd = open(file, O_WRONLY, 0)) == -1) if ((fd = open(file, O_WRONLY|O_NONBLOCK|O_NOFOLLOW, 0)) == -1)
goto err; goto err;
if (fstat(fd, &sb2))
goto err;
if (sb2.st_dev != sbp->st_dev || sb2.st_ino != sbp->st_ino ||
!S_ISREG(sb2.st_mode)) {
errno = EPERM;
goto err;
}
if (fstatfs(fd, &fsb) == -1) if (fstatfs(fd, &fsb) == -1)
goto err; goto err;
bsize = MAX(fsb.f_iosize, 1024); bsize = MAX(fsb.f_iosize, 1024);
+4 -3
View File
@@ -94,7 +94,7 @@ merge_acl(acl_t acl, acl_t *prev_acl, const char *filename)
acl_tag_t tag, tag_new; acl_tag_t tag, tag_new;
acl_entry_type_t entry_type, entry_type_new; acl_entry_type_t entry_type, entry_type_new;
acl_flagset_t flagset; acl_flagset_t flagset;
int entry_id, entry_id_new, have_entry, entry_number = 0; int entry_id, entry_id_new, have_entry, had_entry, entry_number = 0;
int acl_brand, prev_acl_brand; int acl_brand, prev_acl_brand;
acl_get_brand_np(acl, &acl_brand); acl_get_brand_np(acl, &acl_brand);
@@ -116,6 +116,7 @@ merge_acl(acl_t acl, acl_t *prev_acl, const char *filename)
while (acl_get_entry(acl, entry_id, &entry) == 1) { while (acl_get_entry(acl, entry_id, &entry) == 1) {
entry_id = ACL_NEXT_ENTRY; entry_id = ACL_NEXT_ENTRY;
have_entry = 0; have_entry = 0;
had_entry = 0;
/* keep track of existing ACL_MASK entries */ /* keep track of existing ACL_MASK entries */
if (acl_get_tag_type(entry, &tag) == -1) if (acl_get_tag_type(entry, &tag) == -1)
@@ -187,7 +188,7 @@ merge_acl(acl_t acl, acl_t *prev_acl, const char *filename)
err(1, "%s: acl_set_flagset_np() failed", err(1, "%s: acl_set_flagset_np() failed",
filename); filename);
} }
have_entry = 1; had_entry = have_entry = 1;
break; break;
default: default:
/* should never be here */ /* should never be here */
@@ -197,7 +198,7 @@ merge_acl(acl_t acl, acl_t *prev_acl, const char *filename)
} }
/* if this entry has not been found, it must be new */ /* if this entry has not been found, it must be new */
if (have_entry == 0) { if (had_entry == 0) {
/* /*
* NFSv4 ACL entries must be prepended to the ACL. * NFSv4 ACL entries must be prepended to the ACL.
+2 -2
View File
@@ -26,7 +26,7 @@
.\" .\"
.\" $FreeBSD$ .\" $FreeBSD$
.\" .\"
.Dd April 9, 2011 .Dd September 2, 2012
.Dt SETFACL 1 .Dt SETFACL 1
.Os .Os
.Sh NAME .Sh NAME
@@ -337,7 +337,7 @@ read_acl
write_acl write_acl
.It o .It o
write_owner write_owner
.It S .It s
synchronize synchronize
.El .El
.Pp .Pp
+55
View File
@@ -42,6 +42,35 @@ __FBSDID("$FreeBSD$");
#include "setfacl.h" #include "setfacl.h"
/* file operations */
#define OP_MERGE_ACL 0x00 /* merge acl's (-mM) */
#define OP_REMOVE_DEF 0x01 /* remove default acl's (-k) */
#define OP_REMOVE_EXT 0x02 /* remove extended acl's (-b) */
#define OP_REMOVE_ACL 0x03 /* remove acl's (-xX) */
#define OP_REMOVE_BY_NUMBER 0x04 /* remove acl's (-xX) by acl entry number */
#define OP_ADD_ACL 0x05 /* add acls entries at a given position */
/* TAILQ entry for acl operations */
struct sf_entry {
uint op;
acl_t acl;
uint entry_number;
TAILQ_ENTRY(sf_entry) next;
};
static TAILQ_HEAD(, sf_entry) entrylist;
/* TAILQ entry for files */
struct sf_file {
const char *filename;
TAILQ_ENTRY(sf_file) next;
};
static TAILQ_HEAD(, sf_file) filelist;
uint have_mask;
uint need_mask;
uint have_stdin;
uint n_flag;
static void add_filename(const char *filename); static void add_filename(const char *filename);
static void usage(void); static void usage(void);
@@ -73,6 +102,7 @@ main(int argc, char *argv[])
{ {
acl_t acl; acl_t acl;
acl_type_t acl_type; acl_type_t acl_type;
acl_entry_t unused_entry;
char filename[PATH_MAX]; char filename[PATH_MAX];
int local_error, carried_error, ch, i, entry_number, ret; int local_error, carried_error, ch, i, entry_number, ret;
int h_flag; int h_flag;
@@ -263,6 +293,17 @@ main(int argc, char *argv[])
need_mask = 1; need_mask = 1;
break; break;
case OP_REMOVE_EXT: case OP_REMOVE_EXT:
/*
* Don't try to call remove_ext() for empty
* default ACL.
*/
if (acl_type == ACL_TYPE_DEFAULT &&
acl_get_entry(acl, ACL_FIRST_ENTRY,
&unused_entry) == 0) {
local_error += remove_default(&acl,
file->filename);
break;
}
remove_ext(&acl, file->filename); remove_ext(&acl, file->filename);
need_mask = 0; need_mask = 0;
break; break;
@@ -296,6 +337,20 @@ main(int argc, char *argv[])
} }
} }
/*
* Don't try to set an empty default ACL; it will always fail.
* Use acl_delete_def_file(3) instead.
*/
if (acl_type == ACL_TYPE_DEFAULT &&
acl_get_entry(acl, ACL_FIRST_ENTRY, &unused_entry) == 0) {
if (acl_delete_def_file(file->filename) == -1) {
warn("%s: acl_delete_def_file() failed",
file->filename);
carried_error++;
}
continue;
}
/* don't bother setting the ACL if something is broken */ /* don't bother setting the ACL if something is broken */
if (local_error) { if (local_error) {
carried_error++; carried_error++;
+4 -28
View File
@@ -33,30 +33,6 @@
#include <sys/acl.h> #include <sys/acl.h>
#include <sys/queue.h> #include <sys/queue.h>
/* file operations */
#define OP_MERGE_ACL 0x00 /* merge acl's (-mM) */
#define OP_REMOVE_DEF 0x01 /* remove default acl's (-k) */
#define OP_REMOVE_EXT 0x02 /* remove extended acl's (-b) */
#define OP_REMOVE_ACL 0x03 /* remove acl's (-xX) */
#define OP_REMOVE_BY_NUMBER 0x04 /* remove acl's (-xX) by acl entry number */
#define OP_ADD_ACL 0x05 /* add acls entries at a given position */
/* TAILQ entry for acl operations */
struct sf_entry {
uint op;
acl_t acl;
uint entry_number;
TAILQ_ENTRY(sf_entry) next;
};
TAILQ_HEAD(, sf_entry) entrylist;
/* TAILQ entry for files */
struct sf_file {
const char *filename;
TAILQ_ENTRY(sf_file) next;
};
TAILQ_HEAD(, sf_file) filelist;
/* files.c */ /* files.c */
acl_t get_acl_from_file(const char *filename); acl_t get_acl_from_file(const char *filename);
/* merge.c */ /* merge.c */
@@ -74,9 +50,9 @@ void *zmalloc(size_t size);
const char *brand_name(int brand); const char *brand_name(int brand);
int branding_mismatch(int brand1, int brand2); int branding_mismatch(int brand1, int brand2);
uint have_mask; extern uint have_mask;
uint need_mask; extern uint need_mask;
uint have_stdin; extern uint have_stdin;
uint n_flag; extern uint n_flag;
#endif /* _SETFACL_H */ #endif /* _SETFACL_H */
+7 -19
View File
@@ -79,7 +79,7 @@ static char *prevdir; /* previous working directory */
static char *cdcomppath; static char *cdcomppath;
int int
cdcmd(int argc, char **argv) cdcmd(int argc __unused, char **argv __unused)
{ {
const char *dest; const char *dest;
const char *path; const char *path;
@@ -89,9 +89,8 @@ cdcmd(int argc, char **argv)
int rc; int rc;
int errno1 = ENOENT; int errno1 = ENOENT;
optreset = 1; optind = 1; opterr = 0; /* initialize getopt */
phys = Pflag; phys = Pflag;
while ((ch = getopt(argc, argv, "eLP")) != -1) { while ((ch = nextopt("eLP")) != '\0') {
switch (ch) { switch (ch) {
case 'e': case 'e':
getcwderr = 1; getcwderr = 1;
@@ -102,18 +101,13 @@ cdcmd(int argc, char **argv)
case 'P': case 'P':
phys = 1; phys = 1;
break; break;
default:
error("unknown option: -%c", optopt);
break;
} }
} }
argc -= optind;
argv += optind;
if (argc > 1) if (*argptr != NULL && argptr[1] != NULL)
error("too many arguments"); error("too many arguments");
if ((dest = *argv) == NULL && (dest = bltinlookup("HOME", 1)) == NULL) if ((dest = *argptr) == NULL && (dest = bltinlookup("HOME", 1)) == NULL)
error("HOME not set"); error("HOME not set");
if (*dest == '\0') if (*dest == '\0')
dest = "."; dest = ".";
@@ -330,14 +324,13 @@ updatepwd(char *dir)
} }
int int
pwdcmd(int argc, char **argv) pwdcmd(int argc __unused, char **argv __unused)
{ {
char *p; char *p;
int ch, phys; int ch, phys;
optreset = 1; optind = 1; opterr = 0; /* initialize getopt */
phys = Pflag; phys = Pflag;
while ((ch = getopt(argc, argv, "LP")) != -1) { while ((ch = nextopt("LP")) != '\0') {
switch (ch) { switch (ch) {
case 'L': case 'L':
phys = 0; phys = 0;
@@ -345,15 +338,10 @@ pwdcmd(int argc, char **argv)
case 'P': case 'P':
phys = 1; phys = 1;
break; break;
default:
error("unknown option: -%c", optopt);
break;
} }
} }
argc -= optind;
argv += optind;
if (argc != 0) if (*argptr != NULL)
error("too many arguments"); error("too many arguments");
if (!phys && getpwd()) { if (!phys && getpwd()) {
+55 -15
View File
@@ -672,6 +672,52 @@ evalbackcmd(union node *n, struct backcmd *result)
result->fd, result->buf, result->nleft, result->jp)); result->fd, result->buf, result->nleft, result->jp));
} }
static int
mustexpandto(const char *argtext, const char *mask)
{
for (;;) {
if (*argtext == CTLQUOTEMARK || *argtext == CTLQUOTEEND) {
argtext++;
continue;
}
if (*argtext == CTLESC)
argtext++;
else if (BASESYNTAX[(int)*argtext] == CCTL)
return (0);
if (*argtext != *mask)
return (0);
if (*argtext == '\0')
return (1);
argtext++;
mask++;
}
}
static int
isdeclarationcmd(struct narg *arg)
{
int have_command = 0;
if (arg == NULL)
return (0);
while (mustexpandto(arg->text, "command")) {
have_command = 1;
arg = &arg->next->narg;
if (arg == NULL)
return (0);
/*
* To also allow "command -p" and "command --" as part of
* a declaration command, add code here.
* We do not do this, as ksh does not do it either and it
* is not required by POSIX.
*/
}
return (mustexpandto(arg->text, "export") ||
mustexpandto(arg->text, "readonly") ||
(mustexpandto(arg->text, "local") &&
(have_command || !isfunc("local"))));
}
/* /*
* Check if a builtin can safely be executed in the same process, * Check if a builtin can safely be executed in the same process,
* even though it should be in a subshell (command substitution). * even though it should be in a subshell (command substitution).
@@ -743,11 +789,12 @@ evalcommand(union node *cmd, int flags, struct backcmd *backcmd)
exitstatus = 0; exitstatus = 0;
for (argp = cmd->ncmd.args ; argp ; argp = argp->narg.next) { for (argp = cmd->ncmd.args ; argp ; argp = argp->narg.next) {
if (varflag && isassignment(argp->narg.text)) { if (varflag && isassignment(argp->narg.text)) {
expandarg(argp, &varlist, EXP_VARTILDE); expandarg(argp, varflag == 1 ? &varlist : &arglist,
EXP_VARTILDE);
continue; continue;
} } else if (varflag == 1)
varflag = isdeclarationcmd(&argp->narg) ? 2 : 0;
expandarg(argp, &arglist, EXP_FULL | EXP_TILDE); expandarg(argp, &arglist, EXP_FULL | EXP_TILDE);
varflag = 0;
} }
*arglist.lastp = NULL; *arglist.lastp = NULL;
*varlist.lastp = NULL; *varlist.lastp = NULL;
@@ -1176,7 +1223,7 @@ breakcmd(int argc, char **argv)
* The `command' command. * The `command' command.
*/ */
int int
commandcmd(int argc, char **argv) commandcmd(int argc __unused, char **argv __unused)
{ {
const char *path; const char *path;
int ch; int ch;
@@ -1184,9 +1231,7 @@ commandcmd(int argc, char **argv)
path = bltinlookup("PATH", 1); path = bltinlookup("PATH", 1);
optind = optreset = 1; while ((ch = nextopt("pvV")) != '\0') {
opterr = 0;
while ((ch = getopt(argc, argv, "pvV")) != -1) {
switch (ch) { switch (ch) {
case 'p': case 'p':
path = _PATH_STDPATH; path = _PATH_STDPATH;
@@ -1197,20 +1242,15 @@ commandcmd(int argc, char **argv)
case 'V': case 'V':
cmd = TYPECMD_BIGV; cmd = TYPECMD_BIGV;
break; break;
case '?':
default:
error("unknown option: -%c", optopt);
} }
} }
argc -= optind;
argv += optind;
if (cmd != -1) { if (cmd != -1) {
if (argc != 1) if (*argptr == NULL || argptr[1] != NULL)
error("wrong number of arguments"); error("wrong number of arguments");
return typecmd_impl(2, argv - 1, cmd, path); return typecmd_impl(2, argptr - 1, cmd, path);
} }
if (argc != 0) if (*argptr != NULL)
error("commandcmd bad call"); error("commandcmd bad call");
/* /*
+13
View File
@@ -648,6 +648,19 @@ unsetfunc(const char *name)
return (0); return (0);
} }
/*
* Check if a function by a certain name exists.
*/
int
isfunc(const char *name)
{
struct tblentry *cmdp;
cmdp = cmdlookup(name, 0);
return (cmdp != NULL && cmdp->cmdtype == CMDFUNCTION);
}
/* /*
* Shared code for the following builtin commands: * Shared code for the following builtin commands:
* type, command -v, command -V * type, command -v, command -V
+1
View File
@@ -72,5 +72,6 @@ void hashcd(void);
void changepath(const char *); void changepath(const char *);
void defun(const char *, union node *); void defun(const char *, union node *);
int unsetfunc(const char *); int unsetfunc(const char *);
int isfunc(const char *);
int typecmd_impl(int, char **, int, const char *); int typecmd_impl(int, char **, int, const char *);
void clearcmdentry(void); void clearcmdentry(void);
+15 -29
View File
@@ -182,7 +182,7 @@ setterm(const char *term)
} }
int int
histcmd(int argc, char **argv) histcmd(int argc, char **argv __unused)
{ {
int ch; int ch;
const char *editor = NULL; const char *editor = NULL;
@@ -206,13 +206,10 @@ histcmd(int argc, char **argv)
if (argc == 1) if (argc == 1)
error("missing history argument"); error("missing history argument");
optreset = 1; optind = 1; /* initialize getopt */ while (not_fcnumber(*argptr) && (ch = nextopt("e:lnrs")) != '\0')
opterr = 0;
while (not_fcnumber(argv[optind]) &&
(ch = getopt(argc, argv, ":e:lnrs")) != -1)
switch ((char)ch) { switch ((char)ch) {
case 'e': case 'e':
editor = optarg; editor = shoptarg;
break; break;
case 'l': case 'l':
lflg = 1; lflg = 1;
@@ -226,13 +223,7 @@ histcmd(int argc, char **argv)
case 's': case 's':
sflg = 1; sflg = 1;
break; break;
case ':':
error("option -%c expects argument", optopt);
case '?':
default:
error("unknown option: -%c", optopt);
} }
argc -= optind, argv += optind;
savehandler = handler; savehandler = handler;
/* /*
@@ -276,31 +267,26 @@ histcmd(int argc, char **argv)
/* /*
* If executing, parse [old=new] now * If executing, parse [old=new] now
*/ */
if (lflg == 0 && argc > 0 && if (lflg == 0 && *argptr != NULL &&
((repl = strchr(argv[0], '=')) != NULL)) { ((repl = strchr(*argptr, '=')) != NULL)) {
pat = argv[0]; pat = *argptr;
*repl++ = '\0'; *repl++ = '\0';
argc--, argv++; argptr++;
} }
/* /*
* determine [first] and [last] * determine [first] and [last]
*/ */
switch (argc) { if (*argptr == NULL) {
case 0:
firststr = lflg ? "-16" : "-1"; firststr = lflg ? "-16" : "-1";
laststr = "-1"; laststr = "-1";
break; } else if (argptr[1] == NULL) {
case 1: firststr = argptr[0];
firststr = argv[0]; laststr = lflg ? "-1" : argptr[0];
laststr = lflg ? "-1" : argv[0]; } else if (argptr[2] == NULL) {
break; firststr = argptr[0];
case 2: laststr = argptr[1];
firststr = argv[0]; } else
laststr = argv[1];
break;
default:
error("too many arguments"); error("too many arguments");
}
/* /*
* Turn into event numbers. * Turn into event numbers.
*/ */
+1 -1
View File
@@ -186,7 +186,7 @@ preadfd(void)
if (rl_cp == NULL) if (rl_cp == NULL)
rl_cp = el_gets(el, &el_len); rl_cp = el_gets(el, &el_len);
if (rl_cp == NULL) if (rl_cp == NULL)
nr = 0; nr = el_len == 0 ? 0 : -1;
else { else {
nr = el_len; nr = el_len;
if (nr > BUFSIZ) if (nr > BUFSIZ)
+58 -41
View File
@@ -84,10 +84,13 @@ static struct job *jobmru; /* most recently used job list */
static pid_t initialpgrp; /* pgrp of shell on invocation */ static pid_t initialpgrp; /* pgrp of shell on invocation */
#endif #endif
int in_waitcmd = 0; /* are we in waitcmd()? */ int in_waitcmd = 0; /* are we in waitcmd()? */
int in_dowait = 0; /* are we in dowait()? */
volatile sig_atomic_t breakwaitcmd = 0; /* should wait be terminated? */ volatile sig_atomic_t breakwaitcmd = 0; /* should wait be terminated? */
static int ttyfd = -1; 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 */
#if JOBS #if JOBS
static void restartjob(struct job *); static void restartjob(struct job *);
#endif #endif
@@ -95,7 +98,6 @@ static void freejob(struct job *);
static struct job *getjob(char *); static struct job *getjob(char *);
pid_t getjobpgrp(char *); pid_t getjobpgrp(char *);
static pid_t dowait(int, struct job *); static pid_t dowait(int, struct job *);
static pid_t waitproc(int, int *);
static void checkzombies(void); static void checkzombies(void);
static void cmdtxt(union node *); static void cmdtxt(union node *);
static void cmdputs(const char *); static void cmdputs(const char *);
@@ -248,15 +250,13 @@ restartjob(struct job *jp)
int int
jobscmd(int argc, char *argv[]) jobscmd(int argc __unused, char *argv[] __unused)
{ {
char *id; char *id;
int ch, mode; int ch, mode;
optind = optreset = 1;
opterr = 0;
mode = SHOWJOBS_DEFAULT; mode = SHOWJOBS_DEFAULT;
while ((ch = getopt(argc, argv, "lps")) != -1) { while ((ch = nextopt("lps")) != '\0') {
switch (ch) { switch (ch) {
case 'l': case 'l':
mode = SHOWJOBS_VERBOSE; mode = SHOWJOBS_VERBOSE;
@@ -267,18 +267,13 @@ jobscmd(int argc, char *argv[])
case 's': case 's':
mode = SHOWJOBS_PIDS; mode = SHOWJOBS_PIDS;
break; break;
case '?':
default:
error("unknown option: -%c", optopt);
} }
} }
argc -= optind;
argv += optind;
if (argc == 0) if (*argptr == NULL)
showjobs(0, mode); showjobs(0, mode);
else else
while ((id = *argv++) != NULL) while ((id = *argptr++) != NULL)
showjob(getjob(id), mode); showjob(getjob(id), mode);
return (0); return (0);
@@ -520,7 +515,7 @@ waitcmd(int argc, char **argv)
break; break;
} }
} }
} while (dowait(1, (struct job *)NULL) != -1); } while (dowait(DOWAIT_BLOCK | DOWAIT_SIG, (struct job *)NULL) != -1);
in_waitcmd--; in_waitcmd--;
return 0; return 0;
@@ -967,7 +962,7 @@ waitforjob(struct job *jp, int *origstatus)
INTOFF; INTOFF;
TRACE(("waitforjob(%%%td) called\n", jp - jobtab + 1)); TRACE(("waitforjob(%%%td) called\n", jp - jobtab + 1));
while (jp->state == 0) while (jp->state == 0)
if (dowait(1, jp) == -1) if (dowait(DOWAIT_BLOCK | (Tflag ? DOWAIT_SIG : 0), jp) == -1)
dotrap(); dotrap();
#if JOBS #if JOBS
if (jp->jobctl) { if (jp->jobctl) {
@@ -1005,14 +1000,20 @@ waitforjob(struct job *jp, int *origstatus)
} }
static void
dummy_handler(int sig)
{
}
/* /*
* Wait for a process to terminate. * Wait for a process to terminate.
*/ */
static pid_t static pid_t
dowait(int block, struct job *job) dowait(int mode, struct job *job)
{ {
struct sigaction sa, osa;
sigset_t mask, omask;
pid_t pid; pid_t pid;
int status; int status;
struct procstat *sp; struct procstat *sp;
@@ -1022,17 +1023,49 @@ dowait(int block, struct job *job)
int stopped; int stopped;
int sig; int sig;
int coredump; int coredump;
int wflags;
int restore_sigchld;
in_dowait++;
TRACE(("dowait(%d) called\n", block)); TRACE(("dowait(%d) called\n", block));
restore_sigchld = 0;
if ((mode & DOWAIT_SIG) != 0) {
sigfillset(&mask);
sigprocmask(SIG_BLOCK, &mask, &omask);
INTOFF;
if (!issigchldtrapped()) {
restore_sigchld = 1;
sa.sa_handler = dummy_handler;
sa.sa_flags = 0;
sigemptyset(&sa.sa_mask);
sigaction(SIGCHLD, &sa, &osa);
}
}
do { do {
pid = waitproc(block, &status); #if JOBS
if (iflag)
wflags = WUNTRACED | WCONTINUED;
else
#endif
wflags = 0;
if ((mode & (DOWAIT_BLOCK | DOWAIT_SIG)) != DOWAIT_BLOCK)
wflags |= WNOHANG;
pid = wait3(&status, wflags, (struct rusage *)NULL);
TRACE(("wait returns %d, status=%d\n", (int)pid, status)); TRACE(("wait returns %d, status=%d\n", (int)pid, status));
} while ((pid == -1 && errno == EINTR && breakwaitcmd == 0) || if (pid == 0 && (mode & DOWAIT_SIG) != 0) {
(pid > 0 && WIFSTOPPED(status) && !iflag)); sigsuspend(&omask);
in_dowait--; pid = -1;
if (int_pending())
break;
}
} while (pid == -1 && errno == EINTR && breakwaitcmd == 0);
if (pid == -1 && errno == ECHILD && job != NULL) if (pid == -1 && errno == ECHILD && job != NULL)
job->state = JOBDONE; job->state = JOBDONE;
if ((mode & DOWAIT_SIG) != 0) {
if (restore_sigchld)
sigaction(SIGCHLD, &osa, NULL);
sigprocmask(SIG_SETMASK, &omask, NULL);
INTON;
}
if (breakwaitcmd != 0) { if (breakwaitcmd != 0) {
breakwaitcmd = 0; breakwaitcmd = 0;
if (pid <= 0) if (pid <= 0)
@@ -1053,6 +1086,10 @@ dowait(int block, struct job *job)
TRACE(("Changing status of proc %d from 0x%x to 0x%x\n", TRACE(("Changing status of proc %d from 0x%x to 0x%x\n",
(int)pid, sp->status, (int)pid, sp->status,
status)); status));
if (WIFCONTINUED(status)) {
sp->status = -1;
jp->state = 0;
} else
sp->status = status; sp->status = status;
thisjob = jp; thisjob = jp;
} }
@@ -1110,26 +1147,6 @@ dowait(int block, struct job *job)
/*
* Do a wait system call. If job control is compiled in, we accept
* stopped processes. If block is zero, we return a value of zero
* rather than blocking.
*/
static pid_t
waitproc(int block, int *status)
{
int flags;
#if JOBS
flags = WUNTRACED;
#else
flags = 0;
#endif
if (block == 0)
flags |= WNOHANG;
return wait3(status, flags, (struct rusage *)NULL);
}
/* /*
* return 1 if there are stopped jobs, otherwise 0 * return 1 if there are stopped jobs, otherwise 0
*/ */
-1
View File
@@ -84,7 +84,6 @@ enum {
extern int job_warning; /* user was warned about stopped jobs */ extern int job_warning; /* user was warned about stopped jobs */
extern int in_waitcmd; /* are we in waitcmd()? */ extern int in_waitcmd; /* are we in waitcmd()? */
extern int in_dowait; /* are we in dowait()? */
extern volatile sig_atomic_t breakwaitcmd; /* break wait to process traps? */ extern volatile sig_atomic_t breakwaitcmd; /* break wait to process traps? */
void setjobctl(int); void setjobctl(int);
+1 -8
View File
@@ -266,14 +266,7 @@ read_profile(char *name)
void void
readcmdfile(const char *name) readcmdfile(const char *name)
{ {
int fd; setinputfile(name, 1);
INTOFF;
if ((fd = open(name, O_RDONLY)) >= 0)
setinputfd(fd, 1);
else
error("cannot open %s: %s", name, strerror(errno));
INTON;
cmdloop(0); cmdloop(0);
popfile(); popfile();
} }
-4
View File
@@ -531,10 +531,6 @@ getopts(char *optstr, char *optvar, char **optfirst, char ***optnext,
} }
/* /*
* XXX - should get rid of. have all builtins use getopt(3). the
* library getopt must have the BSD extension static variable "optreset"
* otherwise it can't be used within the shell safely.
*
* Standard option processing (a la getopt) for builtin routines. The * Standard option processing (a la getopt) for builtin routines. The
* only argument that is passed to nextopt is the option string; the * only argument that is passed to nextopt is the option string; the
* other arguments are unnecessary. It return the character, or '\0' on * other arguments are unnecessary. It return the character, or '\0' on
+19 -4
View File
@@ -32,7 +32,7 @@
.\" from: @(#)sh.1 8.6 (Berkeley) 5/4/95 .\" from: @(#)sh.1 8.6 (Berkeley) 5/4/95
.\" $FreeBSD$ .\" $FreeBSD$
.\" .\"
.Dd November 5, 2011 .Dd July 15, 2012
.Dt SH 1 .Dt SH 1
.Os .Os
.Sh NAME .Sh NAME
@@ -487,8 +487,9 @@ and backslash
The backslash inside double quotes is historically weird. The backslash inside double quotes is historically weird.
It remains literal unless it precedes the following characters, It remains literal unless it precedes the following characters,
which it serves to quote: which it serves to quote:
.Pp
.Bl -column "XXX" "XXX" "XXX" "XXX" "XXX" -offset center -compact .Bl -column "XXX" "XXX" "XXX" "XXX" "XXX" -offset center -compact
.It Li $ Ta Li ` Ta Li \&" Ta Li \e\ Ta Li \en .It Li $ Ta Li ` Ta Li \&" Ta Li \e Ta Li \en
.El .El
.It Backslash .It Backslash
A backslash preserves the literal meaning of the following A backslash preserves the literal meaning of the following
@@ -648,8 +649,8 @@ The following redirection is often called a
.Dq here-document . .Dq here-document .
.Bd -unfilled -offset indent .Bd -unfilled -offset indent
.Oo Ar n Oc Ns Li << Ar delimiter .Oo Ar n Oc Ns Li << Ar delimiter
.D1 Ar here-doc-text .Ar here-doc-text
.D1 ... .Ar ...
.Ar delimiter .Ar delimiter
.Ed .Ed
.Pp .Pp
@@ -1164,6 +1165,20 @@ Assignments are expanded differently from other words:
tilde expansion is also performed after the equals sign and after any colon tilde expansion is also performed after the equals sign and after any colon
and usernames are also terminated by colons, and usernames are also terminated by colons,
and field splitting and pathname expansion are not performed. and field splitting and pathname expansion are not performed.
.Pp
This special expansion applies not only to assignments that form a simple
command by themselves or precede a command word,
but also to words passed to the
.Ic export ,
.Ic local
or
.Ic readonly
built-in commands that have this form.
For this, the builtin's name must be literal
(not the result of an expansion)
and may optionally be preceded by one or more literal instances of
.Ic command
without options.
.Ss Positional Parameters .Ss Positional Parameters
A positional parameter is a parameter denoted by a number greater than zero. A positional parameter is a parameter denoted by a number greater than zero.
The shell sets these initially to the values of its command line The shell sets these initially to the values of its command line
+9 -1
View File
@@ -368,6 +368,14 @@ ignoresig(int signo)
} }
int
issigchldtrapped(void)
{
return (trap[SIGCHLD] != NULL && *trap[SIGCHLD] != '\0');
}
/* /*
* Signal handler. * Signal handler.
*/ */
@@ -416,6 +424,7 @@ dotrap(void)
in_dotrap++; in_dotrap++;
for (;;) { for (;;) {
pendingsigs = 0;
for (i = 1; i < NSIG; i++) { for (i = 1; i < NSIG; i++) {
if (gotsig[i]) { if (gotsig[i]) {
gotsig[i] = 0; gotsig[i] = 0;
@@ -467,7 +476,6 @@ dotrap(void)
break; break;
} }
in_dotrap--; in_dotrap--;
pendingsigs = 0;
} }
+1
View File
@@ -41,6 +41,7 @@ void clear_traps(void);
int have_traps(void); int have_traps(void);
void setsignal(int); void setsignal(int);
void ignoresig(int); void ignoresig(int);
int issigchldtrapped(void);
void onsig(int); void onsig(int);
void dotrap(void); void dotrap(void);
void setinteractive(int); void setinteractive(int);
+6 -12
View File
@@ -640,10 +640,11 @@ showvarscmd(int argc __unused, char **argv __unused)
*/ */
int int
exportcmd(int argc, char **argv) exportcmd(int argc __unused, char **argv)
{ {
struct var **vpp; struct var **vpp;
struct var *vp; struct var *vp;
char **ap;
char *name; char *name;
char *p; char *p;
char *cmdname; char *cmdname;
@@ -651,26 +652,19 @@ exportcmd(int argc, char **argv)
int flag = argv[0][0] == 'r'? VREADONLY : VEXPORT; int flag = argv[0][0] == 'r'? VREADONLY : VEXPORT;
cmdname = argv[0]; cmdname = argv[0];
optreset = optind = 1;
opterr = 0;
values = 0; values = 0;
while ((ch = getopt(argc, argv, "p")) != -1) { while ((ch = nextopt("p")) != '\0') {
switch (ch) { switch (ch) {
case 'p': case 'p':
values = 1; values = 1;
break; break;
case '?':
default:
error("unknown option: -%c", optopt);
} }
} }
argc -= optind;
argv += optind;
if (values && argc != 0) if (values && *argptr != NULL)
error("-p requires no arguments"); error("-p requires no arguments");
if (argc != 0) { if (*argptr != NULL) {
while ((name = *argv++) != NULL) { for (ap = argptr; (name = *ap) != NULL; ap++) {
if ((p = strchr(name, '=')) != NULL) { if ((p = strchr(name, '=')) != NULL) {
p++; p++;
} else { } else {
+1 -1
View File
@@ -40,6 +40,6 @@ int ksearch(char ***, struct info *);
int msearch(char ***, struct info *); int msearch(char ***, struct info *);
void optlist(void); void optlist(void);
void print(struct termios *, struct winsize *, int, enum FMT); void print(struct termios *, struct winsize *, int, enum FMT);
void usage(void); void usage(void) __dead2;
extern struct cchar cchars1[], cchars2[]; extern struct cchar cchars1[], cchars2[];
+1 -1
View File
@@ -45,7 +45,7 @@ devid_str_decode(char *devidstr, ddi_devid_t *retdevid, char **retminor_name)
return (EINVAL); return (EINVAL);
} }
*retminor_name = strdup(""); *retminor_name = strdup("");
if (*retminor_name == NULL); if (*retminor_name == NULL)
return (ENOMEM); return (ENOMEM);
return (0); return (0);
} }
+5 -8
View File
@@ -240,7 +240,7 @@ syscall:::entry
*/ */
/* print 3 args, return as hex */ /* print 3 args, return as hex */
syscall::lwp_sigmask:return syscall::sigprocmask:return
/self->start/ /self->start/
{ {
/* calculate elapsed time */ /* calculate elapsed time */
@@ -268,10 +268,11 @@ syscall::lwp_sigmask:return
} }
/* print 3 args, arg0 as a string */ /* print 3 args, arg0 as a string */
syscall::access*:return,
syscall::stat*:return, syscall::stat*:return,
syscall::lstat*:return, syscall::lstat*:return,
syscall::open*:return, syscall::readlink*:return,
syscall::resolvepath:return syscall::open*:return
/self->start/ /self->start/
{ {
/* calculate elapsed time */ /* calculate elapsed time */
@@ -329,7 +330,6 @@ syscall::*read*:return
} }
/* print 0 arg output */ /* print 0 arg output */
syscall::gtime:return,
syscall::*fork*:return syscall::*fork*:return
/self->start/ /self->start/
{ {
@@ -357,9 +357,6 @@ syscall::*fork*:return
} }
/* print 1 arg output */ /* print 1 arg output */
syscall::brk:return,
syscall::times:return,
syscall::stime:return,
syscall::close:return syscall::close:return
/self->start/ /self->start/
{ {
@@ -387,7 +384,7 @@ syscall::close:return
} }
/* print 2 arg output */ /* print 2 arg output */
syscall::utime:return, syscall::utimes:return,
syscall::munmap:return syscall::munmap:return
/self->start/ /self->start/
{ {
+19 -26
View File
@@ -5,21 +5,20 @@
# #
# $Id: execsnoop 3 2007-08-01 10:50:08Z brendan $ # $Id: execsnoop 3 2007-08-01 10:50:08Z brendan $
# #
# USAGE: execsnoop [-a|-A|-ehjsvZ] [-c command] # USAGE: execsnoop [-a|-A|-ehsvJ] [-c command]
# #
# execsnoop # default output # execsnoop # default output
# #
# -a # print all data # -a # print all data
# -A # dump all data, space delimited # -A # dump all data, space delimited
# -e # safe output - parseable # -e # safe output - parseable
# -j # print project ID
# -s # print start time, us # -s # print start time, us
# -v # print start time, string # -v # print start time, string
# -Z # print zonename # -J # print jail ID
# -c command # command name to snoop # -c command # command name to snoop
# eg, # eg,
# execsnoop -v # human readable timestamps # execsnoop -v # human readable timestamps
# execsnoop -Z # print zonename # execsnoop -J # print jail ID
# execsnoop -c ls # snoop ls commands only # execsnoop -c ls # snoop ls commands only
# #
# The parseable output ensures that the ARGS field doesn't contain # The parseable output ensures that the ARGS field doesn't contain
@@ -31,8 +30,7 @@
# PPID Parent Process ID # PPID Parent Process ID
# COMM command name for the process # COMM command name for the process
# ARGS argument listing for the process # ARGS argument listing for the process
# ZONE zonename # JAIL ID Jail ID
# PROJ project ID
# TIME timestamp for the command, us # TIME timestamp for the command, us
# STRTIME timestamp for the command, string # STRTIME timestamp for the command, string
# #
@@ -72,34 +70,32 @@
### default variables ### default variables
opt_dump=0; opt_cmd=0; opt_time=0; opt_timestr=0; filter=0; command=. opt_dump=0; opt_cmd=0; opt_time=0; opt_timestr=0; filter=0; command=.
opt_zone=0; opt_safe=0; opt_proj=0 opt_jailid=0; opt_safe=0
### process options ### process options
while getopts aAc:ehjsvZ name while getopts aAc:ehsvJ name
do do
case $name in case $name in
a) opt_time=1; opt_timestr=1; opt_zone=1; opt_proj=1 ;; a) opt_time=1; opt_timestr=1; opt_jailid=1 ;;
A) opt_dump=1 ;; A) opt_dump=1 ;;
c) opt_cmd=1; command=$OPTARG ;; c) opt_cmd=1; command=$OPTARG ;;
e) opt_safe=1 ;; e) opt_safe=1 ;;
j) opt_proj=1 ;;
s) opt_time=1 ;; s) opt_time=1 ;;
v) opt_timestr=1 ;; v) opt_timestr=1 ;;
Z) opt_zone=1 ;; J) opt_jailid=1 ;;
h|?) cat <<-END >&2 h|?) cat <<-END >&2
USAGE: execsnoop [-a|-A|-ehjsvZ] [-c command] USAGE: execsnoop [-a|-A|-ehjsvJ] [-c command]
execsnoop # default output execsnoop # default output
-a # print all data -a # print all data
-A # dump all data, space delimited -A # dump all data, space delimited
-e # safe output, parseable -e # safe output, parseable
-j # print project ID
-s # print start time, us -s # print start time, us
-v # print start time, string -v # print start time, string
-Z # print zonename -J # print jail ID
-c command # command name to snoop -c command # command name to snoop
eg, eg,
execsnoop -v # human readable timestamps execsnoop -v # human readable timestamps
execsnoop -Z # print zonename execsnoop -J # print jail ID
execsnoop -c ls # snoop ls commands only execsnoop -c ls # snoop ls commands only
END END
exit 1 exit 1
@@ -108,7 +104,7 @@ done
### option logic ### option logic
if [ $opt_dump -eq 1 ]; then if [ $opt_dump -eq 1 ]; then
opt_time=0; opt_timestr=0; opt_zone=0; opt_proj=0 opt_time=0; opt_timestr=0; opt_jailid=0
fi fi
if [ $opt_cmd -eq 1 ]; then if [ $opt_cmd -eq 1 ]; then
filter=1 filter=1
@@ -126,9 +122,8 @@ fi
inline int OPT_cmd = '$opt_cmd'; inline int OPT_cmd = '$opt_cmd';
inline int OPT_time = '$opt_time'; inline int OPT_time = '$opt_time';
inline int OPT_timestr = '$opt_timestr'; inline int OPT_timestr = '$opt_timestr';
inline int OPT_zone = '$opt_zone'; inline int OPT_jailid = '$opt_jailid';
inline int OPT_safe = '$opt_safe'; inline int OPT_safe = '$opt_safe';
inline int OPT_proj = '$opt_proj';
inline int FILTER = '$filter'; inline int FILTER = '$filter';
inline string COMMAND = "'$command'"; inline string COMMAND = "'$command'";
@@ -143,12 +138,11 @@ fi
/* print optional headers */ /* print optional headers */
OPT_time ? printf("%-14s ", "TIME") : 1; OPT_time ? printf("%-14s ", "TIME") : 1;
OPT_timestr ? printf("%-20s ", "STRTIME") : 1; OPT_timestr ? printf("%-20s ", "STRTIME") : 1;
OPT_zone ? printf("%-10s ", "ZONE") : 1; OPT_jailid ? printf("%-10s ", "JAIL ID") : 1;
OPT_proj ? printf("%5s ", "PROJ") : 1;
/* print main headers */ /* print main headers */
OPT_dump ? printf("%s %s %s %s %s %s %s %s\n", OPT_dump ? printf("%s %s %s %s %s %s %s\n",
"TIME", "ZONE", "PROJ", "UID", "PID", "PPID", "COMM", "ARGS") : "TIME", "JAIL ID", "UID", "PID", "PPID", "COMM", "ARGS") :
printf("%5s %6s %6s %s\n", "UID", "PID", "PPID", "ARGS"); printf("%5s %6s %6s %s\n", "UID", "PID", "PPID", "ARGS");
} }
@@ -161,12 +155,11 @@ fi
/* print optional fields */ /* print optional fields */
OPT_time ? printf("%-14d ", timestamp/1000) : 1; OPT_time ? printf("%-14d ", timestamp/1000) : 1;
OPT_timestr ? printf("%-20Y ", walltimestamp) : 1; OPT_timestr ? printf("%-20Y ", walltimestamp) : 1;
OPT_zone ? printf("%-10s ", zonename) : 1; OPT_jailid ? printf("%-10d ", curpsinfo->pr_jailid) : 1;
OPT_proj ? printf("%5d ", curpsinfo->pr_projid) : 1;
/* print main data */ /* print main data */
OPT_dump ? printf("%d %s %d %d %d %d %s ", timestamp/1000, OPT_dump ? printf("%d %d %d %d %d %s ", timestamp/1000,
zonename, curpsinfo->pr_projid, uid, pid, ppid, execname) : curpsinfo->pr_jailid, uid, pid, ppid, execname) :
printf("%5d %6d %6d ", uid, pid, ppid); printf("%5d %6d %6d ", uid, pid, ppid);
OPT_safe ? printf("%S\n", curpsinfo->pr_psargs) : OPT_safe ? printf("%S\n", curpsinfo->pr_psargs) :
printf("%s\n", curpsinfo->pr_psargs); printf("%s\n", curpsinfo->pr_psargs);
@@ -0,0 +1,76 @@
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
#
# Copyright (c) 2011, Joyent Inc. All rights reserved.
# Use is subject to license terms.
#
#
# This test verifies that we only use the first entry of a file with a given
# name in the library path
#
if [ $# != 1 ]; then
echo expected one argument: '<'dtrace-path'>'
exit 2
fi
firstinc=${TMPDIR:-/tmp}/firstinc.$$
secondinc=${TMPDIR:-/tmp}/secondinc.$$
expexit=23
setup_include()
{
mkdir $firstinc
mkdir $secondinc
cat > $firstinc/lib.d <<EOF
inline int foobar = $expexit;
#pragma D binding "1.0" foobar
EOF
cat > $secondinc/lib.d <<EOF
inline int foobar = 42;
#pragma D binding "1.0" foobar
EOF
}
clean()
{
rm -rf $firstinc
rm -rf $secondinc
}
fail()
{
echo "$@"
clean
exit 1
}
setup_include
dtrace -L$firstinc -L$secondinc -e -n 'BEGIN{ exit(foobar) }'
[[ $? != 0 ]] && fail "Failed to compile with same file in include path twice"
dtrace -L$firstinc -L$secondinc -n 'BEGIN{ exit(foobar) }'
status=$?
[[ $status != $expexit ]] && fail "Exited with unexpected status code: $status"
clean
exit 0
@@ -0,0 +1,29 @@
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright (c) 2011, Joyent, Inc. All rights reserved.
*/
BEGIN
{
@ = llquantize(0, 10, 0, 10, 25);
}
@@ -0,0 +1,29 @@
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright (c) 2011, Joyent, Inc. All rights reserved.
*/
BEGIN
{
@ = llquantize(0, 10, 0, 10, 30);
}
@@ -0,0 +1,30 @@
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright (c) 2011, Joyent, Inc. All rights reserved.
*/
BEGIN
{
@ = llquantize(0, 10, 0, 10, 10);
@ = llquantize(0, 3, 0, 10, 81);
}
@@ -0,0 +1,29 @@
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright (c) 2011, Joyent, Inc. All rights reserved.
*/
BEGIN
{
@ = llquantize(0, 10, 0, 10, 7);
}
@@ -0,0 +1,29 @@
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright (c) 2011, Joyent, Inc. All rights reserved.
*/
BEGIN
{
@ = llquantize(0, 1, 0, 10, 10);
}
@@ -0,0 +1,30 @@
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright (c) 2011, Joyent, Inc. All rights reserved.
*/
BEGIN
{
this->doogle = 10;
@ = llquantize(0, this->doogle, 0, 10, 10);
}
@@ -0,0 +1,29 @@
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright (c) 2011, Joyent, Inc. All rights reserved.
*/
BEGIN
{
@ = llquantize(0, 65537, 0, 10, 10);
}
@@ -0,0 +1,30 @@
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright (c) 2011, Joyent, Inc. All rights reserved.
*/
BEGIN
{
@ = llquantize(0, 10, 0, 10, 10);
@ = llquantize(0, 10, 0, 11, 10);
}
@@ -0,0 +1,30 @@
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright (c) 2011, Joyent, Inc. All rights reserved.
*/
BEGIN
{
this->doogle = 10;
@ = llquantize(0, 10, 0, this->doogle, 10);
}
@@ -0,0 +1,29 @@
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright (c) 2011, Joyent, Inc. All rights reserved.
*/
BEGIN
{
@ = llquantize(0, 10, 0, -1, 10);
}
@@ -0,0 +1,30 @@
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright (c) 2011, Joyent, Inc. All rights reserved.
*/
BEGIN
{
@ = llquantize(0, 10, 0, 10, 10);
@ = llquantize(0, 10, 1, 10, 10);
}
@@ -0,0 +1,30 @@
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright (c) 2011, Joyent, Inc. All rights reserved.
*/
BEGIN
{
this->doogle = 0;
@ = llquantize(0, 10, this->doogle, 10, 10);
}
@@ -0,0 +1,29 @@
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright (c) 2011, Joyent, Inc. All rights reserved.
*/
BEGIN
{
@ = llquantize(0, 10, -1, 10, 10);
}
@@ -0,0 +1,29 @@
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright (c) 2011, Joyent, Inc. All rights reserved.
*/
BEGIN
{
@ = llquantize(0, 10, 10, 0, 10);
}
@@ -0,0 +1,29 @@
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright (c) 2011, Joyent, Inc. All rights reserved.
*/
BEGIN
{
@ = llquantize(0, 10, 0, 100, 10);
}
@@ -0,0 +1,30 @@
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright (c) 2011, Joyent, Inc. All rights reserved.
*/
BEGIN
{
@ = llquantize(0, 10, 0, 10, 10);
@ = llquantize(0, 10, 0, 10, 100);
}
@@ -0,0 +1,30 @@
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright (c) 2011, Joyent, Inc. All rights reserved.
*/
BEGIN
{
this->doogle = 10;
@ = llquantize(0, 10, 0, 10, this->doogle);
}
@@ -0,0 +1,29 @@
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright (c) 2011, Joyent, Inc. All rights reserved.
*/
BEGIN
{
@ = llquantize(123, 10, 0, 10, 123456);
}
@@ -0,0 +1,46 @@
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright (c) 2011, Joyent, Inc. All rights reserved.
*/
#pragma D option quiet
tick-1ms
/i++ <= 100/
{
@two = llquantize(i, 2, 0, 6, 2);
@three = llquantize(i, 3, 0, 1, 9);
@four = llquantize(i, 4, 0, 1, 4);
@five = llquantize(i, 5, 0, 1, 25);
@six = llquantize(i, 6, 0, 3, 12);
@seven = llquantize(i, 7, 0, 1, 7);
@eight = llquantize(i, 8, 0, 1, 16);
@nine = llquantize(i, 9, 0, 1, 9);
@ten = llquantize(i, 10, 0, 1, 10);
}
tick-1ms
/i > 100/
{
exit(0);
}
@@ -0,0 +1,177 @@
value ------------- Distribution ------------- count
< 1 | 0
1 | 1
2 |@ 2
4 |@@ 4
8 |@@@ 8
16 |@@@@@@ 16
32 |@@@@@@@@@@@@@ 32
64 |@@@@@@@@@@@@@@@ 38
>= 128 | 0
value ------------- Distribution ------------- count
< 1 | 0
1 | 1
2 | 1
3 | 1
4 | 1
5 | 1
6 | 1
7 | 1
8 | 1
>= 9 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 93
value ------------- Distribution ------------- count
< 1 | 0
1 | 1
2 | 1
3 | 1
4 |@@ 4
8 |@@ 4
12 |@@ 4
>= 16 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 86
value ------------- Distribution ------------- count
< 1 | 0
1 | 1
2 | 1
3 | 1
4 | 1
5 | 1
6 | 1
7 | 1
8 | 1
9 | 1
10 | 1
11 | 1
12 | 1
13 | 1
14 | 1
15 | 1
16 | 1
17 | 1
18 | 1
19 | 1
20 | 1
21 | 1
22 | 1
23 | 1
24 | 1
>= 25 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 77
value ------------- Distribution ------------- count
< 1 | 0
1 | 1
2 | 1
3 | 1
4 | 1
5 | 1
6 |@ 3
9 |@ 3
12 |@ 3
15 |@ 3
18 |@ 3
21 |@ 3
24 |@ 3
27 |@ 3
30 |@ 3
33 |@ 3
36 |@@@@@@@ 18
54 |@@@@@@@ 18
72 |@@@@@@@ 18
90 |@@@@@ 12
108 | 0
value ------------- Distribution ------------- count
< 1 | 0
1 | 1
2 | 1
3 | 1
4 | 1
5 | 1
6 | 1
7 |@@@ 7
14 |@@@ 7
21 |@@@ 7
28 |@@@ 7
35 |@@@ 7
42 |@@@ 7
>= 49 |@@@@@@@@@@@@@@@@@@@@@ 53
value ------------- Distribution ------------- count
< 1 | 0
1 | 1
2 | 1
3 | 1
4 | 1
5 | 1
6 | 1
7 | 1
8 |@@ 4
12 |@@ 4
16 |@@ 4
20 |@@ 4
24 |@@ 4
28 |@@ 4
32 |@@ 4
36 |@@ 4
40 |@@ 4
44 |@@ 4
48 |@@ 4
52 |@@ 4
56 |@@ 4
60 |@@ 4
>= 64 |@@@@@@@@@@@@@@@ 38
value ------------- Distribution ------------- count
< 1 | 0
1 | 1
2 | 1
3 | 1
4 | 1
5 | 1
6 | 1
7 | 1
8 | 1
9 |@@@@ 9
18 |@@@@ 9
27 |@@@@ 9
36 |@@@@ 9
45 |@@@@ 9
54 |@@@@ 9
63 |@@@@ 9
72 |@@@@ 9
>= 81 |@@@@@@@@ 21
value ------------- Distribution ------------- count
< 1 | 0
1 | 1
2 | 1
3 | 1
4 | 1
5 | 1
6 | 1
7 | 1
8 | 1
9 | 1
10 |@@@@ 10
20 |@@@@ 10
30 |@@@@ 10
40 |@@@@ 10
50 |@@@@ 10
60 |@@@@ 10
70 |@@@@ 10
80 |@@@@ 10
90 |@@@@ 10
>= 100 |@ 2
@@ -0,0 +1,38 @@
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright (c) 2011, Joyent, Inc. All rights reserved.
*/
#pragma D option quiet
tick-1ms
/i++ <= 100/
{
@ = llquantize(i, 10, 0, 10, 10);
}
tick-1ms
/i > 100/
{
exit(0);
}
@@ -0,0 +1,25 @@
value ------------- Distribution ------------- count
< 1 | 0
1 | 1
2 | 1
3 | 1
4 | 1
5 | 1
6 | 1
7 | 1
8 | 1
9 | 1
10 |@@@@ 10
20 |@@@@ 10
30 |@@@@ 10
40 |@@@@ 10
50 |@@@@ 10
60 |@@@@ 10
70 |@@@@ 10
80 |@@@@ 10
90 |@@@@ 10
100 |@ 2
200 | 0
@@ -0,0 +1,62 @@
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright (c) 2011, Joyent, Inc. All rights reserved.
*/
#pragma D option quiet
BEGIN
{
a = 7;
b = 13;
val = (-a * b) + a;
}
tick-1ms
{
incr = val % b;
val += a;
}
tick-1ms
/val == 0/
{
val += a;
}
tick-1ms
/incr != 0/
{
i++;
@llquanty[i] = llquantize(1, 10, 0, 10, 10, incr);
}
tick-1ms
/incr == 0/
{
printf("Ordering of llquantize() with some negative weights:\n");
printa(@llquanty);
printf("\n");
exit(0);
}
@@ -0,0 +1,148 @@
Ordering of llquantize() with some negative weights:
2
value ------------- Distribution ------------- count
< 1 | 0
1 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -12
2 | 0
4
value ------------- Distribution ------------- count
< 1 | 0
1 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -11
2 | 0
6
value ------------- Distribution ------------- count
< 1 | 0
1 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -10
2 | 0
8
value ------------- Distribution ------------- count
< 1 | 0
1 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -9
2 | 0
10
value ------------- Distribution ------------- count
< 1 | 0
1 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -8
2 | 0
12
value ------------- Distribution ------------- count
< 1 | 0
1 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -7
2 | 0
1
value ------------- Distribution ------------- count
< 1 | 0
1 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -6
2 | 0
3
value ------------- Distribution ------------- count
< 1 | 0
1 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -5
2 | 0
5
value ------------- Distribution ------------- count
< 1 | 0
1 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -4
2 | 0
7
value ------------- Distribution ------------- count
< 1 | 0
1 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -3
2 | 0
9
value ------------- Distribution ------------- count
< 1 | 0
1 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -2
2 | 0
11
value ------------- Distribution ------------- count
< 1 | 0
1 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -1
2 | 0
14
value ------------- Distribution ------------- count
< 1 | 0
1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1
2 | 0
16
value ------------- Distribution ------------- count
< 1 | 0
1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 2
2 | 0
18
value ------------- Distribution ------------- count
< 1 | 0
1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 3
2 | 0
20
value ------------- Distribution ------------- count
< 1 | 0
1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 4
2 | 0
22
value ------------- Distribution ------------- count
< 1 | 0
1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 5
2 | 0
24
value ------------- Distribution ------------- count
< 1 | 0
1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 6
2 | 0
13
value ------------- Distribution ------------- count
< 1 | 0
1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 7
2 | 0
15
value ------------- Distribution ------------- count
< 1 | 0
1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 8
2 | 0
17
value ------------- Distribution ------------- count
< 1 | 0
1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 9
2 | 0
19
value ------------- Distribution ------------- count
< 1 | 0
1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 10
2 | 0
21
value ------------- Distribution ------------- count
< 1 | 0
1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 11
2 | 0
23
value ------------- Distribution ------------- count
< 1 | 0
1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 12
2 | 0
@@ -0,0 +1,38 @@
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright (c) 2011, Joyent, Inc. All rights reserved.
*/
#pragma D option quiet
tick-1ms
/i++ <= 100/
{
@ = llquantize(i, 10, 0, 10, 10, 50 - i);
}
tick-1ms
/i > 100/
{
exit(0);
}
@@ -0,0 +1,25 @@
value ------------- Distribution ------------- count
< 1 | 0
1 | 49
2 | 48
3 | 47
4 | 46
5 | 45
6 | 44
7 | 43
8 | 42
9 | 41
10 |@@@ 355
20 |@@ 255
30 |@ 155
40 | 55
50 | -45
60 @| -145
70 @@| -245
80 @@@| -345
90 @@@| -445
100 @| -101
200 | 0
@@ -0,0 +1,40 @@
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright (c) 2011, Joyent, Inc. All rights reserved.
*/
#pragma D option quiet
tick-1ms
/i++ <= 100/
{
@ = llquantize(i, 10, 0, 10, 10);
}
tick-1ms
/i > 100/
{
normalize(@, 10);
printa(@);
exit(0);
}
@@ -0,0 +1,26 @@
value ------------- Distribution ------------- count
< 1 | 0
1 | 0
2 | 0
3 | 0
4 | 0
5 | 0
6 | 0
7 | 0
8 | 0
9 | 0
10 |@@@@ 1
20 |@@@@ 1
30 |@@@@ 1
40 |@@@@ 1
50 |@@@@ 1
60 |@@@@ 1
70 |@@@@ 1
80 |@@@@ 1
90 |@@@@ 1
100 |@ 0
200 | 0
@@ -0,0 +1,38 @@
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright (c) 2011, Joyent, Inc. All rights reserved.
*/
#pragma D option quiet
BEGIN
{
@["Screven"] = llquantize(0, 10, 1, 2, 20, 25);
@["Katz"] = llquantize(1, 10, 1, 2, 20, -100);
@["Kurian"] = llquantize(7, 10, 1, 2, 20, 15);
@["Rozwat"] = llquantize(49, 10, 1, 2, 20, 15);
@["Fowler"] = llquantize(343, 10, 1, 2, 20, 150);
printa(@);
exit(0);
}
@@ -0,0 +1,29 @@
Katz
value ------------- Distribution ------------- count
< 10 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -100
10 | 0
Kurian
value ------------- Distribution ------------- count
< 10 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 15
10 | 0
Screven
value ------------- Distribution ------------- count
< 10 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 25
10 | 0
Rozwat
value ------------- Distribution ------------- count
40 | 0
45 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 15
50 | 0
Fowler
value ------------- Distribution ------------- count
250 | 0
300 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 150
350 | 0
@@ -0,0 +1,52 @@
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright (c) 2011, Joyent, Inc. All rights reserved.
*/
#pragma D option quiet
tick-1ms
/i++ <= 100/
{
@ = llquantize(i, 10, 0, 10, 20);
@hunid = llquantize(i * 10, 10, 0, 10, 100);
@large = llquantize(i * 100, 10, 0, 10, 1000);
}
tick-1ms
/i > 100/
{
exit(0);
}
END
{
printf("20 steps:\n");
printa(@);
printf("100 steps:\n");
printa(@hunid);
printf("1000 steps:\n");
printa(@large);
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,49 @@
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright (c) 2011, Joyent, Inc. All rights reserved.
*/
#pragma D option quiet
int i;
tick-10ms
/i < 100/
{
@[i] = llquantize(i, 10, 1, 2, 10, 150);
@[i] = llquantize(i + 1, 10, 1, 2, 10, 150);
@[i] = llquantize(i + 2, 10, 1, 2, 10, 150);
@[i] = llquantize(i + 3, 10, 1, 2, 10, 150);
i++;
}
tick-10ms
/i == 100/
{
exit(0);
}
END
{
trunc(@, 5);
}
@@ -0,0 +1,34 @@
95
value ------------- Distribution ------------- count
80 | 0
90 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 600
100 | 0
96
value ------------- Distribution ------------- count
80 | 0
90 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 600
100 | 0
97
value ------------- Distribution ------------- count
80 | 0
90 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 450
100 |@@@@@@@@@@ 150
200 | 0
98
value ------------- Distribution ------------- count
80 | 0
90 |@@@@@@@@@@@@@@@@@@@@ 300
100 |@@@@@@@@@@@@@@@@@@@@ 300
200 | 0
99
value ------------- Distribution ------------- count
80 | 0
90 |@@@@@@@@@@ 150
100 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 450
200 | 0
@@ -0,0 +1,76 @@
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
#
# Copyright (c) 2011, Joyent Inc. All rights reserved.
# Use is subject to license terms.
#
#
# Test to catch that we properly look for libraries dependencies in
# our full library parth
#
if [ $# != 1 ]; then
echo expected one argument: '<'dtrace-path'>'
exit 2
fi
libdira=${TMPDIR:-/tmp}/libdepa.$$
libdirb=${TMPDIR:-/tmp}/libdepb.$$
libdirc=${TMPDIR:-/tmp}/libdepc.$$
dtrace=$1
setup_libs()
{
mkdir $libdira
mkdir $libdirb
mkdir $libdirc
cat > $libdira/liba.$$.d <<EOF
#pragma D depends_on library libb.$$.d
#pragma D depends_on library libc.$$.d
#pragma D depends_on library libd.$$.d
EOF
cat > $libdirb/libb.$$.d <<EOF
#pragma D depends_on library libc.$$.d
EOF
cat > $libdirb/libc.$$.d <<EOF
EOF
cat > $libdirb/libd.$$.d <<EOF
EOF
cat > $libdirc/libe.$$.d <<EOF
#pragma D depends_on library liba.$$.d
EOF
cat > $libdirc/libf.$$.d <<EOF
EOF
}
setup_libs
$dtrace -L$libdira -L$libdirb -L$libdirc -e
status=$?
rm -rf $libdira
rm -rf $libdirb
rm -rf $libdirc
return $status
@@ -0,0 +1,30 @@
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright (c) 2011, Joyent Inc. All rights reserved.
*/
BEGIN
{
trace(sizeof (struct suckitlarry));
exit(0);
}

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