Sync to HEAD@r269943.

This commit is contained in:
Alexander V. Chernikov 2014-08-13 16:20:41 +00:00
commit 1b833d535b
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/projects/ipfw/; revision=269947
4669 changed files with 180306 additions and 205981 deletions

View File

@ -20,7 +20,7 @@ It is not a registry of 'turf' or private property.
subsystem login notes
-----------------------------
kqueue jmg Pre-commit review requested.
kqueue jmg Pre-commit review requested. Documentation Required.
libc/posix1e rwatson Pre-commit review requested.
POSIX.1e ACLs rwatson Pre-commit review requested.
UFS EAs rwatson Pre-commit review requested.
@ -102,13 +102,12 @@ linux emul emulation Please discuss changes here.
bs{diff,patch} cperciva Pre-commit review requested.
portsnap cperciva Pre-commit review requested.
freebsd-update cperciva Pre-commit review requested.
openssl benl Pre-commit review requested.
openssl benl,jkim Pre-commit review requested.
sys/netgraph/bluetooth emax Pre-commit review preferred.
lib/libbluetooth emax Pre-commit review preferred.
lib/libsdp emax Pre-commit review preferred.
usr.bin/bluetooth emax Pre-commit review preferred.
usr.sbin/bluetooth emax Pre-commit review preferred.
gnu/usr.bin/send-pr bugmaster Pre-commit review requested.
*env(3) secteam Due to the problematic security history of this
code, please have patches reviewed by secteam.
share/zoneinfo edwin Heads-up appreciated, since our data is coming
@ -133,3 +132,4 @@ release/release.sh gjb Pre-commit review and regression tests
requested.
nanobsd imp Pre-commit review requested for coordination.
vmm(4) neel,grehan Pre-commit review requested.
opencrypto jmg Pre-commit review requested. Documentation Required.

View File

@ -36,6 +36,7 @@
# specified with XDEV and XDEV_ARCH.
# xdev-build - Build cross-development tools.
# xdev-install - Install cross-development tools.
# xdev-links - Create traditional links in /usr/bin for cc, etc
#
# "quick" way to test all kernel builds:
# _jflag=`sysctl -n hw.ncpu`
@ -82,7 +83,7 @@
#
# See src/UPDATING `COMMON ITEMS' for more complete information.
#
# If TARGET=machine (e.g. ia64, sparc64, ...) is specified you can
# If TARGET=machine (e.g. powerpc, sparc64, ...) is specified you can
# cross build world for other machine types using the buildworld target,
# and once the world is built you can cross build a kernel using the
# buildkernel target.
@ -110,6 +111,7 @@ TGTS= all all-man buildenv buildenvvars buildkernel buildworld \
_worldtmp _legacy _bootstrap-tools _cleanobj _obj \
_build-tools _cross-tools _includes _libraries _depend \
build32 builddtb distribute32 install32 xdev xdev-build xdev-install \
xdev-links \
TGTS+= ${SUBDIR_TARGETS}
@ -172,6 +174,13 @@ _TARGET=${TARGET}
.if defined(TARGET_ARCH) && !defined(_TARGET_ARCH)
_TARGET_ARCH=${TARGET_ARCH}
.endif
# for historical compatibility for xdev targets
.if defined(XDEV)
_TARGET= ${XDEV}
.endif
.if defined(XDEV_ARCH)
_TARGET_ARCH= ${XDEV_ARCH}
.endif
# Otherwise, default to current machine type and architecture.
_TARGET?= ${MACHINE}
_TARGET_ARCH?= ${MACHINE_ARCH}
@ -329,6 +338,7 @@ MMAKEENV= MAKEOBJDIRPREFIX=${MYMAKE:H} \
MMAKE= ${MMAKEENV} ${MAKE} \
-DNO_MAN -DNO_SHARED \
-DNO_CPU_CFLAGS -DNO_WERROR \
MK_TESTS=no \
DESTDIR= PROGNAME=${MYMAKE:T}
bmake: .PHONY
@ -361,7 +371,7 @@ kernel-toolchains:
# existing system is.
#
.if make(universe) || make(universe_kernels) || make(tinderbox) || make(targets)
TARGETS?=amd64 arm i386 ia64 mips pc98 powerpc sparc64
TARGETS?=amd64 arm i386 mips pc98 powerpc sparc64
TARGET_ARCHES_arm?= arm armeb armv6 armv6hf
TARGET_ARCHES_mips?= mipsel mips mips64el mips64 mipsn32
TARGET_ARCHES_powerpc?= powerpc powerpc64

View File

@ -17,6 +17,7 @@
# -DNO_DOCUPDATE do not update doc in ${MAKE} update
# -DWITHOUT_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_ITOOLS="list of tools" to add additional tools to the ITOOLS 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
@ -139,7 +140,7 @@ SRCRELDATE!= awk '/^\#define[[:space:]]*__FreeBSD_version/ { print $$3 }' \
VERSION= FreeBSD ${REVISION}-${BRANCH:C/-p[0-9]+$//} ${TARGET_ARCH} ${SRCRELDATE}
.endif
KNOWN_ARCHES?= amd64 arm armeb/arm armv6/arm armv6hf/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 armv6hf/arm i386 i386/pc98 mips mipsel/mips mips64el/mips mips64/mips mipsn32el/mips mipsn32/mips powerpc powerpc64/powerpc sparc64
.if ${TARGET} == ${TARGET_ARCH}
_t= ${TARGET}
.else
@ -394,7 +395,8 @@ LIB32WMAKEENV+= MAKEOBJDIRPREFIX=${OBJTREE}/lib32 \
PATH=${TMPPATH} \
LIBDIR=/usr/lib32 \
SHLIBDIR=/usr/lib32 \
LIBPRIVATEDIR=/usr/lib32/private
LIBPRIVATEDIR=/usr/lib32/private \
DTRACE="${DTRACE} -32"
LIB32WMAKEFLAGS+= CC="${XCC} ${LIB32FLAGS}" \
CXX="${XCXX} ${LIB32FLAGS}" \
DESTDIR=${LIB32TMP} \
@ -756,7 +758,8 @@ _zoneinfo= zic tzsetup
ITOOLS= [ awk cap_mkdb cat chflags chmod chown \
date echo egrep find grep id install ${_install-info} \
ln lockf make mkdir mtree mv pwd_mkdb \
rm sed services_mkdb sh sysctl test true uname wc ${_zoneinfo}
rm sed services_mkdb sh sysctl test true uname wc ${_zoneinfo} \
${LOCAL_ITOOLS}
#
# distributeworld
@ -780,6 +783,11 @@ EXTRA_DISTRIBUTIONS+= lib32
EXTRA_DISTRIBUTIONS+= tests
.endif
DEBUG_DISTRIBUTIONS=
.if ${MK_DEBUG_FILES} != "no"
DEBUG_DISTRIBUTIONS+= base ${EXTRA_DISTRIBUTIONS:S,doc,,}
.endif
MTREE_MAGIC?= mtree 2.0
distributeworld installworld: _installcheck_world
@ -856,8 +864,7 @@ distributeworld installworld: _installcheck_world
awk 'BEGIN { print "#${MTREE_MAGIC}" } !/ type=/ { file = $$1 } / type=/ { if ($$1 == file) { sub(/^\.\/${dist}\//, "./"); print } }' > \
${DESTDIR}/${DISTDIR}/${dist}.meta
.endfor
.if ${MK_DEBUG_FILES} != "no"
. for dist in base ${EXTRA_DISTRIBUTIONS}
.for dist in ${DEBUG_DISTRIBUTIONS}
@# For each file that exists in this dist, print the corresponding
@# line from the METALOG. This relies on the fact that
@# a line containing only the filename will sort immediatly before
@ -866,8 +873,7 @@ distributeworld installworld: _installcheck_world
find ./${dist}/usr/lib/debug | sort -u ${METALOG} - | \
awk 'BEGIN { print "#${MTREE_MAGIC}" } !/ type=/ { file = $$1 } / type=/ { if ($$1 == file) { sub(/^\.\/${dist}\//, "./"); print } }' > \
${DESTDIR}/${DISTDIR}/${dist}.debug.meta
. endfor
.endif
.endfor
.endif
.endif
@ -885,19 +891,17 @@ packageworld:
.endif
.endfor
.if ${MK_DEBUG_FILES} != "no"
. for dist in base ${EXTRA_DISTRIBUTIONS}
. if defined(NO_ROOT)
.for dist in ${DEBUG_DISTRIBUTIONS}
. if defined(NO_ROOT)
${_+_}cd ${DESTDIR}/${DISTDIR}/${dist}; \
tar cvJf ${DESTDIR}/${DISTDIR}/${dist}.debug.txz \
tar cvJf ${DESTDIR}/${DISTDIR}/${dist}-dbg.txz \
@${DESTDIR}/${DISTDIR}/${dist}.debug.meta
. else
. else
${_+_}cd ${DESTDIR}/${DISTDIR}/${dist}; \
tar cvJfL ${DESTDIR}/${DISTDIR}/${dist}.debug.txz \
tar cvJfL ${DESTDIR}/${DISTDIR}/${dist}-dbg.txz \
usr/lib/debug
. endif
. endfor
.endif
. endif
.endfor
#
# reinstall
@ -1196,16 +1200,17 @@ _gperf= gnu/usr.bin/gperf
_groff= gnu/usr.bin/groff
.endif
.if ${MK_VT} != "no"
_vtfontcvt= usr.bin/vtfontcvt
.endif
.if ${BOOTSTRAPPING} < 900002
_sed= usr.bin/sed
.endif
.if ${BOOTSTRAPPING} < 900006
_lex= usr.bin/lex
.endif
.if ${BOOTSTRAPPING} < 1000002
_m4= usr.bin/m4
_m4= lib/libohash \
usr.bin/m4
.endif
.if ${BOOTSTRAPPING} < 1000013
@ -1226,6 +1231,10 @@ _nmtree= lib/libnetbsd \
_cat= bin/cat
.endif
.if ${BOOTSTRAPPING} < 1000033
_lex= usr.bin/lex
.endif
.if ${BOOTSTRAPPING} >= 900040 && ${BOOTSTRAPPING} < 900041
_awk= usr.bin/awk
.endif
@ -1295,7 +1304,8 @@ bootstrap-tools: .MAKE
${_gensnmptree} \
usr.sbin/config \
${_crunch} \
${_nmtree}
${_nmtree} \
${_vtfontcvt}
${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \
cd ${.CURDIR}/${_tool} && \
${MAKE} DIRPRFX=${_tool}/ obj && \
@ -1358,9 +1368,6 @@ kernel-tools: .MAKE
#
# cross-tools: Build cross-building tools
#
.if !defined(TARGET_ARCH) && defined(XDEV_ARCH)
TARGET_ARCH= ${XDEV_ARCH}
.endif
.if ${TARGET_ARCH} != ${MACHINE_ARCH}
.if ${TARGET_ARCH} == "amd64" || ${TARGET_ARCH} == "i386"
_btxld= usr.sbin/btxld
@ -1401,7 +1408,8 @@ cross-tools: .MAKE
usr.bin/xlint/lint1 usr.bin/xlint/lint2 usr.bin/xlint/xlint \
${_btxld} \
${_crunchide} \
${_kgzip}
${_kgzip} \
sys/boot/usb/tools
${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \
cd ${.CURDIR}/${_tool} && \
${MAKE} DIRPRFX=${_tool}/ obj && \
@ -1486,9 +1494,10 @@ _prebuild_libs= ${_kerberos5_lib_libasn1} \
lib/libutil lib/libpjdlog ${_lib_libypclnt} lib/libz lib/msun \
${_secure_lib_libcrypto} ${_lib_libldns} \
${_secure_lib_libssh} ${_secure_lib_libssl}
.if ${MK_GNUCXX} != "no" && ${MK_CXX} != "no"
.if ${MK_GNUCXX} != "no"
_prebuild_libs+= gnu/lib/libstdc++ gnu/lib/libsupc++
gnu/lib/libstdc++__L: lib/msun__L
gnu/lib/libsupc++__L: gnu/lib/libstdc++__L
.endif
.if defined(WITH_ATF) || ${MK_TESTS} != "no"
@ -1845,9 +1854,9 @@ builddtb:
###############
.if defined(XDEV) && defined(XDEV_ARCH)
.if defined(TARGET) && defined(TARGET_ARCH)
.if ${XDEV} == ${MACHINE} && ${XDEV_ARCH} == ${MACHINE_ARCH}
.if ${TARGET} == ${MACHINE} && ${TARGET_ARCH} == ${MACHINE_ARCH}
XDEV_CPUTYPE?=${CPUTYPE}
.else
XDEV_CPUTYPE?=${TARGET_CPUTYPE}
@ -1856,10 +1865,10 @@ XDEV_CPUTYPE?=${TARGET_CPUTYPE}
NOFUN=-DNO_FSCHG MK_HTML=no MK_INFO=no -DNO_LINT \
MK_MAN=no MK_NLS=no MK_PROFILE=no \
MK_KERBEROS=no MK_RESCUE=no MK_TESTS=no MK_WARNS=no \
TARGET=${XDEV} TARGET_ARCH=${XDEV_ARCH} \
TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \
CPUTYPE=${XDEV_CPUTYPE}
XDDIR=${XDEV_ARCH}-freebsd
XDDIR=${TARGET_ARCH}-freebsd
XDTP?=/usr/${XDDIR}
.if ${XDTP:N/*}
.error XDTP variable should be an absolute path
@ -1875,7 +1884,7 @@ CD2CFLAGS=-isystem ${XDDESTDIR}/usr/include -L${XDDESTDIR}/usr/lib \
-B${XDDESTDIR}/usr/bin -B${XDDESTDIR}/usr/lib
CD2ENV=${CDENV} CC="${CC} ${CD2CFLAGS}" CXX="${CXX} ${CD2CFLAGS}" \
CPP="${CPP} ${CD2CFLAGS}" \
MACHINE=${XDEV} MACHINE_ARCH=${XDEV_ARCH}
MACHINE=${TARGET} MACHINE_ARCH=${TARGET_ARCH}
CDTMP= ${MAKEOBJDIRPREFIX}/${XDDIR}/${.CURDIR}/tmp
CDMAKE=${CDENV} PATH=${CDTMP}/usr/bin:${PATH} ${MAKE} ${NOFUN}
@ -1885,7 +1894,7 @@ XDDESTDIR=${DESTDIR}/${XDTP}
OSREL!= uname -r | sed -e 's/[-(].*//'
.endif
.ORDER: xdev-build xdev-install
.ORDER: xdev-build xdev-install xdev-links
xdev: xdev-build xdev-install
.ORDER: _xb-worldtmp _xb-bootstrap-tools _xb-build-tools _xb-cross-tools
@ -1934,9 +1943,13 @@ _xi-mtree:
-p ${XDDESTDIR}/usr >/dev/null
mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
-p ${XDDESTDIR}/usr/include >/dev/null
.if ${MK_TESTS} != "no"
mtree -deU -f ${.CURDIR}/etc/mtree/BSD.tests.dist \
-p ${XDDESTDIR}/usr >/dev/null
.endif
.ORDER: xdev-build _xi-mtree _xi-cross-tools _xi-includes _xi-libraries _xi-links
xdev-install: xdev-build _xi-mtree _xi-cross-tools _xi-includes _xi-libraries _xi-links
.ORDER: xdev-build _xi-mtree _xi-cross-tools _xi-includes _xi-libraries
xdev-install: xdev-build _xi-mtree _xi-cross-tools _xi-includes _xi-libraries
_xi-cross-tools:
@echo "_xi-cross-tools"
@ -1959,9 +1972,9 @@ _xi-libraries:
${_+_}cd ${.CURDIR}; ${CD2MAKE} -f Makefile.inc1 libraries \
DESTDIR=${XDDESTDIR}
_xi-links:
xdev-links:
${_+_}cd ${XDDESTDIR}/usr/bin; \
mkdir -p ../../../../usr/bin; \
mkdir -p ../../../../usr/bin; \
for i in *; do \
ln -sf ../../${XDTP}/usr/bin/$$i \
../../../../usr/bin/${XDDIR}-$$i; \
@ -1969,6 +1982,6 @@ _xi-links:
../../../../usr/bin/${XDDIR}${OSREL}-$$i; \
done
.else
xdev xdev-build xdev-install:
@echo "*** Error: Both XDEV and XDEV_ARCH must be defined for \"${.TARGET}\" target"
xdev xdev-build xdev-install xdev-links:
@echo "*** Error: Both TARGET and TARGET_ARCH must be defined for \"${.TARGET}\" target"
.endif

View File

@ -38,6 +38,94 @@
# xargs -n1 | sort | uniq -d;
# done
# 20140811: otp-sha renamed to otp-sha1
OLD_FILES+=usr/bin/otp-sha
OLD_FILES+=usr/share/man/man1/otp-sha.1.gz
# 20140807: Remove private lib files that should not be installed.
OLD_FILES+=usr/lib/private/libatf-c.a
OLD_FILES+=usr/lib/private/libatf-c.so
OLD_FILES+=usr/lib/private/libatf-c_p.a
OLD_FILES+=usr/lib/private/libatf-c++.a
OLD_FILES+=usr/lib/private/libatf-c++.so
OLD_FILES+=usr/lib/private/libatf-c++_p.a
OLD_FILES+=usr/lib/private/libbsdstat.a
OLD_FILES+=usr/lib/private/libbsdstat.so
OLD_FILES+=usr/lib/private/libbsdstat_p.a
OLD_FILES+=usr/lib/private/libheimipcc.a
OLD_FILES+=usr/lib/private/libheimipcc.so
OLD_FILES+=usr/lib/private/libheimipcc_p.a
OLD_FILES+=usr/lib/private/libheimipcs.a
OLD_FILES+=usr/lib/private/libheimipcs.so
OLD_FILES+=usr/lib/private/libheimipcs_p.a
OLD_FILES+=usr/lib/private/libldns.a
OLD_FILES+=usr/lib/private/libldns.so
OLD_FILES+=usr/lib/private/libldns_p.a
OLD_FILES+=usr/lib/private/libssh.a
OLD_FILES+=usr/lib/private/libssh.so
OLD_FILES+=usr/lib/private/libssh.p.a
OLD_FILES+=usr/lib/private/libunbound.a
OLD_FILES+=usr/lib/private/libunbound.so
OLD_FILES+=usr/lib/private/libunbound_p.a
OLD_FILES+=usr/lib/private/libucl.a
OLD_FILES+=usr/lib/private/libucl.so
OLD_FILES+=usr/lib/private/libucl_p.a
# 20140803: Remove an obsolete man page
OLD_FILES+=usr/share/man/man9/pmap_change_wiring.9.gz
# 20140728: libsbuf restored to old version.
OLD_LIBS+=lib/libsbuf.so.7
# 20140728: Remove an obsolete man page
OLD_FILES+=usr/share/man/man9/VOP_GETVOBJECT.9.gz
OLD_FILES+=usr/share/man/man9/VOP_CREATEVOBJECT.9.gz
OLD_FILES+=usr/share/man/man9/VOP_DESTROYVOBJECT.9.gz
# 20140723: renamed to PCBGROUP.9
OLD_FILES+=usr/share/man/man9/PCBGROUPS.9.gz
# 20140718: Remove obsolete man pages
OLD_FILES+=usr/share/man/man9/zero_copy.9.gz
OLD_FILES+=usr/share/man/man9/zero_copy_sockets.9.gz
# 20140718: Remove an obsolete man page
OLD_FILES+=usr/share/man/man9/pmap_page_protect.9.gz
# 20140717: Remove an obsolete man page
OLD_FILES+=usr/share/man/man9/pmap_clear_reference.9.gz
# 20140716: Remove an incorrectly named man page
OLD_FILES+=usr/share/man/man9/pmap_ts_modified.9.gz
# 20140712: Removal of bsd.dtrace.mk
OLD_FILES+=usr/share/mk/bsd.dtrace.mk
# 20140705: turn libreadline into an internal lib
OLD_LIBS+=lib/libreadline.so.8
OLD_FILES+=usr/lib/libreadline.a
OLD_FILES+=usr/lib/libreadline_p.a
OLD_FILES+=usr/lib/libreadline.so
OLD_FILES+=usr/lib/libhistory.a
OLD_FILES+=usr/lib/libhistory_p.a
OLD_FILES+=usr/lib/libhistory.so
OLD_LIBS+=usr/lib/libhistory.so.8
OLD_FILES+=usr/include/readline/chardefs.h
OLD_FILES+=usr/include/readline/history.h
OLD_FILES+=usr/include/readline/keymaps.h
OLD_FILES+=usr/include/readline/readline.h
OLD_FILES+=usr/include/readline/rlconf.h
OLD_FILES+=usr/include/readline/rlstdc.h
OLD_FILES+=usr/include/readline/rltypedefs.h
OLD_FILES+=usr/include/readline/rltypedefs.h
OLD_FILES+=usr/share/info/readline.info.gz
OLD_FILES+=usr/share/man/man3/readline.3.gz
# 20140625: csup removal
OLD_FILES+=usr/bin/csup
OLD_FILES+=usr/bin/cpasswd
OLD_FILES+=usr/share/man/man1/csup.1.gz
OLD_FILES+=usr/share/man/man1/cpasswd.1.gz
OLD_FILES+=usr/share/examples/cvsup/README
OLD_FILES+=usr/share/examples/cvsup/cvs-supfile
OLD_FILES+=usr/share/examples/cvsup/stable-supfile
OLD_FILES+=usr/share/examples/cvsup/standard-supfile
OLD_DIRS+=usr/share/examples/cvsup
# 20140614: send-pr removal
OLD_FILES+=usr/bin/sendbug
OLD_FILES+=usr/share/info/send-pr.info.gz
OLD_FILES+=usr/share/man/man1/send-pr.1.gz
OLD_FILES+=usr/share/man/man1/sendbug.1.gz
OLD_FILES+=etc/gnats/freefall
OLD_DIRS+=etc/gnats
# 20140512: new clang import which bumps version from 3.4 to 3.4.1.
OLD_FILES+=usr/include/clang/3.4/__wmmintrin_aes.h
OLD_FILES+=usr/include/clang/3.4/__wmmintrin_pclmul.h
@ -544,6 +632,7 @@ OLD_FILES+=usr/share/man/man9/vfs_mount.9.gz
OLD_FILES+=usr/bin/cvs
OLD_FILES+=usr/bin/cvsbug
OLD_FILES+=usr/share/doc/psd/28.cvs/paper.ascii.gz
OLD_FILES+=usr/share/doc/psd/28.cvs/paper.ps.gz
OLD_DIRS+=usr/share/doc/psd/28.cvs
OLD_FILES+=usr/share/examples/cvs/contrib/README
OLD_FILES+=usr/share/examples/cvs/contrib/clmerge
@ -1164,9 +1253,6 @@ OLD_FILES+=usr/include/xmmintrin.h
.if ${TARGET_ARCH} == "amd64" || ${TARGET_ARCH} == "i386" || ${TARGET_ARCH} == "arm"
OLD_FILES+=usr/include/mmintrin.h
.endif
.if ${TARGET_ARCH} == "ia64"
OLD_FILES+=usr/include/ia64intrin.h
.endif
.if ${TARGET_ARCH} == "powerpc"
OLD_FILES+=usr/include/altivec.h
OLD_FILES+=usr/include/ppc-asm.h
@ -1184,10 +1270,6 @@ OLD_FILES+=usr/include/machine/rm7000.h
OLD_FILES+=usr/include/machine/defs.h
OLD_FILES+=usr/include/machine/queue.h
.endif
# 20100326: [ia64] removed <machine/nexusvar.h>
.if ${TARGET_ARCH} == "ia64"
OLD_FILES+=usr/include/machine/nexusvar.h
.endif
# 20100326: gcpio removal
OLD_FILES+=usr/bin/gcpio
OLD_FILES+=usr/share/info/cpio.info.gz
@ -1201,11 +1283,6 @@ OLD_FILES+=usr/share/man/man3/regexp.3.gz
OLD_FILES+=usr/share/man/man3/regsub.3.gz
# 20100303: actual removal of utmp.h
OLD_FILES+=usr/include/utmp.h
# 20100227: [ia64] removed <machine/sapicreg.h> and <machine/sapicvar.h>
.if ${TARGET_ARCH} == "ia64"
OLD_FILES+=usr/include/machine/sapicreg.h
OLD_FILES+=usr/include/machine/sapicvar.h
.endif
# 20100208: man pages moved
.if ${TARGET_ARCH} == "i386"
OLD_FILES+=usr/share/man/man4/i386/alpm.4.gz
@ -1898,14 +1975,6 @@ OLD_FILES+=usr/share/man/man8/arlcontrol.8.gz
OLD_FILES+=sbin/sunlabel
OLD_FILES+=usr/share/man/man8/sunlabel.8.gz
.endif
# 20080703: bsdlabel & fdisk removed on ia64
.if ${TARGET_ARCH} == "ia64"
OLD_FILES+=sbin/bsdlabel
OLD_FILES+=usr/share/man/man8/bsdlabel.8.gz
OLD_FILES+=usr/share/man/man8/disklabel.8.gz
OLD_FILES+=sbin/fdisk
OLD_FILES+=usr/share/man/man8/fdisk.8.gz
.endif
# 20080701: wpa_supplicant.conf moved to share/examples/etc/
OLD_FILES+=usr/share/examples/wpa_supplicant/wpa_supplicant.conf
OLD_DIRS+=usr/share/examples/wpa_supplicant
@ -2114,12 +2183,6 @@ OLD_FILES+=usr/include/sys/_elf_solaris.h
OLD_FILES+=usr/share/man/man3/pmc_x86_get_msr.3.gz
# 20071108: Removed very crunch OLDCARD support file
OLD_FILES+=etc/defaults/pccard.conf
# 20071104: Removed bsdlabel, fdisk and gpt from rescue on ia64.
.if ${TARGET_ARCH} == "ia64"
OLD_FILES+=rescue/bsdlabel
OLD_FILES+=rescue/fdisk
OLD_FILES+=rescue/gpt
.endif
# 20071025: rc.d/nfslocking superceeded by rc.d/lockd and rc.d/statd
OLD_FILES+=etc/rc.d/nfslocking
# 20070930: rename of cached to nscd
@ -2780,10 +2843,6 @@ OLD_FILES+=usr/share/man/man8/mount_std.8.gz
OLD_FILES+=usr/share/man/man4/uhidev.4.gz
# 20061106: archive_write_prepare.3 removed
OLD_FILES+=usr/share/man/man3/archive_write_prepare.3.gz
.if ${TARGET_ARCH} == "ia64"
# 20061104: skiload.help removed
OLD_FILES+=boot/skiload.help
.endif
# 20061018: pccardc removed
OLD_FILES+=usr/sbin/pccardc usr/share/man/man8/pccardc.8.gz
# 20060930: demangle.h from contrib/libstdc++/include/ext/

View File

@ -1,4 +1,4 @@
Updating Information for FreeBSD current users
Updating Information for FreeBSD current users.
This file is maintained and copyrighted by M. Warner Losh <imp@freebsd.org>.
See end of file for further details. For commonly done items, please see the
@ -31,6 +31,59 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 11.x IS SLOW:
disable the most expensive debugging functionality run
"ln -s 'abort:false,junk:false' /etc/malloc.conf".)
20140729:
The ofwfb driver, used to provide a graphics console on PowerPC when
using vt(4), no longer allows mmap() of all of physical memory. This
will prevent Xorg on PowerPC with some ATI graphics cards from
initializing properly unless x11-servers/xorg-server is updated to
1.12.4_8 or newer.
20140723:
The xdev targets have been converted to using TARGET and
TARGET_ARCH instead of XDEV and XDEV_ARCH.
20140719:
The default unbound configuration has been modified to address
issues with reverse lookups on networks that use private
address ranges. If you use the local_unbound service, run
"service local_unbound setup" as root to regenerate your
configuration, then "service local_unbound reload" to load the
new configuration.
20140709:
The GNU texinfo and GNU info pages are not built and installed
anymore, WITH_INFO knob has been added to allow to built and install
them again.
20140708:
The GNU readline library is now an INTERNALLIB - that is, it is
statically linked into consumers (GDB and variants) in the base
system, and the shared library is no longer installed. The
devel/readline port is available for third party software that
requires readline.
20140702:
The Itanium architecture (ia64) has been removed from the list of
known architectures. This is the first step in the removal of the
architecture.
20140701:
Commit r268115 has added NFSv4.1 server support, merged from
projects/nfsv4.1-server. Since this includes changes to the
internal interfaces between the NFS related modules, a full
build of the kernel and modules will be necessary.
__FreeBSD_version has been bumped.
20140629:
The WITHOUT_VT_SUPPORT kernel config knob has been renamed
WITHOUT_VT. (The other _SUPPORT knobs have a consistent meaning
which differs from the behaviour controlled by this knob.)
20140619:
Maximal length of the serial number in CTL was increased from 16 to
64 chars, that breaks ABI. All CTL-related tools, such as ctladm
and ctld, need to be rebuilt to work with a new kernel.
20140606:
The libatf-c and libatf-c++ major versions were downgraded to 0 and
1 respectively to match the upstream numbers. They were out of
@ -71,7 +124,8 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 11.x IS SLOW:
Although this has survived make universe and some upgrade scenarios,
other upgrade scenarios may have broken. At least one form of
temporary breakage was fixed with MAKESYSPATH settings for buildworld
as well...
as well... In cases where MAKESYSPATH isn't working with this
setting, you'll need to set it to the full path to your tree.
One side effect of all this cleaning up is that bsd.compiler.mk
is no longer implicitly included by bsd.own.mk. If you wish to

View File

@ -151,7 +151,6 @@ This command will query the status of the specified media unit, and
will move it to the element specified in its source attribute.
This is a convenient way to return media from a drive or portal
to its previous element in the changer.
.Pp
.It Ic position Xo
.Ar <to ET> <to EU>
.Op Cm inv
@ -173,7 +172,6 @@ Report which picker unit the changer is currently configured to use.
.Xc
Configure the changer to use picker
.Ar <unit> .
.Pp
.It Ic ielem Xo
.Op Ar <timeout>
.Xc
@ -292,13 +290,11 @@ Configure the changer to use picker 2 (third picker) for operations.
The
.Nm
program and SCSI changer driver were written by
.An Jason R. Thorpe Aq thorpej@and.com
.An Jason R. Thorpe Aq Mt thorpej@and.com
for And Communications,
.Pa http://www.and.com/ .
.Pp
Additional work by
.An Hans Huebner
.Aq hans@artcom.de
.An Hans Huebner Aq Mt hans@artcom.de
and
.An Steve Gunn
.Aq csg@waterspout.com .
.An Steve Gunn Aq Mt csg@waterspout.com .

View File

@ -40,8 +40,8 @@ MLINKS= csh.1 tcsh.1
# utilities of the same name are handled with the associated manpage,
# builtin.1 in share/man/man1/.
DPADD= ${LIBTERMCAP} ${LIBCRYPT}
LDADD= -ltermcap -lcrypt
DPADD= ${LIBTERMCAPW} ${LIBCRYPT}
LDADD= -ltermcapw -lcrypt
LINKS= ${BINDIR}/csh ${BINDIR}/tcsh

View File

@ -4,6 +4,6 @@
TESTSDIR= ${TESTSBASE}/bin/date
TAP_TESTS_SH= legacy_test
ATF_TESTS_SH= format_string_test
.include <bsd.test.mk>

View File

@ -0,0 +1,92 @@
#
# Regression tests for date(1)
#
# Submitted by Edwin Groothuis <edwin@FreeBSD.org>
#
# $FreeBSD$
#
#
# These two date/times have been chosen carefully -- they
# create both the single digit and double/multidigit version of
# the values.
#
# To create a new one, make sure you are using the UTC timezone!
#
TEST1=3222243 # 1970-02-07 07:04:03
TEST2=1005600000 # 2001-11-12 21:11:12
check()
{
local format_string exp_output_1 exp_output_2
format_string=${1}
exp_output_1=${2}
exp_output_2=${3}
atf_check -o "inline:${exp_output_1}\n" \
date -r ${TEST1} +%${format_string}
atf_check -o "inline:${exp_output_2}\n" \
date -r ${TEST2} +%${format_string}
}
format_string_test()
{
local desc exp_output_1 exp_output_2 flag
desc=${1}
flag=${2}
exp_output_1=${3}
exp_output_2=${4}
atf_test_case ${desc}_test
eval "
${desc}_test_body() {
check ${flag} '${exp_output_1}' '${exp_output_2}';
}"
atf_add_test_case ${desc}_test
}
atf_init_test_cases()
{
format_string_test A A Saturday Monday
format_string_test a a Sat Mon
format_string_test B B February November
format_string_test b b Feb Nov
format_string_test C C 19 20
format_string_test c c "Sat Feb 7 07:04:03 1970" "Mon Nov 12 21:20:00 2001"
format_string_test D D 02/07/70 11/12/01
format_string_test d d 07 12
format_string_test e e " 7" 12
format_string_test F F "1970-02-07" "2001-11-12"
format_string_test G G 1970 2001
format_string_test g g 70 01
format_string_test H H 07 21
format_string_test h h Feb Nov
format_string_test I I 07 09
format_string_test j j 038 316
format_string_test k k " 7" 21
format_string_test l l " 7" " 9"
format_string_test M M 04 20
format_string_test m m 02 11
format_string_test p p AM PM
format_string_test R R 07:04 21:20
format_string_test r r "07:04:03 AM" "09:20:00 PM"
format_string_test S S 03 00
format_string_test s s ${TEST1} ${TEST2}
format_string_test U U 05 45
format_string_test u u 6 1
format_string_test V V 06 46
format_string_test v v " 7-Feb-1970" "12-Nov-2001"
format_string_test W W 05 46
format_string_test w w 6 1
format_string_test X X "07:04:03" "21:20:00"
format_string_test x x "02/07/70" "11/12/01"
format_string_test Y Y 1970 2001
format_string_test y y 70 01
format_string_test Z Z UTC UTC
format_string_test z z +0000 +0000
format_string_test percent % % %
format_string_test plus + "Sat Feb 7 07:04:03 UTC 1970" "Mon Nov 12 21:20:00 UTC 2001"
}

View File

@ -1,91 +0,0 @@
#!/bin/sh
#
# Regression tests for date(1)
#
# Submitted by Edwin Groothuis <edwin@FreeBSD.org>
#
# $FreeBSD$
#
#
# These two date/times have been chosen carefully, they
# create both the single digit and double/multidigit version of
# the values.
#
# To create a new one, make sure you are using the UTC timezone!
#
TEST1=3222243 # 1970-02-07 07:04:03
TEST2=1005600000 # 2001-11-12 21:11:12
export LC_ALL=C
export TZ=UTC
count=0
check()
{
S=$1
A1=$2
A2=$3
count=`expr ${count} + 1`
if [ -z "${A2}" ]; then A2=${A1}; fi
R=`date -r ${TEST1} +%${S}`
if [ "${R}" = "${A1}" ]; then
echo "ok ${S}{t1}"
else
echo "no ok ${S}{t1} - (got ${R}, expected ${A1})"
fi
R=`date -r ${TEST2} +%${S}`
if [ "${R}" = "${A2}" ]; then
echo "ok ${S}{t2}"
else
echo "no ok ${S}{t2} - (got ${R}, expected ${A2})"
fi
}
echo "1..78"
check A Saturday Monday
check a Sat Mon
check B February November
check b Feb Nov
check C 19 20
check c "Sat Feb 7 07:04:03 1970" "Mon Nov 12 21:20:00 2001"
check D 02/07/70 11/12/01
check d 07 12
check e " 7" 12
check F "1970-02-07" "2001-11-12"
check G 1970 2001
check g 70 01
check H 07 21
check h Feb Nov
check I 07 09
check j 038 316
check k " 7" 21
check l " 7" " 9"
check M 04 20
check m 02 11
check p AM PM
check R 07:04 21:20
check r "07:04:03 AM" "09:20:00 PM"
check S 03 00
check s ${TEST1} ${TEST2}
check U 05 45
check u 6 1
check V 06 46
check v " 7-Feb-1970" "12-Nov-2001"
check W 05 46
check w 6 1
check X "07:04:03" "21:20:00"
check x "02/07/70" "11/12/01"
check Y 1970 2001
check y 70 01
check Z UTC UTC
check z +0000 +0000
check % % %
check + "Sat Feb 7 07:04:03 UTC 1970" "Mon Nov 12 21:20:00 UTC 2001"

View File

@ -121,4 +121,4 @@ command appeared in
The
.Nm
utility and this manual page were written by
.An Dag-Erling Sm\(/orgrav Aq des@FreeBSD.org .
.An Dag-Erling Sm\(/orgrav Aq Mt des@FreeBSD.org .

View File

@ -11,8 +11,8 @@ LDADD= -lutil
.if !defined(RELEASE_CRUNCH) && \
${MK_LS_COLORS} != no
CFLAGS+= -DCOLORLS
DPADD+= ${LIBTERMCAP}
LDADD+= -ltermcap
DPADD+= ${LIBTERMCAPW}
LDADD+= -ltermcapw
.endif
.include <bsd.prog.mk>

View File

@ -278,6 +278,7 @@ fastcopy(const char *from, const char *to, struct stat *sbp)
static char *bp = NULL;
mode_t oldmode;
int nread, from_fd, to_fd;
struct stat tsb;
if ((from_fd = open(from, O_RDONLY, 0)) < 0) {
warn("fastcopy: open() failed (from): %s", from);
@ -336,10 +337,18 @@ err: if (unlink(to))
* if the server supports flags and we were trying to *remove* flags
* on a file that we copied, i.e., that we didn't create.)
*/
errno = 0;
if (fchflags(to_fd, sbp->st_flags))
if (errno != EOPNOTSUPP || sbp->st_flags != 0)
warn("%s: set flags (was: 0%07o)", to, sbp->st_flags);
if (fstat(to_fd, &tsb) == 0) {
if ((sbp->st_flags & ~UF_ARCHIVE) !=
(tsb.st_flags & ~UF_ARCHIVE)) {
if (fchflags(to_fd,
sbp->st_flags | (tsb.st_flags & UF_ARCHIVE)))
if (errno != EOPNOTSUPP ||
((sbp->st_flags & ~UF_ARCHIVE) != 0))
warn("%s: set flags (was: 0%07o)",
to, sbp->st_flags);
}
} else
warn("%s: cannot stat", to);
tval[0].tv_sec = sbp->st_atime;
tval[1].tv_sec = sbp->st_mtime;

View File

@ -291,5 +291,4 @@ Solaris 7.
They made their first appearance in
.Fx 5.3 .
.Sh AUTHORS
.An Andrew Doran
.Aq ad@NetBSD.org
.An Andrew Doran Aq Mt ad@NetBSD.org

View File

@ -29,7 +29,7 @@
.\" @(#)ps.1 8.3 (Berkeley) 4/18/94
.\" $FreeBSD$
.\"
.Dd June 6, 2014
.Dd August 7, 2014
.Dt PS 1
.Os
.Sh NAME
@ -332,7 +332,6 @@ the include file
.It Dv "P_SINGLE_BOUNDARY" Ta No "0x400000" Ta "Threads should suspend at user boundary"
.It Dv "P_HWPMC" Ta No "0x800000" Ta "Process is using HWPMCs"
.It Dv "P_JAILED" Ta No "0x1000000" Ta "Process is in jail"
.It Dv "P_ORPHAN" Ta No "0x2000000" Ta "Orphaned by original parent, reparented to debugger"
.It Dv "P_INEXEC" Ta No "0x4000000" Ta "Process is in execve()"
.It Dv "P_STATCHILD" Ta No "0x8000000" Ta "Child process stopped or exited"
.It Dv "P_INMEM" Ta No "0x10000000" Ta "Loaded into memory"

View File

@ -121,7 +121,6 @@ each directory's contents are processed (as well as before the attempt
is made to remove the directory).
If the user does not respond affirmatively, the file hierarchy rooted in
that directory is skipped.
.Pp
.It Fl r
Equivalent to
.Fl R .

View File

@ -335,7 +335,7 @@ rm_tree(char **argv)
warn("%s", p->fts_path);
eval = 1;
}
if (errno)
if (!fflag && errno)
err(1, "fts_read");
fts_close(fts);
}

View File

@ -485,6 +485,6 @@ NFSv4 ACL support was introduced in
The
.Nm
utility was written by
.An Chris D. Faulhaber Aq jedgar@fxp.org .
.An Chris D. Faulhaber Aq Mt jedgar@fxp.org .
NFSv4 ACL support was implemented by
.An Edward Tomasz Napierala Aq trasz@FreeBSD.org .
.An Edward Tomasz Napierala Aq Mt trasz@FreeBSD.org .

View File

@ -18,8 +18,8 @@ SRCS= ${SHSRCS} ${GENSRCS} ${GENHDRS}
# utilities of the same name are handled with the associated manpage,
# builtin.1 in share/man/man1/.
DPADD= ${LIBEDIT} ${LIBTERMCAP}
LDADD= -ledit -ltermcap
DPADD= ${LIBEDIT} ${LIBTERMCAPW}
LDADD= -ledit -ltermcapw
CFLAGS+=-DSHELL -I. -I${.CURDIR}
# for debug:

View File

@ -1250,8 +1250,16 @@ bltincmd(int argc, char **argv)
int
breakcmd(int argc, char **argv)
{
int n = argc > 1 ? number(argv[1]) : 1;
long n;
char *end;
if (argc > 1) {
/* Allow arbitrarily large numbers. */
n = strtol(argv[1], &end, 10);
if (!is_digit(argv[1][0]) || *end != '\0')
error("Illegal number: %s", argv[1]);
} else
n = 1;
if (n > loopnest)
n = loopnest;
if (n > 0) {

View File

@ -365,7 +365,7 @@ find_command(const char *name, struct cmdentry *entry, int act,
for (;(fullname = padvance(&path, name)) != NULL; stunalloc(fullname)) {
idx++;
if (pathopt) {
if (prefix("func", pathopt)) {
if (strncmp(pathopt, "func", 4) == 0) {
/* handled below */
} else {
continue; /* ignore unimplemented options */

View File

@ -846,9 +846,11 @@ varisset(const char *name, int nulok)
}
} else if (is_digit(*name)) {
char *ap;
int num = atoi(name);
long num;
if (num > shellparam.nparam)
errno = 0;
num = strtol(name, NULL, 10);
if (errno != 0 || num > shellparam.nparam)
return 0;
if (num == 0)
@ -928,17 +930,16 @@ varvalue(const char *name, int quoted, int subtype, int flag)
STPUTC(sep, expdest);
}
break;
case '0':
p = arg0;
strtodest(p, flag, subtype, quoted);
break;
default:
if (is_digit(*name)) {
num = atoi(name);
if (num > 0 && num <= shellparam.nparam) {
if (num == 0)
p = arg0;
else if (num > 0 && num <= shellparam.nparam)
p = shellparam.p[num - 1];
strtodest(p, flag, subtype, quoted);
}
else
break;
strtodest(p, flag, subtype, quoted);
}
break;
}

View File

@ -562,6 +562,7 @@ getjob_nonotfound(const char *name)
{
int jobno;
struct job *found, *jp;
size_t namelen;
pid_t pid;
int i;
@ -603,10 +604,12 @@ currentjob: if ((jp = getcurjob(NULL)) == NULL)
if (found != NULL)
return (found);
} else {
namelen = strlen(name);
found = NULL;
for (jp = jobtab, i = njobs ; --i >= 0 ; jp++) {
if (jp->used && jp->nprocs > 0
&& prefix(name + 1, jp->ps[0].cmd)) {
&& strncmp(jp->ps[0].cmd, name + 1,
namelen - 1) == 0) {
if (found)
error("%s: ambiguous", name);
found = jp;

View File

@ -411,13 +411,32 @@ static const struct limits limits[] = {
{ (char *) 0, (char *)0, 0, 0, '\0' }
};
enum limithow { SOFT = 0x1, HARD = 0x2 };
static void
printlimit(enum limithow how, const struct rlimit *limit,
const struct limits *l)
{
rlim_t val = 0;
if (how & SOFT)
val = limit->rlim_cur;
else if (how & HARD)
val = limit->rlim_max;
if (val == RLIM_INFINITY)
out1str("unlimited\n");
else
{
val /= l->factor;
out1fmt("%jd\n", (intmax_t)val);
}
}
int
ulimitcmd(int argc __unused, char **argv __unused)
{
int c;
rlim_t val = 0;
enum { SOFT = 0x1, HARD = 0x2 }
how = SOFT | HARD;
enum limithow how = SOFT | HARD;
const struct limits *l;
int set, all = 0;
int optc, what;
@ -453,17 +472,22 @@ ulimitcmd(int argc __unused, char **argv __unused)
if (strcmp(p, "unlimited") == 0)
val = RLIM_INFINITY;
else {
val = 0;
char *end;
uintmax_t uval;
while ((c = *p++) >= '0' && c <= '9')
{
val = (val * 10) + (long)(c - '0');
if (val < 0)
break;
}
if (c)
if (*p < '0' || *p > '9')
error("bad number");
errno = 0;
uval = strtoumax(p, &end, 10);
if (errno != 0 || *end != '\0')
error("bad number");
if (uval > UINTMAX_MAX / l->factor)
error("bad number");
uval *= l->factor;
val = (rlim_t)uval;
if (val < 0 || (uintmax_t)val != uval ||
val == RLIM_INFINITY)
error("bad number");
val *= l->factor;
}
}
if (all) {
@ -471,10 +495,6 @@ ulimitcmd(int argc __unused, char **argv __unused)
char optbuf[40];
if (getrlimit(l->cmd, &limit) < 0)
error("can't get limit: %s", strerror(errno));
if (how & SOFT)
val = limit.rlim_cur;
else if (how & HARD)
val = limit.rlim_max;
if (l->units)
snprintf(optbuf, sizeof(optbuf),
@ -483,13 +503,7 @@ ulimitcmd(int argc __unused, char **argv __unused)
snprintf(optbuf, sizeof(optbuf),
"(-%c) ", l->option);
out1fmt("%-18s %18s ", l->name, optbuf);
if (val == RLIM_INFINITY)
out1str("unlimited\n");
else
{
val /= l->factor;
out1fmt("%jd\n", (intmax_t)val);
}
printlimit(how, &limit, l);
}
return 0;
}
@ -503,19 +517,7 @@ ulimitcmd(int argc __unused, char **argv __unused)
limit.rlim_max = val;
if (setrlimit(l->cmd, &limit) < 0)
error("bad limit: %s", strerror(errno));
} else {
if (how & SOFT)
val = limit.rlim_cur;
else if (how & HARD)
val = limit.rlim_max;
if (val == RLIM_INFINITY)
out1str("unlimited\n");
else
{
val /= l->factor;
out1fmt("%jd\n", (intmax_t)val);
}
}
} else
printlimit(how, &limit, l);
return 0;
}

View File

@ -60,21 +60,6 @@ char nullstr[1]; /* zero length string */
*/
/*
* prefix -- see if pfx is a prefix of string.
*/
int
prefix(const char *pfx, const char *string)
{
while (*pfx) {
if (*pfx++ != *string++)
return 0;
}
return 1;
}
/*
* Convert a string of digits to an integer, printing an error message on
* failure.

View File

@ -35,7 +35,6 @@
#include <string.h>
int prefix(const char *, const char *);
int number(const char *);
int is_number(const char *);

View File

@ -4,15 +4,12 @@
TESTSDIR= ${TESTSBASE}/bin/sh
TAP_TESTS_SH= legacy_test
TAP_TESTS_SH_SED_legacy_test= -e 's,__SH__,/bin/sh,g'
# Some tests in here are silently not run when the tests are executed as
# root. Explicitly tell Kyua to drop privileges.
#
# TODO(jmmv): Kyua needs to do this by default, not only when explicitly
# requested. See https://code.google.com/p/kyua/issues/detail?id=6
TEST_METADATA.legacy_test+= required_user="unprivileged"
SUBDIR+= builtins errors execution expansion parameters parser set-e
TESTS_SUBDIRS+= builtins
TESTS_SUBDIRS+= errors
TESTS_SUBDIRS+= execution
TESTS_SUBDIRS+= expansion
TESTS_SUBDIRS+= parameters
TESTS_SUBDIRS+= parser
TESTS_SUBDIRS+= set-e
.include <bsd.test.mk>

View File

@ -1,9 +1,13 @@
# $FreeBSD$
.include <bsd.own.mk>
.include <src.opts.mk>
FILESDIR= ${TESTSBASE}/bin/sh/builtins
KYUAFILE= no
TESTSDIR= ${TESTSBASE}/bin/sh/${.CURDIR:T}
.PATH: ${.CURDIR:H}
ATF_TESTS_SH= functional_test
FILESDIR= ${TESTSDIR}
FILES= alias.0 alias.0.stdout
FILES+= alias.1 alias.1.stderr
@ -14,6 +18,7 @@ FILES+= break2.0 break2.0.stdout
FILES+= break3.0
FILES+= break4.4
FILES+= break5.4
FILES+= break6.0
FILES+= builtin1.0
FILES+= case1.0
FILES+= case2.0
@ -99,7 +104,9 @@ FILES+= local1.0
FILES+= local2.0
FILES+= local3.0
FILES+= local4.0
.if ${MK_NLS} != "no"
FILES+= locale1.0
.endif
FILES+= printf1.0
FILES+= printf2.0
FILES+= printf3.0

View File

@ -0,0 +1,8 @@
# $FreeBSD$
# Per POSIX, this need only work if LONG_MAX > 4294967295.
while :; do
break 4294967296
echo bad
exit 3
done

View File

@ -1,9 +1,11 @@
# $FreeBSD$
.include <bsd.own.mk>
TESTSDIR= ${TESTSBASE}/bin/sh/${.CURDIR:T}
FILESDIR= ${TESTSBASE}/bin/sh/errors
KYUAFILE= no
.PATH: ${.CURDIR:H}
ATF_TESTS_SH= functional_test
FILESDIR= ${TESTSDIR}
FILES= assignment-error1.0
FILES+= assignment-error2.0

View File

@ -1 +1 @@
./errors/bad-parm-exp2.2: ${}: Bad substitution
./bad-parm-exp2.2: ${}: Bad substitution

View File

@ -1 +1 @@
./errors/bad-parm-exp3.2: ${foo/}: Bad substitution
./bad-parm-exp3.2: ${foo/}: Bad substitution

View File

@ -1 +1 @@
./errors/bad-parm-exp4.2: ${foo:@...}: Bad substitution
./bad-parm-exp4.2: ${foo:@...}: Bad substitution

View File

@ -1 +1 @@
./errors/bad-parm-exp5.2: ${/}: Bad substitution
./bad-parm-exp5.2: ${/}: Bad substitution

View File

@ -1 +1 @@
./errors/bad-parm-exp6.2: ${foo...}: Bad substitution
./bad-parm-exp6.2: ${foo...}: Bad substitution

View File

@ -1,9 +1,11 @@
# $FreeBSD$
.include <bsd.own.mk>
TESTSDIR= ${TESTSBASE}/bin/sh/${.CURDIR:T}
FILESDIR= ${TESTSBASE}/bin/sh/execution
KYUAFILE= no
.PATH: ${.CURDIR:H}
ATF_TESTS_SH= functional_test
FILESDIR= ${TESTSDIR}
FILES= bg1.0
FILES+= bg2.0

View File

@ -1,9 +1,11 @@
# $FreeBSD$
.include <bsd.own.mk>
TESTSDIR= ${TESTSBASE}/bin/sh/${.CURDIR:T}
FILESDIR= ${TESTSBASE}/bin/sh/expansion
KYUAFILE= no
.PATH: ${.CURDIR:H}
ATF_TESTS_SH= functional_test
FILESDIR= ${TESTSDIR}
FILES= arith1.0
FILES+= arith2.0

78
bin/sh/tests/functional_test.sh Executable file
View File

@ -0,0 +1,78 @@
#
# Copyright 2014 EMC Corp.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# $FreeBSD$
SRCDIR=$(atf_get_srcdir)
check()
{
local tc=${1}; shift
export SH=$(atf_config_get bin.sh.test_shell /bin/sh)
local err_file="${SRCDIR}/${tc}.stderr"
[ -f "${err_file}" ] && err_flag="-e file:${err_file}"
local out_file="${SRCDIR}/${tc}.stdout"
[ -f "${out_file}" ] && out_flag="-o file:${out_file}"
# We need to copy the testcase scenario file because some of the
# testcases hardcode relative paths in the stderr/stdout.
#
# TODO: we might be able to generate this path at build time
cp ${SRCDIR}/${tc} .
atf_check -s exit:${tc##*.} ${err_flag} ${out_flag} ${SH} "./${tc}"
}
add_testcase()
{
local tc=${1}
local tc_escaped word
case "${tc%.*}" in
*-*)
local IFS="-"
for word in ${tc%.*}; do
tc_escaped="${tc_escaped:+${tc_escaped}_}${word}"
done
;;
*)
tc_escaped=${tc%.*}
;;
esac
atf_test_case ${tc_escaped}
eval "${tc_escaped}_body() { check ${tc}; }"
atf_add_test_case ${tc_escaped}
}
atf_init_test_cases()
{
for path in $(find -Es "${SRCDIR}" -regex '.*\.[0-9]+$'); do
add_testcase ${path##*/}
done
}

View File

@ -1,46 +0,0 @@
# $FreeBSD$
: ${SH:="__SH__"}
export SH
# TODO(jmmv): The Kyua TAP interface should be passing us the value of
# "srcdir" as an environment variable, just as it does with the ATF
# interface in the form of a configuration variable. For now, just try
# to guess this.
: ${TESTS_DATA:=$(dirname ${0})}
COUNTER=1
do_test() {
c=${COUNTER}
COUNTER=$((COUNTER+1))
${SH} $1 > tmp.stdout 2> tmp.stderr
if [ $? -ne $2 ]; then
echo "not ok ${c} - ${1} # wrong exit status"
rm tmp.stdout tmp.stderr
return
fi
sed -I '' -e "s|^${TESTS_DATA}|.|" tmp.stderr
for i in stdout stderr; do
if [ -f ${1}.${i} ]; then
if ! cmp -s tmp.${i} ${1}.${i}; then
echo "not ok ${c} - ${1} # wrong output on ${i}"
rm tmp.stdout tmp.stderr
return
fi
elif [ -s tmp.${i} ]; then
echo "not ok ${c} - ${1} # wrong output on ${i}"
rm tmp.stdout tmp.stderr
return
fi
done
echo "ok ${c} - ${1}"
rm tmp.stdout tmp.stderr
}
TESTS=$(find -Es ${TESTS_DATA} -regex ".*\.[0-9]+")
printf "1..%d\n" $(echo ${TESTS} | wc -w)
for i in ${TESTS} ; do
do_test ${i} ${i##*.}
done

View File

@ -1,9 +1,11 @@
# $FreeBSD$
.include <bsd.own.mk>
TESTSDIR= ${TESTSBASE}/bin/sh/${.CURDIR:T}
FILESDIR= ${TESTSBASE}/bin/sh/parameters
KYUAFILE= no
.PATH: ${.CURDIR:H}
ATF_TESTS_SH= functional_test
FILESDIR= ${TESTSDIR}
FILES= env1.0
FILES+= exitstatus1.0
@ -13,6 +15,9 @@ FILES+= optind1.0
FILES+= optind2.0
FILES+= positional1.0
FILES+= positional2.0
FILES+= positional3.0
FILES+= positional4.0
FILES+= positional5.0
FILES+= pwd1.0
FILES+= pwd2.0

View File

@ -0,0 +1,4 @@
# $FreeBSD$
r=$(${SH} -c 'echo ${01:+yes}${010:+yes}' '' a '' '' '' '' '' '' '' '' b)
[ "$r" = yesyes ]

View File

@ -0,0 +1,4 @@
# $FreeBSD$
set -- "x$0" 2 3 4 5 6 7 8 9 "y$0"
[ "${01}.${010}" = "$1.${10}" ]

View File

@ -0,0 +1,14 @@
# $FreeBSD$
i=1
r=0
while [ $i -lt $((0x100000000)) ]; do
t=
eval t=\${$i-x}
case $t in
x) ;;
*) echo "Problem with \${$i}" >&2; r=1 ;;
esac
i=$((i + 0x10000000))
done
exit $r

View File

@ -1,9 +1,11 @@
# $FreeBSD$
.include <bsd.own.mk>
TESTSDIR= ${TESTSBASE}/bin/sh/${.CURDIR:T}
FILESDIR= ${TESTSBASE}/bin/sh/parser
KYUAFILE= no
.PATH: ${.CURDIR:H}
ATF_TESTS_SH= functional_test
FILESDIR= ${TESTSDIR}
FILES= alias1.0
FILES+= alias2.0

View File

@ -1,9 +1,11 @@
# $FreeBSD$
.include <bsd.own.mk>
TESTSDIR= ${TESTSBASE}/bin/sh/${.CURDIR:T}
FILESDIR= ${TESTSBASE}/bin/sh/set-e
KYUAFILE= no
.PATH: ${.CURDIR:H}
ATF_TESTS_SH= functional_test
FILESDIR= ${TESTSDIR}
FILES= and1.0
FILES+= and2.1

View File

@ -1,4 +1,4 @@
#!/usr/bin/sh
#!/bin/sh
#
# shellsnoop - A program to print read/write details from shells,
# such as keystrokes and command outputs.
@ -140,18 +140,14 @@ dtrace -n '
/*
* Remember this PID is a shell child
*/
syscall::exec:entry, syscall::exece:entry
syscall::execve:entry
/execname == "sh" || execname == "ksh" || execname == "csh" ||
execname == "tcsh" || execname == "zsh" || execname == "bash"/
{
child[pid] = 1;
/* debug */
this->parent = (char *)curthread->t_procp->p_parent->p_user.u_comm;
OPT_debug == 1 ? printf("PID %d CMD %s started. (%s)\n",
pid, execname, stringof(this->parent)) : 1;
}
syscall::exec:entry, syscall::exece:entry
syscall::execve:entry
/(OPT_pid == 1 && PID != ppid) || (OPT_uid == 1 && UID != uid)/
{
/* forget if filtered */
@ -256,12 +252,12 @@ dtrace -n '
/*
* Cleanup
*/
syscall::rexit:entry
syscall::exit:entry
{
child[pid] = 0;
/* debug */
this->parent = (char *)curthread->t_procp->p_parent->p_user.u_comm;
this->parent = (char *)curthread->td_proc->p_pptr->p_comm;
OPT_debug == 1 ? printf("PID %d CMD %s exited. (%s)\n",
pid, execname, stringof(this->parent)) : 1;
}

View File

@ -1,10 +1,10 @@
#!/usr/bin/ksh
#!/bin/sh
#
# rwsnoop - snoop read/write events.
# Written using DTrace (Solaris 10 3/05).
# Originally written using DTrace (Solaris 10 3/05).
#
# This is measuring reads and writes at the application level. This matches
# the syscalls read, write, pread and pwrite.
# the syscalls read, and write.
#
# $Id: rwsnoop 3 2007-08-01 10:50:08Z brendan $
#
@ -12,15 +12,14 @@
#
# rwsnoop # default output
#
# -j # print project ID
# -P # print parent process ID
# -t # print timestamp, us
# -v # print time, string
# -Z # print zone ID
# -J # print jail ID
# -n name # this process name only
# -p PID # this PID only
# eg,
# rwsnoop -Z # print zone ID
# rwsnoop -J # print jail ID
# rwsnoop -n bash # monitor processes named "bash"
# rwsnoop > out.txt # recommended
#
@ -32,8 +31,7 @@
# FIELDS:
# TIME Timestamp, us
# TIMESTR Time, string
# ZONE Zone ID
# PROJ Project ID
# JAIL JAIL ID
# UID User ID
# PID Process ID
# PPID Parent Process ID
@ -71,6 +69,7 @@
# 24-Jul-2005 Brendan Gregg Created this.
# 17-Sep-2005 " " Increased switchrate.
# 17-Sep-2005 " " Last update.
# 26-Jul-2014 George Neville-Neil Port to FreeBSD
#
@ -79,8 +78,8 @@
#
### default variables
opt_name=0; opt_pid=0; opt_proj=0; opt_zone=0; opt_time=0; opt_timestr=0
opt_bytes=1; filter=0; pname=.; pid=0; opt_ppid=0
opt_name=0; opt_pid=0; opt_jailid=0; opt_time=0; opt_timestr=0
opt_bytes=1; filter=0; pname=.; pid=0; opt_ppid=0;
### process options
while getopts n:Pp:jtvZ name
@ -89,23 +88,21 @@ do
n) opt_name=1; pname=$OPTARG ;;
p) opt_pid=1; pid=$OPTARG ;;
P) opt_ppid=1 ;;
j) opt_proj=1 ;;
t) opt_time=1 ;;
v) opt_timestr=1 ;;
Z) opt_zone=1 ;;
J) opt_jailid=1 ;;
h|?) cat <<-END >&2
USAGE: rwsnoop [-jPtvZ] [-n name] [-p pid]
-j # print project ID
-P # print parent process ID
-t # print timestamp, us
-v # print time, string
-Z # print zone ID
-J # print jail ID
-n name # this process name only
-p PID # this PID only
eg,
rwsnoop # default output
rwsnoop -Z # print zone ID
rwsnoop -J # print jail ID
rwsnoop -n bash # monitor processes named "bash"
END
exit 1
@ -115,11 +112,13 @@ done
shift $(( $OPTIND - 1 ))
### option logic
if (( opt_name || opt_pid )); then
if [ $opt_name -ne 0 ]; then
filter=1
fi
if [ $opt_pid -ne 0 ]; then
filter=1
fi
#################################
# --- Main Program, DTrace ---
@ -128,8 +127,7 @@ fi
/*
* Command line arguments
*/
inline int OPT_proj = '$opt_proj';
inline int OPT_zone = '$opt_zone';
inline int OPT_jailid = '$opt_jailid';
inline int OPT_bytes = '$opt_bytes';
inline int OPT_name = '$opt_name';
inline int OPT_ppid = '$opt_ppid';
@ -151,11 +149,10 @@ fi
/* print header */
OPT_time ? printf("%-14s ", "TIME") : 1;
OPT_timestr ? printf("%-20s ", "TIMESTR") : 1;
OPT_proj ? printf("%5s ", "PROJ") : 1;
OPT_zone ? printf("%5s ", "ZONE") : 1;
OPT_jailid ? printf("%5s ", "JAILID") : 1;
OPT_ppid ? printf("%6s ", "PPID") : 1;
printf("%5s %6s %-12s %1s %7s %s\n",
"UID", "PID", "CMD", "D", "BYTES", "FILE");
printf("%5s %6s %-12s %4s %1s %7s\n",
"UID", "PID", "CMD", "FD", "D", "BYTES");
}
/*
@ -205,7 +202,10 @@ fi
{
/*
* Fetch filename
* XXX Not yet implemented.
*/
/*
this->filistp = curthread->t_procp->p_user.u_finfo.fi_list;
this->ufentryp = (uf_entry_t *)((uint64_t)this->filistp +
(uint64_t)self->fd * (uint64_t)sizeof(uf_entry_t));
@ -213,17 +213,16 @@ fi
this->vnodep = this->filep != 0 ? this->filep->f_vnode : 0;
self->vpath = this->vnodep ? (this->vnodep->v_path != 0 ?
cleanpath(this->vnodep->v_path) : "<unknown>") : "<unknown>";
*/
/*
* Print details
*/
OPT_time ? printf("%-14d ", timestamp / 1000) : 1;
OPT_timestr ? printf("%-20Y ", walltimestamp) : 1;
OPT_proj ? printf("%5d ", curpsinfo->pr_projid) : 1;
OPT_zone ? printf("%5d ", curpsinfo->pr_zoneid) : 1;
OPT_jailid ? printf("%5d ", curpsinfo->pr_jailid) : 1;
OPT_ppid ? printf("%6d ", ppid) : 1;
printf("%5d %6d %-12.12s %1s %7d %s\n",
uid, pid, execname, self->rw, (int)self->size, self->vpath);
printf("%5d %6d %-12.12s %4d %1s %7d\n",
uid, pid, execname, self->fd, self->rw, (int)self->size);
self->ok = 0;
self->fd = 0;

View File

@ -25,6 +25,7 @@
*/
/*
* Copyright (c) 2012 by Delphix. All rights reserved.
* Copyright (c) 2013, Joyent, Inc. All rights reserved.
*/
#include <sys/types.h>
@ -513,6 +514,7 @@ static void
print_probe_info(const dtrace_probeinfo_t *p)
{
char buf[BUFSIZ];
char *user;
int i;
oprintf("\n\tProbe Description Attributes\n");
@ -536,10 +538,14 @@ print_probe_info(const dtrace_probeinfo_t *p)
oprintf("\n\tArgument Types\n");
for (i = 0; i < p->dtp_argc; i++) {
if (p->dtp_argv[i].dtt_flags & DTT_FL_USER)
user = "userland ";
else
user = "";
if (ctf_type_name(p->dtp_argv[i].dtt_ctfp,
p->dtp_argv[i].dtt_type, buf, sizeof (buf)) == NULL)
(void) strlcpy(buf, "(unknown)", sizeof (buf));
oprintf("\t\targs[%d]: %s\n", i, buf);
oprintf("\t\targs[%d]: %s%s\n", i, user, buf);
}
if (p->dtp_argc == 0)

View File

@ -0,0 +1,32 @@
/*
* This file and its contents are supplied under the terms of the
* Common Development and Distribution License ("CDDL"), version 1.0.
* You may only use this file in accordance with the terms of version
* 1.0 of the CDDL.
*
* A full copy of the text of the CDDL should have accompanied this
* source. A copy of the CDDL is also available via the Internet at
* http://www.illumos.org/license/CDDL.
*/
/*
* Copyright (c) 2013 Joyent, Inc. All rights reserved.
*/
#pragma D option quiet
#pragma D option encoding=utf8
#pragma D option aggzoom
tick-1ms
/i++ < 320/
{
@ = lquantize(i, 0, 640, 1, i);
@ = lquantize(641 - i, 0, 640, 1, i);
}
tick-1ms
/i == 320/
{
printa(@);
exit(0);
}

View File

@ -0,0 +1,646 @@
value ------------- Distribution ------------- count
0 | 0
1 | 1
2 |▏ 2
3 |▎ 3
4 |▍ 4
5 |▌ 5
6 |▋ 6
7 |▊ 7
8 |▉ 8
9 |█ 9
10 |█▏ 10
11 |█▎ 11
12 |█▍ 12
13 |█▌ 13
14 |█▋ 14
15 |█▊ 15
16 |█▉ 16
17 |██ 17
18 |██▏ 18
19 |██▎ 19
20 |██▍ 20
21 |██▍ 21
22 |██▌ 22
23 |██▋ 23
24 |██▊ 24
25 |██▉ 25
26 |███ 26
27 |███▏ 27
28 |███▎ 28
29 |███▍ 29
30 |███▌ 30
31 |███▋ 31
32 |███▊ 32
33 |███▉ 33
34 |████ 34
35 |████▏ 35
36 |████▎ 36
37 |████▍ 37
38 |████▌ 38
39 |████▋ 39
40 |████▊ 40
41 |████▊ 41
42 |████▉ 42
43 |█████ 43
44 |█████▏ 44
45 |█████▎ 45
46 |█████▍ 46
47 |█████▌ 47
48 |█████▋ 48
49 |█████▊ 49
50 |█████▉ 50
51 |██████ 51
52 |██████▏ 52
53 |██████▎ 53
54 |██████▍ 54
55 |██████▌ 55
56 |██████▋ 56
57 |██████▊ 57
58 |██████▉ 58
59 |███████ 59
60 |███████▏ 60
61 |███████▏ 61
62 |███████▎ 62
63 |███████▍ 63
64 |███████▌ 64
65 |███████▋ 65
66 |███████▊ 66
67 |███████▉ 67
68 |████████ 68
69 |████████▏ 69
70 |████████▎ 70
71 |████████▍ 71
72 |████████▌ 72
73 |████████▋ 73
74 |████████▊ 74
75 |████████▉ 75
76 |█████████ 76
77 |█████████▏ 77
78 |█████████▎ 78
79 |█████████▍ 79
80 |█████████▌ 80
81 |█████████▌ 81
82 |█████████▋ 82
83 |█████████▊ 83
84 |█████████▉ 84
85 |██████████ 85
86 |██████████▏ 86
87 |██████████▎ 87
88 |██████████▍ 88
89 |██████████▌ 89
90 |██████████▋ 90
91 |██████████▊ 91
92 |██████████▉ 92
93 |███████████ 93
94 |███████████▏ 94
95 |███████████▎ 95
96 |███████████▍ 96
97 |███████████▌ 97
98 |███████████▋ 98
99 |███████████▊ 99
100 |███████████▉ 100
101 |███████████▉ 101
102 |████████████ 102
103 |████████████▏ 103
104 |████████████▎ 104
105 |████████████▍ 105
106 |████████████▌ 106
107 |████████████▋ 107
108 |████████████▊ 108
109 |████████████▉ 109
110 |█████████████ 110
111 |█████████████▏ 111
112 |█████████████▎ 112
113 |█████████████▍ 113
114 |█████████████▌ 114
115 |█████████████▋ 115
116 |█████████████▊ 116
117 |█████████████▉ 117
118 |██████████████ 118
119 |██████████████▏ 119
120 |██████████████▎ 120
121 |██████████████▎ 121
122 |██████████████▍ 122
123 |██████████████▌ 123
124 |██████████████▋ 124
125 |██████████████▊ 125
126 |██████████████▉ 126
127 |███████████████ 127
128 |███████████████▏ 128
129 |███████████████▎ 129
130 |███████████████▍ 130
131 |███████████████▌ 131
132 |███████████████▋ 132
133 |███████████████▊ 133
134 |███████████████▉ 134
135 |████████████████ 135
136 |████████████████▏ 136
137 |████████████████▎ 137
138 |████████████████▍ 138
139 |████████████████▌ 139
140 |████████████████▋ 140
141 |████████████████▋ 141
142 |████████████████▊ 142
143 |████████████████▉ 143
144 |█████████████████ 144
145 |█████████████████▏ 145
146 |█████████████████▎ 146
147 |█████████████████▍ 147
148 |█████████████████▌ 148
149 |█████████████████▋ 149
150 |█████████████████▊ 150
151 |█████████████████▉ 151
152 |██████████████████ 152
153 |██████████████████▏ 153
154 |██████████████████▎ 154
155 |██████████████████▍ 155
156 |██████████████████▌ 156
157 |██████████████████▋ 157
158 |██████████████████▊ 158
159 |██████████████████▉ 159
160 |███████████████████ 160
161 |███████████████████ 161
162 |███████████████████▏ 162
163 |███████████████████▎ 163
164 |███████████████████▍ 164
165 |███████████████████▌ 165
166 |███████████████████▋ 166
167 |███████████████████▊ 167
168 |███████████████████▉ 168
169 |████████████████████ 169
170 |████████████████████▏ 170
171 |████████████████████▎ 171
172 |████████████████████▍ 172
173 |████████████████████▌ 173
174 |████████████████████▋ 174
175 |████████████████████▊ 175
176 |████████████████████▉ 176
177 |█████████████████████ 177
178 |█████████████████████▏ 178
179 |█████████████████████▎ 179
180 |█████████████████████▍ 180
181 |█████████████████████▍ 181
182 |█████████████████████▌ 182
183 |█████████████████████▋ 183
184 |█████████████████████▊ 184
185 |█████████████████████▉ 185
186 |██████████████████████ 186
187 |██████████████████████▏ 187
188 |██████████████████████▎ 188
189 |██████████████████████▍ 189
190 |██████████████████████▌ 190
191 |██████████████████████▋ 191
192 |██████████████████████▊ 192
193 |██████████████████████▉ 193
194 |███████████████████████ 194
195 |███████████████████████▏ 195
196 |███████████████████████▎ 196
197 |███████████████████████▍ 197
198 |███████████████████████▌ 198
199 |███████████████████████▋ 199
200 |███████████████████████▊ 200
201 |███████████████████████▊ 201
202 |███████████████████████▉ 202
203 |████████████████████████ 203
204 |████████████████████████▏ 204
205 |████████████████████████▎ 205
206 |████████████████████████▍ 206
207 |████████████████████████▌ 207
208 |████████████████████████▋ 208
209 |████████████████████████▊ 209
210 |████████████████████████▉ 210
211 |█████████████████████████ 211
212 |█████████████████████████▏ 212
213 |█████████████████████████▎ 213
214 |█████████████████████████▍ 214
215 |█████████████████████████▌ 215
216 |█████████████████████████▋ 216
217 |█████████████████████████▊ 217
218 |█████████████████████████▉ 218
219 |██████████████████████████ 219
220 |██████████████████████████▏ 220
221 |██████████████████████████▏ 221
222 |██████████████████████████▎ 222
223 |██████████████████████████▍ 223
224 |██████████████████████████▌ 224
225 |██████████████████████████▋ 225
226 |██████████████████████████▊ 226
227 |██████████████████████████▉ 227
228 |███████████████████████████ 228
229 |███████████████████████████▏ 229
230 |███████████████████████████▎ 230
231 |███████████████████████████▍ 231
232 |███████████████████████████▌ 232
233 |███████████████████████████▋ 233
234 |███████████████████████████▊ 234
235 |███████████████████████████▉ 235
236 |████████████████████████████ 236
237 |████████████████████████████▏ 237
238 |████████████████████████████▎ 238
239 |████████████████████████████▍ 239
240 |████████████████████████████▌ 240
241 |████████████████████████████▌ 241
242 |████████████████████████████▋ 242
243 |████████████████████████████▊ 243
244 |████████████████████████████▉ 244
245 |█████████████████████████████ 245
246 |█████████████████████████████▏ 246
247 |█████████████████████████████▎ 247
248 |█████████████████████████████▍ 248
249 |█████████████████████████████▌ 249
250 |█████████████████████████████▋ 250
251 |█████████████████████████████▊ 251
252 |█████████████████████████████▉ 252
253 |██████████████████████████████ 253
254 |██████████████████████████████▏ 254
255 |██████████████████████████████▎ 255
256 |██████████████████████████████▍ 256
257 |██████████████████████████████▌ 257
258 |██████████████████████████████▋ 258
259 |██████████████████████████████▊ 259
260 |██████████████████████████████▉ 260
261 |██████████████████████████████▉ 261
262 |███████████████████████████████ 262
263 |███████████████████████████████▏ 263
264 |███████████████████████████████▎ 264
265 |███████████████████████████████▍ 265
266 |███████████████████████████████▌ 266
267 |███████████████████████████████▋ 267
268 |███████████████████████████████▊ 268
269 |███████████████████████████████▉ 269
270 |████████████████████████████████ 270
271 |████████████████████████████████▏ 271
272 |████████████████████████████████▎ 272
273 |████████████████████████████████▍ 273
274 |████████████████████████████████▌ 274
275 |████████████████████████████████▋ 275
276 |████████████████████████████████▊ 276
277 |████████████████████████████████▉ 277
278 |█████████████████████████████████ 278
279 |█████████████████████████████████▏ 279
280 |█████████████████████████████████▎ 280
281 |█████████████████████████████████▎ 281
282 |█████████████████████████████████▍ 282
283 |█████████████████████████████████▌ 283
284 |█████████████████████████████████▋ 284
285 |█████████████████████████████████▊ 285
286 |█████████████████████████████████▉ 286
287 |██████████████████████████████████ 287
288 |██████████████████████████████████▏ 288
289 |██████████████████████████████████▎ 289
290 |██████████████████████████████████▍ 290
291 |██████████████████████████████████▌ 291
292 |██████████████████████████████████▋ 292
293 |██████████████████████████████████▊ 293
294 |██████████████████████████████████▉ 294
295 |███████████████████████████████████ 295
296 |███████████████████████████████████▏ 296
297 |███████████████████████████████████▎ 297
298 |███████████████████████████████████▍ 298
299 |███████████████████████████████████▌ 299
300 |███████████████████████████████████▋ 300
301 |███████████████████████████████████▋ 301
302 |███████████████████████████████████▊ 302
303 |███████████████████████████████████▉ 303
304 |████████████████████████████████████ 304
305 |████████████████████████████████████▏ 305
306 |████████████████████████████████████▎ 306
307 |████████████████████████████████████▍ 307
308 |████████████████████████████████████▌ 308
309 |████████████████████████████████████▋ 309
310 |████████████████████████████████████▊ 310
311 |████████████████████████████████████▉ 311
312 |█████████████████████████████████████ 312
313 |█████████████████████████████████████▏ 313
314 |█████████████████████████████████████▎ 314
315 |█████████████████████████████████████▍ 315
316 |█████████████████████████████████████▌ 316
317 |█████████████████████████████████████▋ 317
318 |█████████████████████████████████████▊ 318
319 |█████████████████████████████████████▉ 319
320 |██████████████████████████████████████ 320
321 |██████████████████████████████████████ 320
322 |█████████████████████████████████████▉ 319
323 |█████████████████████████████████████▊ 318
324 |█████████████████████████████████████▋ 317
325 |█████████████████████████████████████▌ 316
326 |█████████████████████████████████████▍ 315
327 |█████████████████████████████████████▎ 314
328 |█████████████████████████████████████▏ 313
329 |█████████████████████████████████████ 312
330 |████████████████████████████████████▉ 311
331 |████████████████████████████████████▊ 310
332 |████████████████████████████████████▋ 309
333 |████████████████████████████████████▌ 308
334 |████████████████████████████████████▍ 307
335 |████████████████████████████████████▎ 306
336 |████████████████████████████████████▏ 305
337 |████████████████████████████████████ 304
338 |███████████████████████████████████▉ 303
339 |███████████████████████████████████▊ 302
340 |███████████████████████████████████▋ 301
341 |███████████████████████████████████▋ 300
342 |███████████████████████████████████▌ 299
343 |███████████████████████████████████▍ 298
344 |███████████████████████████████████▎ 297
345 |███████████████████████████████████▏ 296
346 |███████████████████████████████████ 295
347 |██████████████████████████████████▉ 294
348 |██████████████████████████████████▊ 293
349 |██████████████████████████████████▋ 292
350 |██████████████████████████████████▌ 291
351 |██████████████████████████████████▍ 290
352 |██████████████████████████████████▎ 289
353 |██████████████████████████████████▏ 288
354 |██████████████████████████████████ 287
355 |█████████████████████████████████▉ 286
356 |█████████████████████████████████▊ 285
357 |█████████████████████████████████▋ 284
358 |█████████████████████████████████▌ 283
359 |█████████████████████████████████▍ 282
360 |█████████████████████████████████▎ 281
361 |█████████████████████████████████▎ 280
362 |█████████████████████████████████▏ 279
363 |█████████████████████████████████ 278
364 |████████████████████████████████▉ 277
365 |████████████████████████████████▊ 276
366 |████████████████████████████████▋ 275
367 |████████████████████████████████▌ 274
368 |████████████████████████████████▍ 273
369 |████████████████████████████████▎ 272
370 |████████████████████████████████▏ 271
371 |████████████████████████████████ 270
372 |███████████████████████████████▉ 269
373 |███████████████████████████████▊ 268
374 |███████████████████████████████▋ 267
375 |███████████████████████████████▌ 266
376 |███████████████████████████████▍ 265
377 |███████████████████████████████▎ 264
378 |███████████████████████████████▏ 263
379 |███████████████████████████████ 262
380 |██████████████████████████████▉ 261
381 |██████████████████████████████▉ 260
382 |██████████████████████████████▊ 259
383 |██████████████████████████████▋ 258
384 |██████████████████████████████▌ 257
385 |██████████████████████████████▍ 256
386 |██████████████████████████████▎ 255
387 |██████████████████████████████▏ 254
388 |██████████████████████████████ 253
389 |█████████████████████████████▉ 252
390 |█████████████████████████████▊ 251
391 |█████████████████████████████▋ 250
392 |█████████████████████████████▌ 249
393 |█████████████████████████████▍ 248
394 |█████████████████████████████▎ 247
395 |█████████████████████████████▏ 246
396 |█████████████████████████████ 245
397 |████████████████████████████▉ 244
398 |████████████████████████████▊ 243
399 |████████████████████████████▋ 242
400 |████████████████████████████▌ 241
401 |████████████████████████████▌ 240
402 |████████████████████████████▍ 239
403 |████████████████████████████▎ 238
404 |████████████████████████████▏ 237
405 |████████████████████████████ 236
406 |███████████████████████████▉ 235
407 |███████████████████████████▊ 234
408 |███████████████████████████▋ 233
409 |███████████████████████████▌ 232
410 |███████████████████████████▍ 231
411 |███████████████████████████▎ 230
412 |███████████████████████████▏ 229
413 |███████████████████████████ 228
414 |██████████████████████████▉ 227
415 |██████████████████████████▊ 226
416 |██████████████████████████▋ 225
417 |██████████████████████████▌ 224
418 |██████████████████████████▍ 223
419 |██████████████████████████▎ 222
420 |██████████████████████████▏ 221
421 |██████████████████████████▏ 220
422 |██████████████████████████ 219
423 |█████████████████████████▉ 218
424 |█████████████████████████▊ 217
425 |█████████████████████████▋ 216
426 |█████████████████████████▌ 215
427 |█████████████████████████▍ 214
428 |█████████████████████████▎ 213
429 |█████████████████████████▏ 212
430 |█████████████████████████ 211
431 |████████████████████████▉ 210
432 |████████████████████████▊ 209
433 |████████████████████████▋ 208
434 |████████████████████████▌ 207
435 |████████████████████████▍ 206
436 |████████████████████████▎ 205
437 |████████████████████████▏ 204
438 |████████████████████████ 203
439 |███████████████████████▉ 202
440 |███████████████████████▊ 201
441 |███████████████████████▊ 200
442 |███████████████████████▋ 199
443 |███████████████████████▌ 198
444 |███████████████████████▍ 197
445 |███████████████████████▎ 196
446 |███████████████████████▏ 195
447 |███████████████████████ 194
448 |██████████████████████▉ 193
449 |██████████████████████▊ 192
450 |██████████████████████▋ 191
451 |██████████████████████▌ 190
452 |██████████████████████▍ 189
453 |██████████████████████▎ 188
454 |██████████████████████▏ 187
455 |██████████████████████ 186
456 |█████████████████████▉ 185
457 |█████████████████████▊ 184
458 |█████████████████████▋ 183
459 |█████████████████████▌ 182
460 |█████████████████████▍ 181
461 |█████████████████████▍ 180
462 |█████████████████████▎ 179
463 |█████████████████████▏ 178
464 |█████████████████████ 177
465 |████████████████████▉ 176
466 |████████████████████▊ 175
467 |████████████████████▋ 174
468 |████████████████████▌ 173
469 |████████████████████▍ 172
470 |████████████████████▎ 171
471 |████████████████████▏ 170
472 |████████████████████ 169
473 |███████████████████▉ 168
474 |███████████████████▊ 167
475 |███████████████████▋ 166
476 |███████████████████▌ 165
477 |███████████████████▍ 164
478 |███████████████████▎ 163
479 |███████████████████▏ 162
480 |███████████████████ 161
481 |███████████████████ 160
482 |██████████████████▉ 159
483 |██████████████████▊ 158
484 |██████████████████▋ 157
485 |██████████████████▌ 156
486 |██████████████████▍ 155
487 |██████████████████▎ 154
488 |██████████████████▏ 153
489 |██████████████████ 152
490 |█████████████████▉ 151
491 |█████████████████▊ 150
492 |█████████████████▋ 149
493 |█████████████████▌ 148
494 |█████████████████▍ 147
495 |█████████████████▎ 146
496 |█████████████████▏ 145
497 |█████████████████ 144
498 |████████████████▉ 143
499 |████████████████▊ 142
500 |████████████████▋ 141
501 |████████████████▋ 140
502 |████████████████▌ 139
503 |████████████████▍ 138
504 |████████████████▎ 137
505 |████████████████▏ 136
506 |████████████████ 135
507 |███████████████▉ 134
508 |███████████████▊ 133
509 |███████████████▋ 132
510 |███████████████▌ 131
511 |███████████████▍ 130
512 |███████████████▎ 129
513 |███████████████▏ 128
514 |███████████████ 127
515 |██████████████▉ 126
516 |██████████████▊ 125
517 |██████████████▋ 124
518 |██████████████▌ 123
519 |██████████████▍ 122
520 |██████████████▎ 121
521 |██████████████▎ 120
522 |██████████████▏ 119
523 |██████████████ 118
524 |█████████████▉ 117
525 |█████████████▊ 116
526 |█████████████▋ 115
527 |█████████████▌ 114
528 |█████████████▍ 113
529 |█████████████▎ 112
530 |█████████████▏ 111
531 |█████████████ 110
532 |████████████▉ 109
533 |████████████▊ 108
534 |████████████▋ 107
535 |████████████▌ 106
536 |████████████▍ 105
537 |████████████▎ 104
538 |████████████▏ 103
539 |████████████ 102
540 |███████████▉ 101
541 |███████████▉ 100
542 |███████████▊ 99
543 |███████████▋ 98
544 |███████████▌ 97
545 |███████████▍ 96
546 |███████████▎ 95
547 |███████████▏ 94
548 |███████████ 93
549 |██████████▉ 92
550 |██████████▊ 91
551 |██████████▋ 90
552 |██████████▌ 89
553 |██████████▍ 88
554 |██████████▎ 87
555 |██████████▏ 86
556 |██████████ 85
557 |█████████▉ 84
558 |█████████▊ 83
559 |█████████▋ 82
560 |█████████▌ 81
561 |█████████▌ 80
562 |█████████▍ 79
563 |█████████▎ 78
564 |█████████▏ 77
565 |█████████ 76
566 |████████▉ 75
567 |████████▊ 74
568 |████████▋ 73
569 |████████▌ 72
570 |████████▍ 71
571 |████████▎ 70
572 |████████▏ 69
573 |████████ 68
574 |███████▉ 67
575 |███████▊ 66
576 |███████▋ 65
577 |███████▌ 64
578 |███████▍ 63
579 |███████▎ 62
580 |███████▏ 61
581 |███████▏ 60
582 |███████ 59
583 |██████▉ 58
584 |██████▊ 57
585 |██████▋ 56
586 |██████▌ 55
587 |██████▍ 54
588 |██████▎ 53
589 |██████▏ 52
590 |██████ 51
591 |█████▉ 50
592 |█████▊ 49
593 |█████▋ 48
594 |█████▌ 47
595 |█████▍ 46
596 |█████▎ 45
597 |█████▏ 44
598 |█████ 43
599 |████▉ 42
600 |████▊ 41
601 |████▊ 40
602 |████▋ 39
603 |████▌ 38
604 |████▍ 37
605 |████▎ 36
606 |████▏ 35
607 |████ 34
608 |███▉ 33
609 |███▊ 32
610 |███▋ 31
611 |███▌ 30
612 |███▍ 29
613 |███▎ 28
614 |███▏ 27
615 |███ 26
616 |██▉ 25
617 |██▊ 24
618 |██▋ 23
619 |██▌ 22
620 |██▍ 21
621 |██▍ 20
622 |██▎ 19
623 |██▏ 18
624 |██ 17
625 |█▉ 16
626 |█▊ 15
627 |█▋ 14
628 |█▌ 13
629 |█▍ 12
630 |█▎ 11
631 |█▏ 10
632 |█ 9
633 |▉ 8
634 |▊ 7
635 |▋ 6
636 |▌ 5
637 |▍ 4
638 |▎ 3
639 |▏ 2
>= 640 | 1

View File

@ -0,0 +1,46 @@
/*
* This file and its contents are supplied under the terms of the
* Common Development and Distribution License ("CDDL"), version 1.0.
* You may only use this file in accordance with the terms of version
* 1.0 of the CDDL.
*
* A full copy of the text of the CDDL should have accompanied this
* source. A copy of the CDDL is also available via the Internet at
* http://www.illumos.org/license/CDDL.
*/
/*
* Copyright (c) 2013 Joyent, Inc. All rights reserved.
*/
#pragma D option agghist
#pragma D option quiet
BEGIN
{
@["demerit"] = sum(-10);
@["wtf"] = sum(10);
@["bot"] = sum(20);
@bagnoogle["SOAP/XML"] = sum(1);
@bagnoogle["XACML store"] = sum(5);
@bagnoogle["SAML token"] = sum(6);
@stalloogle["breakfast"] = sum(-5);
@stalloogle["non-diet pepsi"] = sum(-20);
@stalloogle["parrot"] = sum(-100);
printa(@);
printa(@bagnoogle);
printa(@stalloogle);
printf("\nzoomed:");
setopt("aggzoom");
printa(@);
printa(@bagnoogle);
printa(@stalloogle);
exit(0);
}

View File

@ -0,0 +1,38 @@
key ------------- Distribution ------------- count
demerit @@@@@| -10
wtf |@@@@@ 10
bot |@@@@@@@@@@ 20
key ------------- Distribution ------------- count
SOAP/XML |@@@ 1
XACML store |@@@@@@@@@@@@@@@@@ 5
SAML token |@@@@@@@@@@@@@@@@@@@@ 6
key ------------- Distribution ------------- count
parrot @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -100
non-diet pepsi @@@@@@| -20
breakfast @@| -5
zoomed:
key ------------- Distribution ------------- count
demerit @@@@@@@@@@| -10
wtf |@@@@@@@@@@ 10
bot |@@@@@@@@@@@@@@@@@@@ 20
key ------------- Distribution ------------- count
SOAP/XML |@@@@@@@ 1
XACML store |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 5
SAML token |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 6
key ------------- Distribution ------------- count
parrot @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -100
non-diet pepsi @@@@@@@@| -20
breakfast @@| -5

View File

@ -0,0 +1,53 @@
/*
* This file and its contents are supplied under the terms of the
* Common Development and Distribution License ("CDDL"), version 1.0.
* You may only use this file in accordance with the terms of version
* 1.0 of the CDDL.
*
* A full copy of the text of the CDDL should have accompanied this
* source. A copy of the CDDL is also available via the Internet at
* http://www.illumos.org/license/CDDL.
*/
/*
* Copyright (c) 2013 Joyent, Inc. All rights reserved.
*/
#pragma D option aggpack
#pragma D option encoding=ascii
#pragma D option quiet
BEGIN
{
@x = quantize(1 << 32);
@y[1] = quantize(1);
@z["mumble"] = quantize(1);
@xx["foo", (char)1, (short)2, (long)3] = quantize(1);
@neg = lquantize(-10, -10, 20, 1, -1);
@neg = lquantize(-5, -10, 20, 1, 1);
@neg = lquantize(0, -10, 20, 1, 1);
i = 0;
}
tick-1ms
{
@a[i] = quantize(0, i);
@a[i] = quantize(1, 100 - i);
i++;
}
tick-1ms
/i > 100/
{
exit(0);
}
END
{
setopt("aggzoom", "true");
printa(@neg);
setopt("aggzoom", "false");
printa(@neg);
}

View File

@ -0,0 +1,124 @@
min .--------------------------------. max | count
< -10 : V X X : >= 20 | 1
min .--------------------------------. max | count
< -10 : v x x : >= 20 | 1
min .---. max | count
2147483648 : X : 8589934592 | 1
key min .---. max | count
1 0 : X : 2 | 1
key min .---. max | count
mumble 0 : X : 2 | 1
key min .---. max | count
foo 1 2 3 0 : X : 2 | 1
key min .---. max | count
100 0 :X : 2 | 100
99 0 :X_ : 2 | 100
98 0 :X_ : 2 | 100
97 0 :X_ : 2 | 100
96 0 :X_ : 2 | 100
95 0 :X_ : 2 | 100
94 0 :X_ : 2 | 100
93 0 :X_ : 2 | 100
92 0 :X_ : 2 | 100
91 0 :X_ : 2 | 100
90 0 :X_ : 2 | 100
89 0 :X_ : 2 | 100
88 0 :X_ : 2 | 100
87 0 :X_ : 2 | 100
86 0 :X_ : 2 | 100
85 0 :X_ : 2 | 100
84 0 :X_ : 2 | 100
83 0 :X_ : 2 | 100
82 0 :X_ : 2 | 100
81 0 :X_ : 2 | 100
80 0 :X_ : 2 | 100
79 0 :X_ : 2 | 100
78 0 :xx : 2 | 100
77 0 :xx : 2 | 100
76 0 :xx : 2 | 100
75 0 :xx : 2 | 100
74 0 :xx : 2 | 100
73 0 :xx : 2 | 100
72 0 :xx : 2 | 100
71 0 :xx : 2 | 100
70 0 :xx : 2 | 100
69 0 :xx : 2 | 100
68 0 :xx : 2 | 100
67 0 :xx : 2 | 100
66 0 :xx : 2 | 100
65 0 :xx : 2 | 100
64 0 :xx : 2 | 100
63 0 :xx : 2 | 100
62 0 :xx : 2 | 100
61 0 :xx : 2 | 100
60 0 :xx : 2 | 100
59 0 :xx : 2 | 100
58 0 :xx : 2 | 100
57 0 :xx : 2 | 100
56 0 :xx : 2 | 100
55 0 :xx : 2 | 100
54 0 :xx : 2 | 100
53 0 :xx : 2 | 100
52 0 :xx : 2 | 100
51 0 :xx : 2 | 100
50 0 :xx : 2 | 100
49 0 :xx : 2 | 100
48 0 :xx : 2 | 100
47 0 :xx : 2 | 100
46 0 :xx : 2 | 100
45 0 :xx : 2 | 100
44 0 :xx : 2 | 100
43 0 :xx : 2 | 100
42 0 :xx : 2 | 100
41 0 :xx : 2 | 100
40 0 :xx : 2 | 100
39 0 :xx : 2 | 100
38 0 :xx : 2 | 100
37 0 :xx : 2 | 100
36 0 :xx : 2 | 100
35 0 :xx : 2 | 100
34 0 :xx : 2 | 100
33 0 :xx : 2 | 100
32 0 :xx : 2 | 100
31 0 :xx : 2 | 100
30 0 :xx : 2 | 100
29 0 :xx : 2 | 100
28 0 :xx : 2 | 100
27 0 :xx : 2 | 100
26 0 :xx : 2 | 100
25 0 :xx : 2 | 100
24 0 :xx : 2 | 100
23 0 :xx : 2 | 100
22 0 :xx : 2 | 100
21 0 :_X : 2 | 100
20 0 :_X : 2 | 100
19 0 :_X : 2 | 100
18 0 :_X : 2 | 100
17 0 :_X : 2 | 100
16 0 :_X : 2 | 100
15 0 :_X : 2 | 100
14 0 :_X : 2 | 100
13 0 :_X : 2 | 100
12 0 :_X : 2 | 100
11 0 :_X : 2 | 100
10 0 :_X : 2 | 100
9 0 :_X : 2 | 100
8 0 :_X : 2 | 100
7 0 :_X : 2 | 100
6 0 :_X : 2 | 100
5 0 :_X : 2 | 100
4 0 :_X : 2 | 100
3 0 :_X : 2 | 100
2 0 :_X : 2 | 100
1 0 :_X : 2 | 100
0 0 : X : 2 | 100

View File

@ -0,0 +1,75 @@
#
# This file and its contents are supplied under the terms of the
# Common Development and Distribution License ("CDDL"), version 1.0.
# You may only use this file in accordance with the terms of version
# 1.0 of the CDDL.
#
# A full copy of the text of the CDDL should have accompanied this
# source. A copy of the CDDL is also available via the Internet at
# http://www.illumos.org/license/CDDL.
#
#
# Copyright (c) 2013 Joyent, Inc. All rights reserved.
#
let width=8
function outputchar
{
banner $3 | /bin/nawk -v line=$1 -v pos=$2 -v width=$width '{ \
for (i = 1; i <= length($0); i++) { \
if (substr($0, i, 1) == " ") \
continue; \
printf("\t@letter%d[%d] = lquantize(%d, 0, 40, 1);\n", \
line, NR, i + (pos * width));
} \
}'
}
function outputstr
{
let pos=0;
let line=0
printf "#pragma D option aggpack\n#pragma D option aggsortkey\n"
printf "BEGIN\n{\n"
for c in `echo "$1" | /bin/nawk '{ \
for (i = 1; i <= length($0); i++) { \
c = substr($0, i, 1); \
printf("%s\n", c == " " ? "space" : \
c == "\n" ? "newline" : c); \
} \
}'`; do
if [[ "$c" == "space" ]]; then
let line=line+1
let pos=0
continue
fi
outputchar $line $pos $c
let pos=pos+1
done
let i=0
while [[ $i -le $line ]]; do
printf "\tprinta(@letter%d);\n" $i
let i=i+1
done
printf "\texit(0);\n}\n"
}
dtrace -qs /dev/stdin -x encoding=utf8 <<EOF
`outputstr "why must i do this"`
EOF
dtrace -qs /dev/stdin -x encoding=ascii -x aggzoom <<EOF
`outputstr "i am not well"`
EOF
dtrace -qs /dev/stdin -x encoding=utf8 -x aggzoom <<EOF
`outputstr "send help"`
EOF

View File

@ -0,0 +1,102 @@
key min .------------------------------------------. max | count
2 < 0 : ▂ ▂ ▂ ▂ ▂ ▂ : >= 40 | 6
3 < 0 : ▂ ▂ ▂ ▂ ▂ ▂ : >= 40 | 6
4 < 0 : ▂ ▂ ▂▂▂▂▂▂ ▂ : >= 40 | 9
5 < 0 : ▂ ▂▂ ▂ ▂ ▂ ▂ : >= 40 | 7
6 < 0 : ▂▂ ▂▂ ▂ ▂ ▂ : >= 40 | 7
7 < 0 : ▂ ▂ ▂ ▂ ▂ : >= 40 | 5
key min .------------------------------------------. max | count
2 < 0 : ▂ ▂ ▂ ▂ ▂▂▂▂ ▂▂▂▂▂ : >= 40 | 13
3 < 0 : ▂▂ ▂▂ ▂ ▂ ▂ ▂ : >= 40 | 8
4 < 0 : ▂ ▂▂ ▂ ▂ ▂ ▂▂▂▂ ▂ : >= 40 | 11
5 < 0 : ▂ ▂ ▂ ▂ ▂ ▂ : >= 40 | 6
6 < 0 : ▂ ▂ ▂ ▂ ▂ ▂ ▂ : >= 40 | 7
7 < 0 : ▂ ▂ ▂▂▂▂ ▂▂▂▂ ▂ : >= 40 | 11
key min .------------------------------------------. max | count
2 < 0 : █ : >= 40 | 1
3 < 0 : █ : >= 40 | 1
4 < 0 : █ : >= 40 | 1
5 < 0 : █ : >= 40 | 1
6 < 0 : █ : >= 40 | 1
7 < 0 : █ : >= 40 | 1
key min .------------------------------------------. max | count
2 < 0 : ▂▂▂▂▂ ▂▂▂▂ : >= 40 | 9
3 < 0 : ▃ ▃ ▃ ▃ : >= 40 | 4
4 < 0 : ▃ ▃ ▃ ▃ : >= 40 | 4
5 < 0 : ▃ ▃ ▃ ▃ : >= 40 | 4
6 < 0 : ▃ ▃ ▃ ▃ : >= 40 | 4
7 < 0 : ▂▂▂▂▂ ▂▂▂▂ : >= 40 | 9
key min .------------------------------------------. max | count
2 < 0 : ▂▂▂▂▂ ▂ ▂ ▂ ▂▂▂▂ : >= 40 | 12
3 < 0 : ▂ ▂ ▂ ▂ ▂ : >= 40 | 5
4 < 0 : ▂ ▂▂▂▂▂▂ ▂ ▂▂▂▂ : >= 40 | 12
5 < 0 : ▂ ▂ ▂ ▂ ▂ : >= 40 | 5
6 < 0 : ▂ ▂ ▂ ▂ ▂ ▂ : >= 40 | 6
7 < 0 : ▂ ▂ ▂ ▂ ▂▂▂▂ : >= 40 | 8
key min .------------------------------------------. max | count
2 < 0 : X : >= 40 | 1
3 < 0 : X : >= 40 | 1
4 < 0 : X : >= 40 | 1
5 < 0 : X : >= 40 | 1
6 < 0 : X : >= 40 | 1
7 < 0 : X : >= 40 | 1
key min .------------------------------------------. max | count
2 < 0 : XX X X : >= 40 | 4
3 < 0 : X X XX XX : >= 40 | 6
4 < 0 : X X X XX X : >= 40 | 6
5 < 0 : XXXXXX X X : >= 40 | 8
6 < 0 : X X X X : >= 40 | 4
7 < 0 : X X X X : >= 40 | 4
key min .------------------------------------------. max | count
2 < 0 : X X XXXX XXXXX : >= 40 | 11
3 < 0 : XX X X X X : >= 40 | 6
4 < 0 : X X X X X X : >= 40 | 6
5 < 0 : X X X X X X : >= 40 | 6
6 < 0 : X XX X X X : >= 40 | 6
7 < 0 : X X XXXX X : >= 40 | 7
key min .------------------------------------------. max | count
2 < 0 : X X XXXXXX X X : >= 40 | 10
3 < 0 : X X X X X : >= 40 | 5
4 < 0 : X X XXXXX X X : >= 40 | 9
5 < 0 : X XX X X X X : >= 40 | 7
6 < 0 : XX XX X X X : >= 40 | 7
7 < 0 : X X XXXXXX XXXXXX XXXXXX : >= 40 | 20
key min .------------------------------------------. max | count
2 < 0 : ████ ██████ █ █ █████ : >= 40 | 17
3 < 0 : █ █ ██ █ █ █ : >= 40 | 7
4 < 0 : ████ █████ █ █ █ █ █ : >= 40 | 14
5 < 0 : █ █ █ █ █ █ █ : >= 40 | 7
6 < 0 : █ █ █ █ ██ █ █ : >= 40 | 8
7 < 0 : ████ ██████ █ █ █████ : >= 40 | 17
key min .------------------------------------------. max | count
2 < 0 : █ █ ██████ █ █████ : >= 40 | 14
3 < 0 : █ █ █ █ █ █ : >= 40 | 6
4 < 0 : ██████ █████ █ █ █ : >= 40 | 14
5 < 0 : █ █ █ █ █████ : >= 40 | 9
6 < 0 : █ █ █ █ █ : >= 40 | 5
7 < 0 : █ █ ██████ ██████ █ : >= 40 | 15

View File

@ -0,0 +1,43 @@
/*
* This file and its contents are supplied under the terms of the
* Common Development and Distribution License ("CDDL"), version 1.0.
* You may only use this file in accordance with the terms of version
* 1.0 of the CDDL.
*
* A full copy of the text of the CDDL should have accompanied this
* source. A copy of the CDDL is also available via the Internet at
* http://www.illumos.org/license/CDDL.
*/
/*
* Copyright (c) 2013 Joyent, Inc. All rights reserved.
*/
#pragma D option encoding=ascii
#pragma D option quiet
tick-1ms
/i++ < 30/
{
@[1] = lquantize(i, 0, 40, 1, 1000);
@[2] = lquantize(i, 0, 40, 1, 1000);
@[3] = lquantize(i, 0, 40, 1, 1000);
}
tick-1ms
/i == 40/
{
@[1] = lquantize(0, 0, 40, 1, 1);
@[1] = lquantize(i, 0, 40, 1, 2000);
@[2] = lquantize(0, 0, 40, 1, 1);
@[2] = lquantize(i, 0, 40, 1, 2000);
@[3] = lquantize(0, 0, 40, 1, 1);
@[3] = lquantize(i, 0, 40, 1, 2000);
printa(@);
setopt("aggpack");
printa(@);
setopt("aggzoom");
printa(@);
exit(0);
}

View File

@ -0,0 +1,149 @@
1
value ------------- Distribution ------------- count
< 0 | 0
0 | 1
1 |@ 1000
2 |@ 1000
3 |@ 1000
4 |@ 1000
5 |@ 1000
6 |@ 1000
7 |@ 1000
8 |@ 1000
9 |@ 1000
10 |@ 1000
11 |@ 1000
12 |@ 1000
13 |@ 1000
14 |@ 1000
15 |@ 1000
16 |@ 1000
17 |@ 1000
18 |@ 1000
19 |@ 1000
20 |@ 1000
21 |@ 1000
22 |@ 1000
23 |@ 1000
24 |@ 1000
25 |@ 1000
26 |@ 1000
27 |@ 1000
28 |@ 1000
29 |@ 1000
30 |@ 1000
31 | 0
32 | 0
33 | 0
34 | 0
35 | 0
36 | 0
37 | 0
38 | 0
39 | 0
>= 40 |@@ 2000
2
value ------------- Distribution ------------- count
< 0 | 0
0 | 1
1 |@ 1000
2 |@ 1000
3 |@ 1000
4 |@ 1000
5 |@ 1000
6 |@ 1000
7 |@ 1000
8 |@ 1000
9 |@ 1000
10 |@ 1000
11 |@ 1000
12 |@ 1000
13 |@ 1000
14 |@ 1000
15 |@ 1000
16 |@ 1000
17 |@ 1000
18 |@ 1000
19 |@ 1000
20 |@ 1000
21 |@ 1000
22 |@ 1000
23 |@ 1000
24 |@ 1000
25 |@ 1000
26 |@ 1000
27 |@ 1000
28 |@ 1000
29 |@ 1000
30 |@ 1000
31 | 0
32 | 0
33 | 0
34 | 0
35 | 0
36 | 0
37 | 0
38 | 0
39 | 0
>= 40 |@@ 2000
3
value ------------- Distribution ------------- count
< 0 | 0
0 | 1
1 |@ 1000
2 |@ 1000
3 |@ 1000
4 |@ 1000
5 |@ 1000
6 |@ 1000
7 |@ 1000
8 |@ 1000
9 |@ 1000
10 |@ 1000
11 |@ 1000
12 |@ 1000
13 |@ 1000
14 |@ 1000
15 |@ 1000
16 |@ 1000
17 |@ 1000
18 |@ 1000
19 |@ 1000
20 |@ 1000
21 |@ 1000
22 |@ 1000
23 |@ 1000
24 |@ 1000
25 |@ 1000
26 |@ 1000
27 |@ 1000
28 |@ 1000
29 |@ 1000
30 |@ 1000
31 | 0
32 | 0
33 | 0
34 | 0
35 | 0
36 | 0
37 | 0
38 | 0
39 | 0
>= 40 |@@ 2000
key min .------------------------------------------. max | count
1 < 0 : _______________________________ _: >= 40 | 32001
2 < 0 : _______________________________ _: >= 40 | 32001
3 < 0 : _______________________________ _: >= 40 | 32001
key min .------------------------------------------. max | count
1 < 0 : _xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx X: >= 40 | 32001
2 < 0 : _xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx X: >= 40 | 32001
3 < 0 : _xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx X: >= 40 | 32001

View File

@ -0,0 +1,35 @@
/*
* This file and its contents are supplied under the terms of the
* Common Development and Distribution License ("CDDL"), version 1.0.
* You may only use this file in accordance with the terms of version
* 1.0 of the CDDL.
*
* A full copy of the text of the CDDL should have accompanied this
* source. A copy of the CDDL is also available via the Internet at
* http://www.illumos.org/license/CDDL.
*/
/*
* Copyright (c) 2013 Joyent, Inc. All rights reserved.
*/
#pragma D option encoding=ascii
#pragma D option quiet
tick-1ms
/i++ < 90/
{
@ = lquantize(i, 0, 100, 1, 1000);
}
tick-1ms
/i == 100/
{
@ = lquantize(i++, 0, 100, 1, 2000);
@ = lquantize(i++, 0, 100, 1, 3000);
printa(@);
setopt("aggzoom");
printa(@);
exit(0);
}

View File

@ -0,0 +1,211 @@
value ------------- Distribution ------------- count
0 | 0
1 | 1000
2 | 1000
3 | 1000
4 | 1000
5 | 1000
6 | 1000
7 | 1000
8 | 1000
9 | 1000
10 | 1000
11 | 1000
12 | 1000
13 | 1000
14 | 1000
15 | 1000
16 | 1000
17 | 1000
18 | 1000
19 | 1000
20 | 1000
21 | 1000
22 | 1000
23 | 1000
24 | 1000
25 | 1000
26 | 1000
27 | 1000
28 | 1000
29 | 1000
30 | 1000
31 | 1000
32 | 1000
33 | 1000
34 | 1000
35 | 1000
36 | 1000
37 | 1000
38 | 1000
39 | 1000
40 | 1000
41 | 1000
42 | 1000
43 | 1000
44 | 1000
45 | 1000
46 | 1000
47 | 1000
48 | 1000
49 | 1000
50 | 1000
51 | 1000
52 | 1000
53 | 1000
54 | 1000
55 | 1000
56 | 1000
57 | 1000
58 | 1000
59 | 1000
60 | 1000
61 | 1000
62 | 1000
63 | 1000
64 | 1000
65 | 1000
66 | 1000
67 | 1000
68 | 1000
69 | 1000
70 | 1000
71 | 1000
72 | 1000
73 | 1000
74 | 1000
75 | 1000
76 | 1000
77 | 1000
78 | 1000
79 | 1000
80 | 1000
81 | 1000
82 | 1000
83 | 1000
84 | 1000
85 | 1000
86 | 1000
87 | 1000
88 | 1000
89 | 1000
90 | 1000
91 | 0
92 | 0
93 | 0
94 | 0
95 | 0
96 | 0
97 | 0
98 | 0
99 | 0
>= 100 |@@ 5000
value ------------- Distribution ------------- count
0 | 0
1 |@@@@@@@@ 1000
2 |@@@@@@@@ 1000
3 |@@@@@@@@ 1000
4 |@@@@@@@@ 1000
5 |@@@@@@@@ 1000
6 |@@@@@@@@ 1000
7 |@@@@@@@@ 1000
8 |@@@@@@@@ 1000
9 |@@@@@@@@ 1000
10 |@@@@@@@@ 1000
11 |@@@@@@@@ 1000
12 |@@@@@@@@ 1000
13 |@@@@@@@@ 1000
14 |@@@@@@@@ 1000
15 |@@@@@@@@ 1000
16 |@@@@@@@@ 1000
17 |@@@@@@@@ 1000
18 |@@@@@@@@ 1000
19 |@@@@@@@@ 1000
20 |@@@@@@@@ 1000
21 |@@@@@@@@ 1000
22 |@@@@@@@@ 1000
23 |@@@@@@@@ 1000
24 |@@@@@@@@ 1000
25 |@@@@@@@@ 1000
26 |@@@@@@@@ 1000
27 |@@@@@@@@ 1000
28 |@@@@@@@@ 1000
29 |@@@@@@@@ 1000
30 |@@@@@@@@ 1000
31 |@@@@@@@@ 1000
32 |@@@@@@@@ 1000
33 |@@@@@@@@ 1000
34 |@@@@@@@@ 1000
35 |@@@@@@@@ 1000
36 |@@@@@@@@ 1000
37 |@@@@@@@@ 1000
38 |@@@@@@@@ 1000
39 |@@@@@@@@ 1000
40 |@@@@@@@@ 1000
41 |@@@@@@@@ 1000
42 |@@@@@@@@ 1000
43 |@@@@@@@@ 1000
44 |@@@@@@@@ 1000
45 |@@@@@@@@ 1000
46 |@@@@@@@@ 1000
47 |@@@@@@@@ 1000
48 |@@@@@@@@ 1000
49 |@@@@@@@@ 1000
50 |@@@@@@@@ 1000
51 |@@@@@@@@ 1000
52 |@@@@@@@@ 1000
53 |@@@@@@@@ 1000
54 |@@@@@@@@ 1000
55 |@@@@@@@@ 1000
56 |@@@@@@@@ 1000
57 |@@@@@@@@ 1000
58 |@@@@@@@@ 1000
59 |@@@@@@@@ 1000
60 |@@@@@@@@ 1000
61 |@@@@@@@@ 1000
62 |@@@@@@@@ 1000
63 |@@@@@@@@ 1000
64 |@@@@@@@@ 1000
65 |@@@@@@@@ 1000
66 |@@@@@@@@ 1000
67 |@@@@@@@@ 1000
68 |@@@@@@@@ 1000
69 |@@@@@@@@ 1000
70 |@@@@@@@@ 1000
71 |@@@@@@@@ 1000
72 |@@@@@@@@ 1000
73 |@@@@@@@@ 1000
74 |@@@@@@@@ 1000
75 |@@@@@@@@ 1000
76 |@@@@@@@@ 1000
77 |@@@@@@@@ 1000
78 |@@@@@@@@ 1000
79 |@@@@@@@@ 1000
80 |@@@@@@@@ 1000
81 |@@@@@@@@ 1000
82 |@@@@@@@@ 1000
83 |@@@@@@@@ 1000
84 |@@@@@@@@ 1000
85 |@@@@@@@@ 1000
86 |@@@@@@@@ 1000
87 |@@@@@@@@ 1000
88 |@@@@@@@@ 1000
89 |@@@@@@@@ 1000
90 |@@@@@@@@ 1000
91 | 0
92 | 0
93 | 0
94 | 0
95 | 0
96 | 0
97 | 0
98 | 0
99 | 0
>= 100 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 5000

View File

@ -22,6 +22,7 @@
/*
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
* Copyright (c) 2012, Joyent, Inc. All rights reserved.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
@ -97,6 +98,9 @@ INTFUNC(ntohll(0x1234567890abcdefL))
STRFUNC(inet_ntoa((ipaddr_t *)alloca(sizeof (ipaddr_t))))
STRFUNC(inet_ntoa6((in6_addr_t *)alloca(sizeof (in6_addr_t))))
STRFUNC(inet_ntop(AF_INET, (void *)alloca(sizeof (ipaddr_t))))
INTFUNC(getf(0))
INTFUNC(strtoll("0x12EE5D5", 16))
STRFUNC(json("{\"systemtap\": false}", "systemtap"))
BEGIN
/subr == DIF_SUBR_MAX + 1/

View File

@ -0,0 +1,179 @@
/*
* This file and its contents are supplied under the terms of the
* Common Development and Distribution License ("CDDL"), version 1.0.
* You may only use this file in accordance with the terms of version
* 1.0 of the CDDL.
*
* A full copy of the text of the CDDL should have accompanied this
* source. A copy of the CDDL is also available via the Internet at
* http://www.illumos.org/license/CDDL.
*/
/*
* Copyright 2012, Joyent, Inc. All rights reserved.
*/
/*
* General functional tests of JSON parser for json().
*/
#pragma D option quiet
#pragma D option strsize=1k
#define TST(name) \
printf("\ntst |%s|\n", name)
#define IN2(vala, valb) \
in = strjoin(vala, valb); \
printf("in |%s|\n", in)
#define IN(val) \
in = val; \
printf("in |%s|\n", in)
#define SEL(ss) \
out = json(in, ss); \
printf("sel |%s|\nout |%s|\n", ss, \
out != NULL ? out : "<NULL>")
BEGIN
{
TST("empty array");
IN("[]");
SEL("0");
TST("one-element array: integer");
IN("[1]");
SEL("0");
SEL("1");
SEL("100");
SEL("-1");
TST("one-element array: hex integer (not in spec, not supported)");
IN("[0x1000]");
SEL("0");
TST("one-element array: float");
IN("[1.5001]");
SEL("0");
TST("one-element array: float + exponent");
IN("[16.3e10]");
SEL("0");
TST("one-element array: integer + whitespace");
IN("[ \t 5\t]");
SEL("0");
TST("one-element array: integer + exponent + whitespace");
IN("[ \t \t 16E10 \t ]");
SEL("0");
TST("one-element array: string");
IN("[\"alpha\"]");
SEL("0");
TST("alternative first-element indexing");
IN("[1,5,10,15,20]");
SEL("[0]");
SEL("[3]");
SEL("[4]");
SEL("[5]");
TST("one-element array: object");
IN("[ { \"first\": true, \"second\": false }]");
SEL("0.first");
SEL("0.second");
SEL("0.third");
TST("many-element array: integers");
IN("[0,1,1,2,3,5,8,13,21,34,55,89,144,233,377]");
SEL("10"); /* F(10) = 55 */
SEL("14"); /* F(14) = 377 */
SEL("19");
TST("many-element array: multiple types");
IN2("[\"string\",32,true,{\"a\":9,\"b\":false},100.3e10,false,200.5,",
"{\"key\":\"val\"},null]");
SEL("0");
SEL("0.notobject");
SEL("1");
SEL("2");
SEL("3");
SEL("3.a");
SEL("3.b");
SEL("3.c");
SEL("4");
SEL("5");
SEL("6");
SEL("7");
SEL("7.key");
SEL("7.key.notobject");
SEL("7.nonexist");
SEL("8");
SEL("9");
TST("many-element array: multiple types + whitespace");
IN2("\n[\t\"string\" ,\t32 , true\t,\t {\"a\": 9,\t\"b\": false},\t\t",
"100.3e10, false, 200.5,{\"key\" \t:\n \"val\"},\t\t null ]\t\t");
SEL("0");
SEL("0.notobject");
SEL("1");
SEL("2");
SEL("3");
SEL("3.a");
SEL("3.b");
SEL("3.c");
SEL("4");
SEL("5");
SEL("6");
SEL("7");
SEL("7.key");
SEL("7.key.notobject");
SEL("7.nonexist");
SEL("8");
SEL("9");
TST("two-element array: various string escape codes");
IN2("[\"abcd \\\" \\\\ \\/ \\b \\f \\n \\r \\t \\u0000 \\uf00F \", ",
"\"final\"]");
SEL("0");
SEL("1");
TST("three-element array: broken escape code");
IN("[\"fine here\", \"dodgey \\u00AZ\", \"wont get here\"]");
SEL("0");
SEL("1");
SEL("2");
TST("nested objects");
IN2("{ \"top\": { \"mid\" : { \"legs\": \"feet\" }, \"number\": 9, ",
"\"array\":[0,1,{\"a\":true,\"bb\":[1,2,false,{\"x\":\"yz\"}]}]}}");
SEL("top");
SEL("fargo");
SEL("top.mid");
SEL("top.centre");
SEL("top.mid.legs");
SEL("top.mid.number");
SEL("top.mid.array");
SEL("top.number");
SEL("top.array");
SEL("top.array[0]");
SEL("top.array[1]");
SEL("top.array[2]");
SEL("top.array[2].a");
SEL("top.array[2].b");
SEL("top.array[2].bb");
SEL("top.array[2].bb[0]");
SEL("top.array[2].bb[1]");
SEL("top.array[2].bb[2]");
SEL("top.array[2].bb[3]");
SEL("top.array[2].bb[3].x");
SEL("top.array[2].bb[3].x.nofurther");
SEL("top.array[2].bb[4]");
SEL("top.array[3]");
exit(0);
}
ERROR
{
exit(1);
}

View File

@ -0,0 +1,218 @@
tst |empty array|
in |[]|
sel |0|
out |<NULL>|
tst |one-element array: integer|
in |[1]|
sel |0|
out |1|
sel |1|
out |<NULL>|
sel |100|
out |<NULL>|
sel |-1|
out |<NULL>|
tst |one-element array: hex integer (not in spec, not supported)|
in |[0x1000]|
sel |0|
out |<NULL>|
tst |one-element array: float|
in |[1.5001]|
sel |0|
out |1.5001|
tst |one-element array: float + exponent|
in |[16.3e10]|
sel |0|
out |16.3e10|
tst |one-element array: integer + whitespace|
in |[ 5 ]|
sel |0|
out |5|
tst |one-element array: integer + exponent + whitespace|
in |[ 16E10 ]|
sel |0|
out |16E10|
tst |one-element array: string|
in |["alpha"]|
sel |0|
out |alpha|
tst |alternative first-element indexing|
in |[1,5,10,15,20]|
sel |[0]|
out |1|
sel |[3]|
out |15|
sel |[4]|
out |20|
sel |[5]|
out |<NULL>|
tst |one-element array: object|
in |[ { "first": true, "second": false }]|
sel |0.first|
out |true|
sel |0.second|
out |false|
sel |0.third|
out |<NULL>|
tst |many-element array: integers|
in |[0,1,1,2,3,5,8,13,21,34,55,89,144,233,377]|
sel |10|
out |55|
sel |14|
out |377|
sel |19|
out |<NULL>|
tst |many-element array: multiple types|
in |["string",32,true,{"a":9,"b":false},100.3e10,false,200.5,{"key":"val"},null]|
sel |0|
out |string|
sel |0.notobject|
out |<NULL>|
sel |1|
out |32|
sel |2|
out |true|
sel |3|
out |{"a":9,"b":false}|
sel |3.a|
out |9|
sel |3.b|
out |false|
sel |3.c|
out |<NULL>|
sel |4|
out |100.3e10|
sel |5|
out |false|
sel |6|
out |200.5|
sel |7|
out |{"key":"val"}|
sel |7.key|
out |val|
sel |7.key.notobject|
out |<NULL>|
sel |7.nonexist|
out |<NULL>|
sel |8|
out |null|
sel |9|
out |<NULL>|
tst |many-element array: multiple types + whitespace|
in |
[ "string" , 32 , true , {"a": 9, "b": false}, 100.3e10, false, 200.5,{"key" :
"val"}, null ] |
sel |0|
out |string|
sel |0.notobject|
out |<NULL>|
sel |1|
out |32|
sel |2|
out |true|
sel |3|
out |{"a": 9, "b": false}|
sel |3.a|
out |9|
sel |3.b|
out |false|
sel |3.c|
out |<NULL>|
sel |4|
out |100.3e10|
sel |5|
out |false|
sel |6|
out |200.5|
sel |7|
out |{"key" :
"val"}|
sel |7.key|
out |val|
sel |7.key.notobject|
out |<NULL>|
sel |7.nonexist|
out |<NULL>|
sel |8|
out |null|
sel |9|
out |<NULL>|
tst |two-element array: various string escape codes|
in |["abcd \" \\ \/ \b \f \n \r \t \u0000 \uf00F ", "final"]|
sel |0|
out |abcd \" \\ \/ \b \f \n \r \t \u0000 \uf00F |
sel |1|
out |final|
tst |three-element array: broken escape code|
in |["fine here", "dodgey \u00AZ", "wont get here"]|
sel |0|
out |fine here|
sel |1|
out |<NULL>|
sel |2|
out |<NULL>|
tst |nested objects|
in |{ "top": { "mid" : { "legs": "feet" }, "number": 9, "array":[0,1,{"a":true,"bb":[1,2,false,{"x":"yz"}]}]}}|
sel |top|
out |{ "mid" : { "legs": "feet" }, "number": 9, "array":[0,1,{"a":true,"bb":[1,2,false,{"x":"yz"}]}]}|
sel |fargo|
out |<NULL>|
sel |top.mid|
out |{ "legs": "feet" }|
sel |top.centre|
out |<NULL>|
sel |top.mid.legs|
out |feet|
sel |top.mid.number|
out |<NULL>|
sel |top.mid.array|
out |<NULL>|
sel |top.number|
out |9|
sel |top.array|
out |[0,1,{"a":true,"bb":[1,2,false,{"x":"yz"}]}]|
sel |top.array[0]|
out |0|
sel |top.array[1]|
out |1|
sel |top.array[2]|
out |{"a":true,"bb":[1,2,false,{"x":"yz"}]}|
sel |top.array[2].a|
out |true|
sel |top.array[2].b|
out |<NULL>|
sel |top.array[2].bb|
out |[1,2,false,{"x":"yz"}]|
sel |top.array[2].bb[0]|
out |1|
sel |top.array[2].bb[1]|
out |2|
sel |top.array[2].bb[2]|
out |false|
sel |top.array[2].bb[3]|
out |{"x":"yz"}|
sel |top.array[2].bb[3].x|
out |yz|
sel |top.array[2].bb[3].x.nofurther|
out |<NULL>|
sel |top.array[2].bb[4]|
out |<NULL>|
sel |top.array[3]|
out |<NULL>|

View File

@ -0,0 +1,51 @@
/*
* This file and its contents are supplied under the terms of the
* Common Development and Distribution License ("CDDL"), version 1.0.
* You may only use this file in accordance with the terms of version
* 1.0 of the CDDL.
*
* A full copy of the text of the CDDL should have accompanied this
* source. A copy of the CDDL is also available via the Internet at
* http://www.illumos.org/license/CDDL.
*/
/*
* Copyright 2012, Joyent, Inc. All rights reserved.
*/
/*
* ASSERTION:
* json() run time must be bounded above by strsize. This test makes strsize
* small and deliberately overflows it to prove we bail and return NULL in
* the event that we run off the end of the string.
*
*/
#pragma D option quiet
#pragma D option strsize=18
BEGIN
{
in = "{\"a\": 1024}"; /* length == 19 */
out = json(in, "a");
printf("|%s|\n%s\n\n", in, out != NULL ? out : "<NULL>");
in = "{\"a\": 1024}"; /* length == 11 */
out = json(in, "a");
printf("|%s|\n%s\n\n", in, out != NULL ? out : "<NULL>");
in = "{\"a\":false,\"b\":true}"; /* length == 20 */
out = json(in, "b");
printf("|%s|\n%s\n\n", in, out != NULL ? out : "<NULL>");
in = "{\"a\":false,\"b\":20}"; /* length == 18 */
out = json(in, "b");
printf("|%s|\n%s\n\n", in, out != NULL ? out : "<NULL>");
exit(0);
}
ERROR
{
exit(1);
}

View File

@ -0,0 +1,13 @@
|{"a": 1024|
<NULL>
|{"a": 1024}|
1024
|{"a":false,"b":tru|
<NULL>
|{"a":false,"b":20}|
20

View File

@ -0,0 +1,61 @@
/*
* This file and its contents are supplied under the terms of the
* Common Development and Distribution License ("CDDL"), version 1.0.
* You may only use this file in accordance with the terms of version
* 1.0 of the CDDL.
*
* A full copy of the text of the CDDL should have accompanied this
* source. A copy of the CDDL is also available via the Internet at
* http://www.illumos.org/license/CDDL.
*/
/*
* Copyright 2012 (c), Joyent, Inc. All rights reserved.
*/
#include <sys/sdt.h>
#include "usdt.h"
#define FMT "{" \
" \"sizes\": [ \"first\", 2, %f ]," \
" \"index\": %d," \
" \"facts\": {" \
" \"odd\": \"%s\"," \
" \"even\": \"%s\"" \
" }," \
" \"action\": \"%s\"" \
"}\n"
int
waiting(volatile int *a)
{
return (*a);
}
int
main(int argc, char **argv)
{
volatile int a = 0;
int idx;
double size = 250.5;
while (waiting(&a) == 0)
continue;
for (idx = 0; idx < 10; idx++) {
char *odd, *even, *json, *action;
size *= 1.78;
odd = idx % 2 == 1 ? "true" : "false";
even = idx % 2 == 0 ? "true" : "false";
action = idx == 7 ? "ignore" : "print";
asprintf(&json, FMT, size, idx, odd, even, action);
BUNYAN_FAKE_LOG_DEBUG(json);
free(json);
}
BUNYAN_FAKE_LOG_DEBUG("{\"finished\": true}");
return (0);
}

View File

@ -0,0 +1,65 @@
/*
* This file and its contents are supplied under the terms of the
* Common Development and Distribution License ("CDDL"), version 1.0.
* You may only use this file in accordance with the terms of version
* 1.0 of the CDDL.
*
* A full copy of the text of the CDDL should have accompanied this
* source. A copy of the CDDL is also available via the Internet at
* http://www.illumos.org/license/CDDL.
*/
/*
* Copyright (c) 2012, Joyent, Inc. All rights reserved.
*/
#pragma D option strsize=4k
#pragma D option quiet
#pragma D option destructive
/*
* This test reads a JSON string from a USDT probe, roughly simulating the
* primary motivating use case for the json() subroutine: filtering
* JSON-formatted log messages from a logging subsystem like node-bunyan.
*/
pid$1:a.out:waiting:entry
{
this->value = (int *)alloca(sizeof (int));
*this->value = 1;
copyout(this->value, arg0, sizeof (int));
}
bunyan*$1:::log-*
{
this->j = copyinstr(arg0);
}
bunyan*$1:::log-*
/json(this->j, "finished") == NULL && json(this->j, "action") != "ignore"/
{
this->index = strtoll(json(this->j, "index"));
this->size = json(this->j, "sizes[2]");
this->odd = json(this->j, "facts.odd");
this->even = json(this->j, "facts.even");
printf("[%d] sz %s odd %s even %s\n", this->index, this->size,
this->odd, this->even);
}
bunyan*$1:::log-*
/json(this->j, "finished") != NULL/
{
printf("FINISHED!\n");
exit(0);
}
tick-10s
{
printf("ERROR: Timed out before finish message!\n");
exit(1);
}
ERROR
{
exit(1);
}

View File

@ -0,0 +1,11 @@
[0] sz 445.890000 odd false even true
[1] sz 793.684200 odd true even false
[2] sz 1412.757876 odd false even true
[3] sz 2514.709019 odd true even false
[4] sz 4476.182054 odd false even true
[5] sz 7967.604057 odd true even false
[6] sz 14182.335221 odd false even true
[8] sz 44935.310914 odd false even true
[9] sz 79984.853427 odd true even false
FINISHED!

View File

@ -0,0 +1,27 @@
/*
* This file and its contents are supplied under the terms of the
* Common Development and Distribution License ("CDDL"), version 1.0.
* You may only use this file in accordance with the terms of version
* 1.0 of the CDDL.
*
* A full copy of the text of the CDDL should have accompanied this
* source. A copy of the CDDL is also available via the Internet at
* http://www.illumos.org/license/CDDL.
*/
/*
* Copyright 2012, Joyent, Inc. All rights reserved.
*/
/*
* Sets up a fake node-bunyan-like USDT provider for use from C.
*/
provider bunyan_fake {
probe log__trace(char *msg);
probe log__debug(char *msg);
probe log__info(char *msg);
probe log__warn(char *msg);
probe log__error(char *msg);
probe log__fatal(char *msg);
};

View File

@ -0,0 +1,91 @@
#
# 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) 2012, Joyent, Inc. All rights reserved.
#
tmpin=/tmp/tst.fds.$$.d
tmpout1=/tmp/tst.fds.$$.out1
tmpout2=/tmp/tst.fds.$$.out2
cat > $tmpin <<EOF
#define DUMPFIELD(fd, fmt, field) \
errmsg = "could not dump field"; \
printf("%d: field =fmt\n", fd, fds[fd].field);
/*
* Note that we are explicitly not looking at fi_mount -- it (by design) does
* not work if not running with kernel permissions.
*/
#define DUMP(fd) \
DUMPFIELD(fd, %s, fi_name); \
DUMPFIELD(fd, %s, fi_dirname); \
DUMPFIELD(fd, %s, fi_pathname); \
DUMPFIELD(fd, %d, fi_offset); \
DUMPFIELD(fd, %s, fi_fs); \
DUMPFIELD(fd, %o, fi_oflags);
BEGIN
{
DUMP(0);
DUMP(1);
DUMP(2);
DUMP(3);
DUMP(4);
exit(0);
}
ERROR
{
printf("error: %s\n", errmsg);
exit(1);
}
EOF
#
# First, with all privs
#
/usr/sbin/dtrace -q -Cs /dev/stdin < $tmpin > $tmpout2
mv $tmpout2 $tmpout1
#
# And now with only dtrace_proc and dtrace_user -- the output should be
# identical.
#
ppriv -s A=basic,dtrace_proc,dtrace_user $$
/usr/sbin/dtrace -q -Cs /dev/stdin < $tmpin > $tmpout2
echo ">>> $tmpout1"
cat $tmpout1
echo ">>> $tmpout2"
cat $tmpout2
rval=0
if ! cmp $tmpout1 $tmpout2 ; then
rval=1
fi
rm $tmpout1 $tmpout2 $tmpin
exit $rval

View File

@ -22,8 +22,8 @@
#
# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
# Copyright (c) 2012, Joyent, Inc. All rights reserved.
#
#ident "%Z%%M% %I% %E% SMI"
ppriv -s A=basic,dtrace_proc,dtrace_user $$
@ -31,7 +31,7 @@ ppriv -s A=basic,dtrace_proc,dtrace_user $$
BEGIN {
errorcount = 0;
expected_errorcount = 23;
expected_errorcount = 27;
}
BEGIN { trace(mutex_owned(&`pidlock)); }
@ -55,6 +55,8 @@ BEGIN { trace(strtok(`initname, "/")); }
BEGIN { trace(strtok(NULL, "/")); }
BEGIN { trace(strtok("foo/bar", `initname)); }
BEGIN { trace(strtok(NULL, `initname)); }
BEGIN { trace(strtoll(`initname)); }
BEGIN { trace(strtoll(`initname, 10)); }
BEGIN { trace(substr(`initname, 2, 3)); }
BEGIN { trace(ddi_pathname(`top_devinfo, 1)); }
@ -63,6 +65,9 @@ BEGIN { trace(strjoin("foo", `initname)); }
BEGIN { trace(dirname(`initname)); }
BEGIN { trace(cleanpath(`initname)); }
BEGIN { j = "{\"/sbin/init\":\"uh oh\"}"; trace(json(j, `initname)); }
BEGIN { trace(json(`initname, "x")); }
ERROR {
errorcount++;
}

View File

@ -0,0 +1,98 @@
#
# 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) 2012, Joyent, Inc. All rights reserved.
#
ppriv -s A=basic,dtrace_proc,dtrace_user $$
/usr/sbin/dtrace -q -Cs /dev/stdin <<EOF
#define CANREAD(field) \
BEGIN { this->fp = getf(0); errmsg = "can't read field"; \
printf("field: "); trace(this->fp->field); printf("\n"); }
#define CANTREAD(field) \
BEGIN { errmsg = ""; this->fp = getf(0); trace(this->fp->field); \
printf("\nable to successfully read field!"); exit(1); }
CANREAD(f_flag)
CANREAD(f_flag2)
CANREAD(f_vnode)
CANREAD(f_offset)
CANREAD(f_cred)
CANREAD(f_audit_data)
CANREAD(f_count)
/*
* We can potentially read parts of our cred, but we can't dereference
* through cr_zone.
*/
CANTREAD(f_cred->cr_zone->zone_id)
CANREAD(f_vnode->v_path)
CANREAD(f_vnode->v_op)
CANREAD(f_vnode->v_op->vnop_name)
CANTREAD(f_vnode->v_flag)
CANTREAD(f_vnode->v_count)
CANTREAD(f_vnode->v_pages)
CANTREAD(f_vnode->v_type)
CANTREAD(f_vnode->v_vfsmountedhere)
CANTREAD(f_vnode->v_op->vop_open)
BEGIN
{
errmsg = "";
this->fp = getf(0);
this->fp2 = getf(1);
trace(this->fp->f_vnode);
printf("\nable to successfully read this->fp!");
exit(1);
}
BEGIN
{
errmsg = "";
this->fp = getf(0);
}
BEGIN
{
trace(this->fp->f_vnode);
printf("\nable to successfully read this->fp from prior clause!");
}
BEGIN
{
exit(0);
}
ERROR
/errmsg != ""/
{
printf("fatal error: %s", errmsg);
exit(1);
}
EOF

View File

@ -0,0 +1,138 @@
#
# 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) 2012, Joyent, Inc. All rights reserved.
#
ppriv -s A=basic,dtrace_proc,dtrace_user $$
#
# When we have dtrace_proc (but lack dtrace_kernel), we expect to be able to
# read certain curpsinfo/curlwpsinfo/curcpu fields even though they require
# reading in-kernel state. However, there are other fields in these translated
# structures that we know we shouldn't be able to read, as they require reading
# in-kernel state that we cannot read with only dtrace_proc. Finally, there
# are a few fields that we may or may not be able to read depending on the
# specifics of context. This test therefore asserts that we can read what we
# think we should be able to, that we can't read what we think we shouldn't be
# able to, and (for purposes of completeness) that we are indifferent about
# what we cannot assert one way or the other.
#
/usr/sbin/dtrace -q -Cs /dev/stdin <<EOF
#define CANREAD(what, field) \
BEGIN { errmsg = "can't read field from what"; printf("field: "); \
trace(what->field); printf("\n"); }
#define CANTREAD(what, field) \
BEGIN { errmsg = ""; trace(what->field); \
printf("\nable to successfully read field from what!"); exit(1); }
#define MIGHTREAD(what, field) \
BEGIN { errmsg = ""; printf("field: "); trace(what->field); printf("\n"); }
#define CANREADVAR(vname) \
BEGIN { errmsg = "can't read vname"; printf("vname: "); \
trace(vname); printf("\n"); }
#define CANTREADVAR(vname) \
BEGIN { errmsg = ""; trace(vname); \
printf("\nable to successfully read vname!"); exit(1); }
#define MIGHTREADVAR(vname) \
BEGIN { errmsg = ""; printf("vname: "); trace(vname); printf("\n"); }
CANREAD(curpsinfo, pr_pid)
CANREAD(curpsinfo, pr_nlwp)
CANREAD(curpsinfo, pr_ppid)
CANREAD(curpsinfo, pr_uid)
CANREAD(curpsinfo, pr_euid)
CANREAD(curpsinfo, pr_gid)
CANREAD(curpsinfo, pr_egid)
CANREAD(curpsinfo, pr_addr)
CANREAD(curpsinfo, pr_start)
CANREAD(curpsinfo, pr_fname)
CANREAD(curpsinfo, pr_psargs)
CANREAD(curpsinfo, pr_argc)
CANREAD(curpsinfo, pr_argv)
CANREAD(curpsinfo, pr_envp)
CANREAD(curpsinfo, pr_dmodel)
/*
* If our p_pgidp points to the same pid structure as our p_pidp, we will
* be able to read pr_pgid -- but we won't if not.
*/
MIGHTREAD(curpsinfo, pr_pgid)
CANTREAD(curpsinfo, pr_sid)
CANTREAD(curpsinfo, pr_ttydev)
CANTREAD(curpsinfo, pr_projid)
CANTREAD(curpsinfo, pr_zoneid)
CANTREAD(curpsinfo, pr_contract)
CANREAD(curlwpsinfo, pr_flag)
CANREAD(curlwpsinfo, pr_lwpid)
CANREAD(curlwpsinfo, pr_addr)
CANREAD(curlwpsinfo, pr_wchan)
CANREAD(curlwpsinfo, pr_stype)
CANREAD(curlwpsinfo, pr_state)
CANREAD(curlwpsinfo, pr_sname)
CANREAD(curlwpsinfo, pr_syscall)
CANREAD(curlwpsinfo, pr_pri)
CANREAD(curlwpsinfo, pr_onpro)
CANREAD(curlwpsinfo, pr_bindpro)
CANREAD(curlwpsinfo, pr_bindpset)
CANTREAD(curlwpsinfo, pr_clname)
CANTREAD(curlwpsinfo, pr_lgrp)
CANREAD(curcpu, cpu_id)
CANTREAD(curcpu, cpu_pset)
CANTREAD(curcpu, cpu_chip)
CANTREAD(curcpu, cpu_lgrp)
CANTREAD(curcpu, cpu_info)
/*
* We cannot assert one thing or another about the variable "root": for those
* with only dtrace_proc, it will be readable in the global but not readable in
* the non-global.
*/
MIGHTREADVAR(root)
CANREADVAR(cpu)
CANTREADVAR(pset)
CANTREADVAR(cwd)
CANTREADVAR(chip)
CANTREADVAR(lgrp)
BEGIN
{
exit(0);
}
ERROR
/errmsg != ""/
{
printf("fatal error: %s", errmsg);
exit(1);
}

View File

@ -0,0 +1,126 @@
#
# 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) 2012, Joyent, Inc. All rights reserved.
#
#
# First, make sure that we can successfully enable the io provider
#
if ! dtrace -P io -n BEGIN'{exit(0)}' > /dev/null 2>&1 ; then
echo failed to enable io provider with full privs
exit 1
fi
ppriv -s A=basic,dtrace_proc,dtrace_user $$
#
# Now make sure that we cannot enable the io provider with reduced privs
#
if ! dtrace -x errtags -P io -n BEGIN'{exit(1)}' 2>&1 | \
grep D_PDESC_ZERO > /dev/null 2>&1 ; then
echo successfully enabled the io provider with reduced privs
exit 1
fi
#
# Keeping our reduced privs, we want to assure that we can see every provider
# that we think we should be able to see -- and that we can see curpsinfo
# state but can't otherwise see arguments.
#
/usr/sbin/dtrace -wq -Cs /dev/stdin <<EOF
int seen[string];
int err;
#define CANENABLE(provider) \
provider::: \
/err == 0 && progenyof(\$pid) && !seen["provider"]/ \
{ \
trace(arg0); \
printf("\nsuccessful trace of arg0 in %s:%s:%s:%s\n", \
probeprov, probemod, probefunc, probename); \
exit(++err); \
} \
\
provider::: \
/progenyof(\$pid)/ \
{ \
seen["provider"]++; \
} \
\
provider::: \
/progenyof(\$pid)/ \
{ \
errstr = "provider"; \
this->ignore = stringof(curpsinfo->pr_psargs); \
errstr = ""; \
} \
\
END \
/err == 0 && !seen["provider"]/ \
{ \
printf("no probes from provider\n"); \
exit(++err); \
} \
\
END \
/err == 0/ \
{ \
printf("saw %d probes from provider\n", seen["provider"]); \
}
CANENABLE(proc)
CANENABLE(sched)
CANENABLE(vminfo)
CANENABLE(sysinfo)
BEGIN
{
/*
* We'll kick off a system of a do-nothing command -- which should be
* enough to kick proc, sched, vminfo and sysinfo probes.
*/
system("echo > /dev/null");
}
ERROR
/err == 0 && errstr != ""/
{
printf("fatal error: couldn't read curpsinfo->pr_psargs in ");
printf("%s-provided probe\n", errstr);
exit(++err);
}
proc:::exit
/progenyof(\$pid)/
{
exit(0);
}
tick-10ms
/i++ > 500/
{
printf("exit probe did not seem to fire\n");
exit(++err);
}
EOF

View File

@ -0,0 +1,35 @@
/*
* This file and its contents are supplied under the terms of the
* Common Development and Distribution License ("CDDL"), version 1.0.
* You may only use this file in accordance with the terms of version
* 1.0 of the CDDL.
*
* A full copy of the text of the CDDL should have accompanied this
* source. A copy of the CDDL is also available via the Internet at
* http://www.illumos.org/license/CDDL.
*/
/*
* Copyright (c) 2012, Joyent, Inc. All rights reserved.
*/
/*
* ASSERTION:
* The largest base we will accept is Base 36 -- i.e. using all of 0-9 and
* A-Z as numerals.
*
* SECTION: Actions and Subroutines/strtoll()
*/
#pragma D option quiet
BEGIN
{
printf("%d\n", strtoll("0", 37));
exit(0);
}
ERROR
{
exit(1);
}

View File

@ -0,0 +1,34 @@
/*
* This file and its contents are supplied under the terms of the
* Common Development and Distribution License ("CDDL"), version 1.0.
* You may only use this file in accordance with the terms of version
* 1.0 of the CDDL.
*
* A full copy of the text of the CDDL should have accompanied this
* source. A copy of the CDDL is also available via the Internet at
* http://www.illumos.org/license/CDDL.
*/
/*
* Copyright (c) 2012, Joyent, Inc. All rights reserved.
*/
/*
* ASSERTION:
* The smallest base we will accept is Base 2.
*
* SECTION: Actions and Subroutines/strtoll()
*/
#pragma D option quiet
BEGIN
{
printf("%d\n", strtoll("0", 1));
exit(0);
}
ERROR
{
exit(1);
}

View File

@ -0,0 +1,66 @@
/*
* This file and its contents are supplied under the terms of the
* Common Development and Distribution License ("CDDL"), version 1.0.
* You may only use this file in accordance with the terms of version
* 1.0 of the CDDL.
*
* A full copy of the text of the CDDL should have accompanied this
* source. A copy of the CDDL is also available via the Internet at
* http://www.illumos.org/license/CDDL.
*/
/*
* Copyright (c) 2012, Joyent, Inc. All rights reserved.
*/
/*
* ASSERTION:
* Test the strtoll() subroutine.
*
* SECTION: Actions and Subroutines/strtoll()
*/
#pragma D option quiet
BEGIN
{
/* minimum base (2) and maximum base (36): */
printf("%d\n", strtoll("0", 2));
printf("%d\n", strtoll("1", 36));
/* simple tests: */
printf("%d\n", strtoll("0x20", 16));
printf("%d\n", strtoll("-32", 10));
printf("%d\n", strtoll("010", 8));
printf("%d\n", strtoll("101010", 2));
/* INT64_MIN and INT64_MAX: */
printf("%d\n", strtoll("9223372036854775807"));
printf("%d\n", strtoll("-9223372036854775808"));
printf("%d\n", strtoll("0777777777777777777777", 8));
printf("%d\n", strtoll("-01000000000000000000000", 8));
/* wrapping: */
printf("%d\n", strtoll("1000000000000000000000", 8));
printf("%d\n", strtoll("-1000000000000000000001", 8));
/* hex without prefix: */
printf("%d\n", strtoll("baddcafe", 16));
/* stopping at first out-of-base character: */
printf("%d\n", strtoll("12j", 10));
printf("%d\n", strtoll("102", 2));
/* base 36: */
printf("%d\n", strtoll("-0DTrace4EverZ", 36));
/* base 10 is assumed: */
printf("%d\n", strtoll("1985"));
printf("%d\n", strtoll("-2012"));
/* empty string: */
printf("%d\n", strtoll(""));
exit(0);
}

View File

@ -0,0 +1,20 @@
0
1
32
-32
8
42
9223372036854775807
-9223372036854775808
9223372036854775807
-9223372036854775808
-9223372036854775808
9223372036854775807
3135097598
12
2
-1819882045752187535
1985
-2012
0

View File

@ -0,0 +1,21 @@
/*
* This file and its contents are supplied under the terms of the
* Common Development and Distribution License ("CDDL"), version 1.0.
* You may only use this file in accordance with the terms of version
* 1.0 of the CDDL.
*
* A full copy of the text of the CDDL should have accompanied this
* source. A copy of the CDDL is also available via the Internet at
* http://www.illumos.org/license/CDDL.
*/
/*
* Copyright (c) 2013 Joyent, Inc. All rights reserved.
*/
#pragma D option quiet
BEGIN
{
trace((pidfoo`int)0);
}

View File

@ -0,0 +1,21 @@
/*
* This file and its contents are supplied under the terms of the
* Common Development and Distribution License ("CDDL"), version 1.0.
* You may only use this file in accordance with the terms of version
* 1.0 of the CDDL.
*
* A full copy of the text of the CDDL should have accompanied this
* source. A copy of the CDDL is also available via the Internet at
* http://www.illumos.org/license/CDDL.
*/
/*
* Copyright (c) 2013 Joyent, Inc. All rights reserved.
*/
#pragma D option quiet
BEGIN
{
trace((pid8foo`int)0);
}

View File

@ -0,0 +1,21 @@
/*
* This file and its contents are supplied under the terms of the
* Common Development and Distribution License ("CDDL"), version 1.0.
* You may only use this file in accordance with the terms of version
* 1.0 of the CDDL.
*
* A full copy of the text of the CDDL should have accompanied this
* source. A copy of the CDDL is also available via the Internet at
* http://www.illumos.org/license/CDDL.
*/
/*
* Copyright (c) 2013 Joyent, Inc. All rights reserved.
*/
#pragma D option quiet
BEGIN
{
trace((pid0`int)0);
}

View File

@ -0,0 +1,34 @@
#! /usr/bin/ksh
#
#
# This file and its contents are supplied under the terms of the
# Common Development and Distribution License ("CDDL"), version 1.0.
# You may only use this file in accordance with the terms of version
# 1.0 of the CDDL.
#
# A full copy of the text of the CDDL should have accompanied this
# source. A copy of the CDDL is also available via the Internet at
# http://www.illumos.org/license/CDDL.
#
#
# Copyright (c) 2013 Joyent, Inc. All rights reserved.
#
#
# While it's hard to be completely certain that a type of the name we want
# doesn't exist, we're going to try to pick a name which is rather unique.
#
if [ $# != 1 ]; then
echo expected one argument: '<'dtrace-path'>'
exit 2
fi
dtrace=$1
t="season_8_mountain_of_madness_t"
pid=$$
rc=`$dtrace -n "BEGIN{ trace(pid$pid`$t)0); }"`
exit $rc

View File

@ -0,0 +1,35 @@
#! /usr/bin/ksh
#
#
# This file and its contents are supplied under the terms of the
# Common Development and Distribution License ("CDDL"), version 1.0.
# You may only use this file in accordance with the terms of version
# 1.0 of the CDDL.
#
# A full copy of the text of the CDDL should have accompanied this
# source. A copy of the CDDL is also available via the Internet at
# http://www.illumos.org/license/CDDL.
#
#
# Copyright (c) 2013 Joyent, Inc. All rights reserved.
#
#
# While it's hard to be completely certain that a type of the name we want
# doesn't exist, we're going to try to pick a name which is rather
# unique. This time we're also going to use the pid$target alias.
#
if [ $# != 1 ]; then
echo expected one argument: '<'dtrace-path'>'
exit 2
fi
dtrace=$1
t="season_8_mountain_of_madness_t"
pid=$$
rc=`$dtrace -n "BEGIN{ trace(pid`$t)0); }"` -p $pid
exit $rc

View File

@ -0,0 +1,90 @@
#! /usr/bin/ksh
#
#
# This file and its contents are supplied under the terms of the
# Common Development and Distribution License ("CDDL"), version 1.0.
# You may only use this file in accordance with the terms of version
# 1.0 of the CDDL.
#
# A full copy of the text of the CDDL should have accompanied this
# source. A copy of the CDDL is also available via the Internet at
# http://www.illumos.org/license/CDDL.
#
#
# Copyright (c) 2013 Joyent, Inc. All rights reserved.
#
#
# This test is purposefully using a 64-bit DTrace and thus 64-bit types
# when compared with a 32-bit process. This test uses the userland
# keyword and so the implicit copyin should access illegal memory and
# thus exit.
#
if [ $# != 1 ]; then
echo expected one argument: '<'dtrace-path'>'
exit 2
fi
dtrace=$1
t="zelda_info_t"
exe="tst.chasestrings.exe"
elfdump "./$exe" | grep -q '.SUNW_ctf'
if [[ $? -ne 0 ]]; then
echo "CTF does not exist in $exe, that's a bug" >&2
exit 1
fi
./$exe &
pid=$!
$dtrace -64 -qs /dev/stdin <<EOF
typedef struct info {
char *zi_gamename;
int zi_ndungeons;
char *zi_villain;
int zi_haszelda;
} info_t;
pid$pid::has_princess:entry
/next == 0/
{
this->t = (userland info_t *)arg0;
printf("game: %s, dungeon: %d, villain: %s, zelda: %d\n",
stringof(this->t->zi_gamename), this->t->zi_ndungeons,
stringof(this->t->zi_villain), this->t->zi_haszelda);
next = 1;
}
pid$pid::has_dungeons:entry
/next == 1/
{
this->t = (userland info_t *)arg0;
printf("game: %s, dungeon: %d, villain: %s, zelda: %d\n",
stringof(this->t->zi_gamename), this->t->zi_ndungeons,
stringof(this->t->zi_villain), this->t->zi_haszelda);
next = 2;
}
pid$pid::has_villain:entry
/next == 2/
{
this->t = (userland info_t *)arg0;
printf("game: %s, dungeon: %d, villain: %s, zelda: %d\n",
stringof(this->t->zi_gamename), this->t->zi_ndungeons,
stringof(this->t->zi_villain), this->t->zi_haszelda);
exit(0);
}
ERROR
{
exit(1);
}
EOF
rc=$?
kill -9 $pid
exit $rc

View File

@ -0,0 +1,46 @@
/*
* This file and its contents are supplied under the terms of the
* Common Development and Distribution License ("CDDL"), version 1.0.
* You may only use this file in accordance with the terms of version
* 1.0 of the CDDL.
*
* A full copy of the text of the CDDL should have accompanied this
* source. A copy of the CDDL is also available via the Internet at
* http://www.illumos.org/license/CDDL.
*/
/*
* Copyright 2013 (c) Joyent, Inc. All rights reserved.
*/
/*
* This test tries to make sure that we have CTF data for a type that only this
* binary would reasonably have. In this case, the
* season_7_lisa_the_vegetarian_t.
*/
#include <unistd.h>
typedef struct season_7_lisa_the_vegetarian {
int fr_salad;
} season_7_lisa_the_vegetarian_t;
int
sleeper(season_7_lisa_the_vegetarian_t *lp)
{
for (;;) {
sleep(lp->fr_salad);
}
/*NOTREACHED*/
return (0);
}
int
main(void)
{
season_7_lisa_the_vegetarian_t l;
l.fr_salad = 100;
sleeper(&l);
return (0);
}

View File

@ -0,0 +1,44 @@
#! /usr/bin/ksh
#
#
# This file and its contents are supplied under the terms of the
# Common Development and Distribution License ("CDDL"), version 1.0.
# You may only use this file in accordance with the terms of version
# 1.0 of the CDDL.
#
# A full copy of the text of the CDDL should have accompanied this
# source. A copy of the CDDL is also available via the Internet at
# http://www.illumos.org/license/CDDL.
#
#
# Copyright (c) 2013 Joyent, Inc. All rights reserved.
#
#
# Lookup a type that is inside a.out.
#
if [ $# != 1 ]; then
echo expected one argument: '<'dtrace-path'>'
exit 2
fi
dtrace=$1
t="season_7_lisa_the_vegetrian_t *"
exe="tst.aouttype.exe"
elfdump "./$exe" | grep -q '.SUNW_ctf'
if [[ $? -ne 0 ]]; then
echo "CTF does not exist in $exe, that's a bug" >&2
exit 1
fi
./$exe &
pid=$!
rc=`$dtrace -n "BEGIN{ trace((pid$pid\`$t)0); exit(0); }"`
kill -9 $pid
exit $rc

View File

@ -0,0 +1,79 @@
/*
* This file and its contents are supplied under the terms of the
* Common Development and Distribution License ("CDDL"), version 1.0.
* You may only use this file in accordance with the terms of version
* 1.0 of the CDDL.
*
* A full copy of the text of the CDDL should have accompanied this
* source. A copy of the CDDL is also available via the Internet at
* http://www.illumos.org/license/CDDL.
*/
/*
* Copyright 2013 (c) Joyent, Inc. All rights reserved.
*/
/*
* This test takes data from the current binary which is basically running in a
* loop between two functions and our goal is to have two unique types that they
* contain which we can print.
*/
#include <unistd.h>
typedef struct zelda_info {
char *zi_gamename;
int zi_ndungeons;
char *zi_villain;
int zi_haszelda;
} zelda_info_t;
static int
has_princess(zelda_info_t *z)
{
return (z->zi_haszelda);
}
static int
has_dungeons(zelda_info_t *z)
{
return (z->zi_ndungeons != 0);
}
static const char *
has_villain(zelda_info_t *z)
{
return (z->zi_villain);
}
int
main(void)
{
zelda_info_t oot;
zelda_info_t la;
zelda_info_t lttp;
oot.zi_gamename = "Ocarina of Time";
oot.zi_ndungeons = 10;
oot.zi_villain = "Ganondorf";
oot.zi_haszelda = 1;
la.zi_gamename = "Link's Awakening";
la.zi_ndungeons = 9;
la.zi_villain = "Nightmare";
la.zi_haszelda = 0;
lttp.zi_gamename = "A Link to the Past";
lttp.zi_ndungeons = 12;
lttp.zi_villain = "Ganon";
lttp.zi_haszelda = 1;
for (;;) {
(void) has_princess(&oot);
(void) has_dungeons(&la);
(void) has_villain(&lttp);
sleep(1);
}
return (0);
}

View File

@ -0,0 +1,76 @@
#! /usr/bin/ksh
#
#
# This file and its contents are supplied under the terms of the
# Common Development and Distribution License ("CDDL"), version 1.0.
# You may only use this file in accordance with the terms of version
# 1.0 of the CDDL.
#
# A full copy of the text of the CDDL should have accompanied this
# source. A copy of the CDDL is also available via the Internet at
# http://www.illumos.org/license/CDDL.
#
#
# Copyright (c) 2013 Joyent, Inc. All rights reserved.
#
#
# This test is checking that we can read members and that pointers inside
# members point to valid data that is intelligible, eg. strings.
#
if [ $# != 1 ]; then
echo expected one argument: '<'dtrace-path'>'
exit 2
fi
dtrace=$1
t="zelda_info_t"
exe="tst.chasestrings.exe"
elfdump "./$exe" | grep -q '.SUNW_ctf'
if [[ $? -ne 0 ]]; then
echo "CTF does not exist in $exe, that's a bug" >&2
exit 1
fi
./$exe &
pid=$!
$dtrace -qs /dev/stdin <<EOF
pid$pid::has_princess:entry
/next == 0/
{
this->t = (pid$pid\`$t *)(copyin(arg0, sizeof (pid$pid\`$t)));
printf("game: %s, dungeon: %d, villain: %s, zelda: %d\n",
copyinstr((uintptr_t)this->t->zi_gamename), this->t->zi_ndungeons,
copyinstr((uintptr_t)this->t->zi_villain), this->t->zi_haszelda);
next = 1;
}
pid$pid::has_dungeons:entry
/next == 1/
{
this->t = (pid$pid\`$t *)(copyin(arg0, sizeof (pid$pid\`$t)));
printf("game: %s, dungeon: %d, villain: %s, zelda: %d\n",
copyinstr((uintptr_t)this->t->zi_gamename), this->t->zi_ndungeons,
copyinstr((uintptr_t)this->t->zi_villain), this->t->zi_haszelda);
next = 2;
}
pid$pid::has_villain:entry
/next == 2/
{
this->t = (pid$pid\`$t *)(copyin(arg0, sizeof (pid$pid\`$t)));
printf("game: %s, dungeon: %d, villain: %s, zelda: %d\n",
copyinstr((uintptr_t)this->t->zi_gamename), this->t->zi_ndungeons,
copyinstr((uintptr_t)this->t->zi_villain), this->t->zi_haszelda);
exit(0);
}
EOF
rc=$?
kill -9 $pid
exit $rc

View File

@ -0,0 +1,4 @@
game: Ocarina of Time, dungeon: 10, villain: Ganondorf, zelda: 1
game: Link's Awakening, dungeon: 9, villain: Nightmare, zelda: 0
game: A Link to the Past, dungeon: 12, villain: Ganon, zelda: 1

View File

@ -0,0 +1,29 @@
/*
* This file and its contents are supplied under the terms of the
* Common Development and Distribution License ("CDDL"), version 1.0.
* You may only use this file in accordance with the terms of version
* 1.0 of the CDDL.
*
* A full copy of the text of the CDDL should have accompanied this
* source. A copy of the CDDL is also available via the Internet at
* http://www.illumos.org/license/CDDL.
*/
/*
* Copyright 2013 (c) Joyent, Inc. All rights reserved.
*/
/*
* We're linked against libc which has types, though we do not.
*/
#include <unistd.h>
int
main(void)
{
for (;;) {
sleep(1000);
}
/*NOTREACHED*/
return (0);
}

View File

@ -0,0 +1,45 @@
#! /usr/bin/ksh
#
#
# This file and its contents are supplied under the terms of the
# Common Development and Distribution License ("CDDL"), version 1.0.
# You may only use this file in accordance with the terms of version
# 1.0 of the CDDL.
#
# A full copy of the text of the CDDL should have accompanied this
# source. A copy of the CDDL is also available via the Internet at
# http://www.illumos.org/license/CDDL.
#
#
# Copyright (c) 2013 Joyent, Inc. All rights reserved.
#
#
# Here we want to make sure that the program in question does not have ctf data
# in its a.out; however, we can get types out of a linked libc.
#
if [ $# != 1 ]; then
echo expected one argument: '<'dtrace-path'>'
exit 2
fi
dtrace=$1
t="int"
exe="tst.libtype.exe"
elfdump "./$exe" | grep -q '.SUNW_ctf'
if [[ $? -eq 0 ]]; then
echo "CTF exists in $exe, that's a bug" >&2
exit 1
fi
./$exe &
pid=$!
rc=`$dtrace -n "BEGIN{ trace((pid$pid\`$t)0); exit(0); }"`
kill -9 $pid
exit $rc

View File

@ -0,0 +1,44 @@
#! /usr/bin/ksh
#
#
# This file and its contents are supplied under the terms of the
# Common Development and Distribution License ("CDDL"), version 1.0.
# You may only use this file in accordance with the terms of version
# 1.0 of the CDDL.
#
# A full copy of the text of the CDDL should have accompanied this
# source. A copy of the CDDL is also available via the Internet at
# http://www.illumos.org/license/CDDL.
#
#
# Copyright (c) 2013 Joyent, Inc. All rights reserved.
#
#
# We should be able to see both strstr from libc and from ld on an
# alternate linkmap.
#
if [ $# != 1 ]; then
echo expected one argument: '<'dtrace-path'>'
exit 2
fi
dtrace=$1
$dtrace -q -p $$ -s /dev/stdin <<EOF
pid\$target:LM1\`ld.so.1:strstr:entry,
pid\$target:libc.so.1:strstr:entry
{
exit (0);
}
BEGIN
{
exit (0);
}
EOF
rc=$?
exit $rc

View File

@ -0,0 +1,69 @@
#! /usr/bin/ksh
#
#
# This file and its contents are supplied under the terms of the
# Common Development and Distribution License ("CDDL"), version 1.0.
# You may only use this file in accordance with the terms of version
# 1.0 of the CDDL.
#
# A full copy of the text of the CDDL should have accompanied this
# source. A copy of the CDDL is also available via the Internet at
# http://www.illumos.org/license/CDDL.
#
#
# Copyright (c) 2013 Joyent, Inc. All rights reserved.
#
#
# Use print() on userland CTF types and verify we get the data we expect.
#
if [ $# != 1 ]; then
echo expected one argument: '<'dtrace-path'>'
exit 2
fi
dtrace=$1
t="final_fantasy_info_t"
exe="tst.printtype.exe"
elfdump "./$exe" | grep -q '.SUNW_ctf'
if [[ $? -ne 0 ]]; then
echo "CTF does not exist in $exe, that's a bug" >&2
exit 1
fi
./$exe &
pid=$!
$dtrace -qs /dev/stdin <<EOF
pid$pid::ff_getgameid:entry
/next == 0/
{
print(*args[0]);
printf("\n");
next = 1;
}
pid$pid::ff_getpartysize:entry
/next == 1/
{
print(*args[0]);
printf("\n");
next = 2;
}
pid$pid::ff_getsummons:entry
/next == 2/
{
print(*args[0]);
printf("\n");
exit(0);
}
EOF
rc=$?
kill -9 $pid
exit $rc

View File

@ -0,0 +1,70 @@
#! /usr/bin/ksh
#
#
# This file and its contents are supplied under the terms of the
# Common Development and Distribution License ("CDDL"), version 1.0.
# You may only use this file in accordance with the terms of version
# 1.0 of the CDDL.
#
# A full copy of the text of the CDDL should have accompanied this
# source. A copy of the CDDL is also available via the Internet at
# http://www.illumos.org/license/CDDL.
#
#
# Copyright (c) 2013 Joyent, Inc. All rights reserved.
#
#
# Use print() on userland CTF types and verify we get the data we
# expect. This time, use $target to make sure that path works correctly.
#
if [ $# != 1 ]; then
echo expected one argument: '<'dtrace-path'>'
exit 2
fi
dtrace=$1
t="final_fantasy_info_t"
exe="tst.printtype.exe"
elfdump "./$exe" | grep -q '.SUNW_ctf'
if [[ $? -ne 0 ]]; then
echo "CTF does not exist in $exe, that's a bug" >&2
exit 1
fi
./$exe &
pid=$!
$dtrace -p $pid -qs /dev/stdin <<EOF
pid\$target::ff_getgameid:entry
/next == 0/
{
print(*args[0]);
printf("\n");
next = 1;
}
pid\$target::ff_getpartysize:entry
/next == 1/
{
print(*args[0]);
printf("\n");
next = 2;
}
pid\$target::ff_getsummons:entry
/next == 2/
{
print(*args[0]);
printf("\n");
exit(0);
}
EOF
rc=$?
kill -9 $pid
exit $rc

View File

@ -0,0 +1,72 @@
/*
* This file and its contents are supplied under the terms of the
* Common Development and Distribution License ("CDDL"), version 1.0.
* You may only use this file in accordance with the terms of version
* 1.0 of the CDDL.
*
* A full copy of the text of the CDDL should have accompanied this
* source. A copy of the CDDL is also available via the Internet at
* http://www.illumos.org/license/CDDL.
*/
/*
* Copyright 2013 (c) Joyent, Inc. All rights reserved.
*/
/*
* The point of this is to use print() on various functions to make sure that we
* can print basic structures. Note that we purposefully are making sure that
* there are no pointers here.
*/
#include <unistd.h>
typedef struct final_fantasy_info {
int ff_gameid;
int ff_partysize;
int ff_hassummons;
} final_fantasy_info_t;
static int
ff_getgameid(final_fantasy_info_t *f)
{
return (0);
}
static int
ff_getpartysize(final_fantasy_info_t *f)
{
return (0);
}
static int
ff_getsummons(final_fantasy_info_t *f)
{
return (0);
}
int
main(void)
{
final_fantasy_info_t ffiii, ffx, ffi;
ffi.ff_gameid = 1;
ffi.ff_partysize = 4;
ffi.ff_hassummons = 0;
ffiii.ff_gameid = 6;
ffiii.ff_partysize = 4;
ffiii.ff_hassummons = 1;
ffx.ff_gameid = 10;
ffx.ff_partysize = 3;
ffx.ff_hassummons = 1;
for (;;) {
ff_getgameid(&ffi);
ff_getpartysize(&ffx);
ff_getsummons(&ffiii);
sleep(1);
}
/*NOTREACHED*/
return (0);
}

View File

@ -0,0 +1,69 @@
#! /usr/bin/ksh
#
#
# This file and its contents are supplied under the terms of the
# Common Development and Distribution License ("CDDL"), version 1.0.
# You may only use this file in accordance with the terms of version
# 1.0 of the CDDL.
#
# A full copy of the text of the CDDL should have accompanied this
# source. A copy of the CDDL is also available via the Internet at
# http://www.illumos.org/license/CDDL.
#
#
# Copyright (c) 2013 Joyent, Inc. All rights reserved.
#
#
# Use print() on userland CTF types and verify we get the data we expect.
#
if [ $# != 1 ]; then
echo expected one argument: '<'dtrace-path'>'
exit 2
fi
dtrace=$1
t="final_fantasy_info_t"
exe="tst.printtype.exe"
elfdump "./$exe" | grep -q '.SUNW_ctf'
if [[ $? -ne 0 ]]; then
echo "CTF does not exist in $exe, that's a bug" >&2
exit 1
fi
./$exe &
pid=$!
$dtrace -qs /dev/stdin <<EOF
pid$pid::ff_getgameid:entry
/next == 0/
{
print(*(pid$pid\`$t *)(copyin(arg0, sizeof (pid$pid\`$t))));
printf("\n");
next = 1;
}
pid$pid::ff_getpartysize:entry
/next == 1/
{
print(*(pid$pid\`$t *)(copyin(arg0, sizeof (pid$pid\`$t))));
printf("\n");
next = 2;
}
pid$pid::ff_getsummons:entry
/next == 2/
{
print(*(pid$pid\`$t *)(copyin(arg0, sizeof (pid$pid\`$t))));
printf("\n");
exit(0);
}
EOF
rc=$?
kill -9 $pid
exit $rc

View File

@ -0,0 +1,16 @@
final_fantasy_info_t {
int ff_gameid = 0x1
int ff_partysize = 0x4
int ff_hassummons = 0
}
final_fantasy_info_t {
int ff_gameid = 0xa
int ff_partysize = 0x3
int ff_hassummons = 0x1
}
final_fantasy_info_t {
int ff_gameid = 0x6
int ff_partysize = 0x4
int ff_hassummons = 0x1
}

View File

@ -0,0 +1,70 @@
#! /usr/bin/ksh
#
#
# This file and its contents are supplied under the terms of the
# Common Development and Distribution License ("CDDL"), version 1.0.
# You may only use this file in accordance with the terms of version
# 1.0 of the CDDL.
#
# A full copy of the text of the CDDL should have accompanied this
# source. A copy of the CDDL is also available via the Internet at
# http://www.illumos.org/license/CDDL.
#
#
# Copyright (c) 2013 Joyent, Inc. All rights reserved.
#
#
# Use print() on userland CTF types and verify we get the data we
# expect. Use the pid` alias for $target.
#
if [ $# != 1 ]; then
echo expected one argument: '<'dtrace-path'>'
exit 2
fi
dtrace=$1
t="final_fantasy_info_t"
exe="tst.printtype.exe"
elfdump "./$exe" | grep -q '.SUNW_ctf'
if [[ $? -ne 0 ]]; then
echo "CTF does not exist in $exe, that's a bug" >&2
exit 1
fi
./$exe &
pid=$!
$dtrace -p $pid -qs /dev/stdin <<EOF
pid\$target::ff_getgameid:entry
/next == 0/
{
print(*(pid\`$t *)(copyin(arg0, sizeof (pid\`$t))));
printf("\n");
next = 1;
}
pid\$target::ff_getpartysize:entry
/next == 1/
{
print(*(pid\`$t *)(copyin(arg0, sizeof (pid\`$t))));
printf("\n");
next = 2;
}
pid\$target::ff_getsummons:entry
/next == 2/
{
print(*(pid\`$t *)(copyin(arg0, sizeof (pid\`$t))));
printf("\n");
exit(0);
}
EOF
rc=$?
kill -9 $pid
exit $rc

View File

@ -0,0 +1,83 @@
#! /usr/bin/ksh
#
#
# This file and its contents are supplied under the terms of the
# Common Development and Distribution License ("CDDL"), version 1.0.
# You may only use this file in accordance with the terms of version
# 1.0 of the CDDL.
#
# A full copy of the text of the CDDL should have accompanied this
# source. A copy of the CDDL is also available via the Internet at
# http://www.illumos.org/license/CDDL.
#
#
# Copyright (c) 2013 Joyent, Inc. All rights reserved.
#
#
# Simple test that if we manually use the userland keyword that it
# works.
#
if [ $# != 1 ]; then
echo expected one argument: '<'dtrace-path'>'
exit 2
fi
dtrace=$1
t="zelda_info_t"
exe="tst.chasestrings.exe"
elfdump "./$exe" | grep -q '.SUNW_ctf'
if [[ $? -ne 0 ]]; then
echo "CTF does not exist in $exe, that's a bug" >&2
exit 1
fi
./$exe &
pid=$!
$dtrace -32 -qs /dev/stdin <<EOF
typedef struct info {
char *zi_gamename;
int zi_ndungeons;
char *zi_villain;
int zi_haszelda;
} info_t;
pid$pid::has_princess:entry
/next == 0/
{
this->t = (userland info_t *)arg0;
printf("game: %s, dungeon: %d, villain: %s, zelda: %d\n",
stringof(this->t->zi_gamename), this->t->zi_ndungeons,
stringof(this->t->zi_villain), this->t->zi_haszelda);
next = 1;
}
pid$pid::has_dungeons:entry
/next == 1/
{
this->t = (userland info_t *)arg0;
printf("game: %s, dungeon: %d, villain: %s, zelda: %d\n",
stringof(this->t->zi_gamename), this->t->zi_ndungeons,
stringof(this->t->zi_villain), this->t->zi_haszelda);
next = 2;
}
pid$pid::has_villain:entry
/next == 2/
{
this->t = (userland info_t *)arg0;
printf("game: %s, dungeon: %d, villain: %s, zelda: %d\n",
stringof(this->t->zi_gamename), this->t->zi_ndungeons,
stringof(this->t->zi_villain), this->t->zi_haszelda);
exit(0);
}
EOF
rc=$?
kill -9 $pid
exit $rc

View File

@ -0,0 +1,4 @@
game: Ocarina of Time, dungeon: 10, villain: Ganondorf, zelda: 1
game: Link's Awakening, dungeon: 9, villain: Nightmare, zelda: 0
game: A Link to the Past, dungeon: 12, villain: Ganon, zelda: 1

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