mirror of
https://github.com/opnsense/src.git
synced 2026-05-28 04:12:45 -04:00
sync from head
This commit is contained in:
commit
69e6d7b75e
4175 changed files with 588005 additions and 257721 deletions
|
|
@ -30,7 +30,8 @@ contrib/openbsm rwatson Pre-commit review requested.
|
|||
sys/security/audit rwatson Pre-commit review requested.
|
||||
ahc(4) gibbs Pre-commit review requested.
|
||||
ahd(4) gibbs Pre-commit review requested.
|
||||
NEWCARD imp Pre-commit review requested.
|
||||
PC Card imp Pre-commit review requested.
|
||||
CardBus imp Pre-commit review requested.
|
||||
pci bus imp,jhb Pre-commit review requested.
|
||||
cdboot jhb Pre-commit review requested.
|
||||
pxeboot jhb Pre-commit review requested.
|
||||
|
|
@ -124,3 +125,6 @@ isci(4) jimharris Pre-commit review requested.
|
|||
cmx daniel@roe.ch Pre-commit review preferred.
|
||||
filemon obrien Pre-commit review preferred.
|
||||
sysdoc trhodes Pre-commit review preferred.
|
||||
sh(1) jilles Pre-commit review requested. This also applies
|
||||
to kill(1), printf(1) and test(1) which are
|
||||
compiled in as builtins.
|
||||
|
|
|
|||
20
Makefile
20
Makefile
|
|
@ -281,6 +281,9 @@ kernel: buildkernel installkernel
|
|||
#
|
||||
upgrade_checks:
|
||||
.if !defined(.PARSEDIR)
|
||||
.if defined(WITH_BMAKE)
|
||||
(cd ${.CURDIR} && ${MAKE} bmake)
|
||||
.else
|
||||
@if ! (cd ${.CURDIR}/tools/build/make_check && \
|
||||
PATH=${PATH} ${BINMAKE} obj >/dev/null 2>&1 && \
|
||||
PATH=${PATH} ${BINMAKE} >/dev/null 2>&1); \
|
||||
|
|
@ -288,6 +291,7 @@ upgrade_checks:
|
|||
(cd ${.CURDIR} && ${MAKE} make); \
|
||||
fi
|
||||
.endif
|
||||
.endif
|
||||
|
||||
#
|
||||
# Upgrade make(1) to the current version using the installed
|
||||
|
|
@ -302,12 +306,12 @@ MMAKE= ${MMAKEENV} ${MAKE} \
|
|||
-DNOMAN -DNO_MAN -DNOSHARED -DNO_SHARED \
|
||||
-DNO_CPU_CFLAGS -DNO_WERROR
|
||||
|
||||
make: .PHONY
|
||||
make bmake: .PHONY
|
||||
@echo
|
||||
@echo "--------------------------------------------------------------"
|
||||
@echo ">>> Building an up-to-date make(1)"
|
||||
@echo "--------------------------------------------------------------"
|
||||
${_+_}@cd ${.CURDIR}/usr.bin/make; \
|
||||
${_+_}@cd ${.CURDIR}/usr.bin/${.TARGET}; \
|
||||
${MMAKE} obj && \
|
||||
${MMAKE} depend && \
|
||||
${MMAKE} all && \
|
||||
|
|
@ -361,7 +365,7 @@ MAKEFAIL=tee -a ${FAILFILE}
|
|||
MAKEFAIL=cat
|
||||
.endif
|
||||
|
||||
universe: universe_prologue
|
||||
universe: universe_prologue upgrade_checks
|
||||
universe_prologue:
|
||||
@echo "--------------------------------------------------------------"
|
||||
@echo ">>> make universe started on ${STARTTIME}"
|
||||
|
|
@ -371,7 +375,7 @@ universe_prologue:
|
|||
.endif
|
||||
.for target in ${TARGETS}
|
||||
universe: universe_${target}
|
||||
.ORDER: universe_prologue universe_${target} universe_epilogue
|
||||
.ORDER: universe_prologue upgrade_checks universe_${target}_prologue universe_${target} universe_epilogue
|
||||
universe_${target}: universe_${target}_prologue
|
||||
universe_${target}_prologue:
|
||||
@echo ">> ${target} started on `LC_ALL=C date`"
|
||||
|
|
@ -392,6 +396,14 @@ universe_${target}_${target_arch}: universe_${target}_prologue
|
|||
.endfor
|
||||
.endif
|
||||
.if !defined(MAKE_JUST_WORLDS)
|
||||
# If we are building world and kernels wait for the required worlds to finish
|
||||
.if !defined(MAKE_JUST_KERNELS)
|
||||
.for target_arch in ${TARGET_ARCHES_${target}}
|
||||
universe_${target}_kernels: universe_${target}_${target_arch}
|
||||
.endfor
|
||||
.endif
|
||||
universe_${target}: universe_${target}_kernels
|
||||
universe_${target}_kernels: universe_${target}_prologue
|
||||
.if exists(${KERNSRCDIR}/${target}/conf/NOTES)
|
||||
@(cd ${KERNSRCDIR}/${target}/conf && env __MAKE_CONF=/dev/null \
|
||||
${MAKE} LINT > ${.CURDIR}/_.${target}.makeLINT 2>&1 || \
|
||||
|
|
|
|||
|
|
@ -678,6 +678,10 @@ _install-info= install-info
|
|||
_zoneinfo= zic tzsetup
|
||||
.endif
|
||||
|
||||
.if exists(/usr/sbin/nmtree)
|
||||
_nmtree_itools= nmtree
|
||||
.endif
|
||||
|
||||
ITOOLS= [ awk cap_mkdb cat chflags chmod chown \
|
||||
date echo egrep find grep id install ${_install-info} \
|
||||
ln lockf make mkdir mtree ${_nmtree_itools} mv pwd_mkdb \
|
||||
|
|
@ -1133,14 +1137,13 @@ _lex= usr.bin/lex
|
|||
.endif
|
||||
|
||||
.if ${BOOTSTRAPPING} < 1000013
|
||||
_yacc= usr.bin/yacc
|
||||
_yacc= lib/liby \
|
||||
usr.bin/yacc
|
||||
.endif
|
||||
|
||||
.if ${BOOTSTRAPPING} < 1000026
|
||||
_nmtree= lib/libnetbsd \
|
||||
usr.sbin/nmtree
|
||||
.else
|
||||
_nmtree_itools= nmtree
|
||||
.endif
|
||||
|
||||
.if ${BOOTSTRAPPING} < 1000027
|
||||
|
|
@ -1210,6 +1213,7 @@ bootstrap-tools:
|
|||
${_sed} \
|
||||
${_yacc} \
|
||||
${_lex} \
|
||||
lib/libmd \
|
||||
usr.bin/xinstall \
|
||||
${_gensnmptree} \
|
||||
usr.sbin/config \
|
||||
|
|
@ -1390,6 +1394,7 @@ _prebuild_libs= ${_kerberos5_lib_libasn1} \
|
|||
lib/libopie lib/libpam ${_lib_libthr} \
|
||||
lib/libradius lib/libsbuf lib/libtacplus \
|
||||
${_cddl_lib_libumem} ${_cddl_lib_libnvpair} \
|
||||
${_cddl_lib_libzfs_core} \
|
||||
lib/libutil ${_lib_libypclnt} lib/libz lib/msun \
|
||||
${_secure_lib_libcrypto} ${_secure_lib_libssh} \
|
||||
${_secure_lib_libssl}
|
||||
|
|
@ -1418,7 +1423,9 @@ lib/libopie__L lib/libtacplus__L: lib/libmd__L
|
|||
.if ${MK_CDDL} != "no"
|
||||
_cddl_lib_libumem= cddl/lib/libumem
|
||||
_cddl_lib_libnvpair= cddl/lib/libnvpair
|
||||
_cddl_lib_libzfs_core= cddl/lib/libzfs_core
|
||||
_cddl_lib= cddl/lib
|
||||
cddl/lib/libzfs_core__L: cddl/lib/libnvpair__L
|
||||
.endif
|
||||
|
||||
.if ${MK_CRYPT} != "no"
|
||||
|
|
@ -1741,13 +1748,15 @@ XDTP=/usr/${XDDIR}
|
|||
CDBENV=MAKEOBJDIRPREFIX=${MAKEOBJDIRPREFIX}/${XDDIR} \
|
||||
INSTALL="sh ${.CURDIR}/tools/install.sh"
|
||||
CDENV= ${CDBENV} \
|
||||
_SHLIBDIRPREFIX=${XDTP} \
|
||||
TOOLS_PREFIX=${XDTP}
|
||||
CD2ENV=${CDENV} \
|
||||
_SHLIBDIRPREFIX=${XDDESTDIR} \
|
||||
TOOLS_PREFIX=${XDDESTDIR}
|
||||
CD2CFLAGS=-isystem ${XDDESTDIR}/usr/include -L${XDDESTDIR}/usr/lib \
|
||||
-B${XDDESTDIR}/usr/lib
|
||||
CD2ENV=${CDENV} CC="${CC} ${CD2CFLAGS}" \
|
||||
MACHINE=${XDEV} MACHINE_ARCH=${XDEV_ARCH}
|
||||
|
||||
CDTMP= ${MAKEOBJDIRPREFIX}/${XDEV}/${.CURDIR}/tmp
|
||||
CDMAKE=${CDENV} ${MAKE} ${NOFUN}
|
||||
CDTMP= ${MAKEOBJDIRPREFIX}/${XDDIR}/${.CURDIR}/tmp
|
||||
CDMAKE=${CDENV} PATH=${CDTMP}/usr/bin:${PATH} ${MAKE} ${NOFUN}
|
||||
CD2MAKE=${CD2ENV} PATH=${CDTMP}/usr/bin:${XDTP}/usr/bin:${PATH} ${MAKE} ${NOFUN}
|
||||
XDDESTDIR=${DESTDIR}${XDTP}
|
||||
.if !defined(OSREL)
|
||||
|
|
@ -1757,8 +1766,24 @@ OSREL!= uname -r | sed -e 's/[-(].*//'
|
|||
.ORDER: xdev-build xdev-install
|
||||
xdev: xdev-build xdev-install
|
||||
|
||||
.ORDER: _xb-build-tools _xb-cross-tools
|
||||
xdev-build: _xb-build-tools _xb-cross-tools
|
||||
.ORDER: _xb-worldtmp _xb-bootstrap-tools _xb-build-tools _xb-cross-tools
|
||||
xdev-build: _xb-worldtmp _xb-bootstrap-tools _xb-build-tools _xb-cross-tools
|
||||
|
||||
_xb-worldtmp:
|
||||
mkdir -p ${CDTMP}/usr
|
||||
mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
|
||||
-p ${CDTMP}/usr >/dev/null
|
||||
|
||||
_xb-bootstrap-tools:
|
||||
.for _tool in \
|
||||
${_clang_tblgen}
|
||||
${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \
|
||||
cd ${.CURDIR}/${_tool}; \
|
||||
${CDMAKE} DIRPRFX=${_tool}/ obj; \
|
||||
${CDMAKE} DIRPRFX=${_tool}/ depend; \
|
||||
${CDMAKE} DIRPRFX=${_tool}/ all; \
|
||||
${CDMAKE} DIRPRFX=${_tool}/ DESTDIR=${CDTMP} install
|
||||
.endfor
|
||||
|
||||
_xb-build-tools:
|
||||
${_+_}@cd ${.CURDIR}; \
|
||||
|
|
@ -1768,7 +1793,9 @@ _xb-cross-tools:
|
|||
.for _tool in \
|
||||
gnu/usr.bin/binutils \
|
||||
gnu/usr.bin/cc \
|
||||
usr.bin/ar
|
||||
usr.bin/ar \
|
||||
${_clang_libs} \
|
||||
${_clang}
|
||||
${_+_}@${ECHODIR} "===> xdev ${_tool} (obj,depend,all)"; \
|
||||
cd ${.CURDIR}/${_tool}; \
|
||||
${CDMAKE} DIRPRFX=${_tool}/ obj; \
|
||||
|
|
@ -1794,7 +1821,8 @@ _xi-cross-tools:
|
|||
.for _tool in \
|
||||
gnu/usr.bin/binutils \
|
||||
gnu/usr.bin/cc \
|
||||
usr.bin/ar
|
||||
usr.bin/ar \
|
||||
${_clang}
|
||||
${_+_}@${ECHODIR} "===> xdev ${_tool} (install)"; \
|
||||
cd ${.CURDIR}/${_tool}; \
|
||||
${CDMAKE} DIRPRFX=${_tool}/ install DESTDIR=${XDDESTDIR}
|
||||
|
|
@ -1817,7 +1845,7 @@ _xi-links:
|
|||
../../../../usr/bin/${XDDIR}${OSREL}-$$i; \
|
||||
done
|
||||
.else
|
||||
xdev xdev-buil xdev-install:
|
||||
xdev xdev-build xdev-install:
|
||||
@echo "*** Error: Both XDEV and XDEV_ARCH must be defined for \"${.TARGET}\" target"
|
||||
.endif
|
||||
|
||||
|
|
|
|||
|
|
@ -38,6 +38,92 @@
|
|||
# xargs -n1 | sort | uniq -d;
|
||||
# done
|
||||
|
||||
# 20130404: legacy ATA stack removed
|
||||
OLD_FILES+=sbin/atacontrol
|
||||
OLD_FILES+=usr/share/man/man8/atacontrol.8.gz
|
||||
OLD_FILES+=usr/share/man/man4/atapicam.4.gz
|
||||
OLD_FILES+=usr/share/man/man4/ataraid.4.gz
|
||||
OLD_FILES+=usr/sbin/burncd
|
||||
OLD_FILES+=usr/share/man/man8/burncd.8.gz
|
||||
# 20130316: vinum.4 removed
|
||||
OLD_FILES+=usr/share/man/man4/vinum.4.gz
|
||||
# 20130312: fortunes-o removed
|
||||
OLD_FILES+=usr/share/games/fortune/fortunes-o
|
||||
OLD_FILES+=usr/share/games/fortune/fortunes-o.dat
|
||||
# 20130311: Ports are no more available via cvsup
|
||||
OLD_FILES+=usr/share/examples/cvsup/ports-supfile
|
||||
OLD_FILES+=usr/share/examples/cvsup/refuse
|
||||
OLD_FILES+=usr/share/examples/cvsup/refuse.README
|
||||
# 20130309: NWFS and NCP supports removed
|
||||
OLD_FILES+=usr/bin/ncplist
|
||||
OLD_FILES+=usr/bin/ncplogin
|
||||
OLD_FILES+=usr/bin/ncplogout
|
||||
OLD_FILES+=usr/include/fs/nwfs/nwfs.h
|
||||
OLD_FILES+=usr/include/fs/nwfs/nwfs_mount.h
|
||||
OLD_FILES+=usr/include/fs/nwfs/nwfs_node.h
|
||||
OLD_FILES+=usr/include/fs/nwfs/nwfs_subr.h
|
||||
OLD_DIRS+=usr/include/fs/nwfs
|
||||
OLD_FILES+=usr/include/netncp/ncp.h
|
||||
OLD_FILES+=usr/include/netncp/ncp_cfg.h
|
||||
OLD_FILES+=usr/include/netncp/ncp_conn.h
|
||||
OLD_FILES+=usr/include/netncp/ncp_file.h
|
||||
OLD_FILES+=usr/include/netncp/ncp_lib.h
|
||||
OLD_FILES+=usr/include/netncp/ncp_ncp.h
|
||||
OLD_FILES+=usr/include/netncp/ncp_nls.h
|
||||
OLD_FILES+=usr/include/netncp/ncp_rcfile.h
|
||||
OLD_FILES+=usr/include/netncp/ncp_rq.h
|
||||
OLD_FILES+=usr/include/netncp/ncp_sock.h
|
||||
OLD_FILES+=usr/include/netncp/ncp_subr.h
|
||||
OLD_FILES+=usr/include/netncp/ncp_user.h
|
||||
OLD_FILES+=usr/include/netncp/ncpio.h
|
||||
OLD_FILES+=usr/include/netncp/nwerror.h
|
||||
OLD_DIRS+=usr/include/netncp
|
||||
OLD_FILES+=usr/lib/libncp.a
|
||||
OLD_FILES+=usr/lib/libncp.so
|
||||
OLD_LIBS+=usr/lib/libncp.so.4
|
||||
OLD_FILES+=usr/lib/libncp_p.a
|
||||
OLD_FILES+=usr/lib32/libncp.a
|
||||
OLD_FILES+=usr/lib32/libncp.so
|
||||
OLD_LIBS+=usr/lib32/libncp.so.4
|
||||
OLD_FILES+=usr/lib32/libncp_p.a
|
||||
OLD_FILES+=usr/sbin/mount_nwfs
|
||||
OLD_FILES+=usr/share/examples/nwclient/dot.nwfsrc
|
||||
OLD_FILES+=usr/share/examples/nwclient/nwfs.sh.sample
|
||||
OLD_DIRS+=usr/share/examples/nwclient
|
||||
OLD_FILES+=usr/share/man/man1/ncplist.1.gz
|
||||
OLD_FILES+=usr/share/man/man1/ncplogin.1.gz
|
||||
OLD_FILES+=usr/share/man/man1/ncplogout.1.gz
|
||||
OLD_FILES+=usr/share/man/man8/mount_nwfs.8.gz
|
||||
# 20130302: NTFS support removed
|
||||
OLD_FILES+=rescue/mount_ntfs
|
||||
OLD_FILES+=sbin/mount_ntfs
|
||||
OLD_FILES+=usr/include/fs/ntfs/ntfs.h
|
||||
OLD_FILES+=usr/include/fs/ntfs/ntfs_compr.h
|
||||
OLD_FILES+=usr/include/fs/ntfs/ntfs_ihash.h
|
||||
OLD_FILES+=usr/include/fs/ntfs/ntfs_inode.h
|
||||
OLD_FILES+=usr/include/fs/ntfs/ntfs_subr.h
|
||||
OLD_FILES+=usr/include/fs/ntfs/ntfs_vfsops.h
|
||||
OLD_FILES+=usr/include/fs/ntfs/ntfsmount.h
|
||||
OLD_DIRS+=usr/include/fs/ntfs
|
||||
OLD_FILES+=usr/share/man/man8/mount_ntfs.8.gz
|
||||
# 20130302: PORTALFS support removed
|
||||
OLD_FILES+=usr/include/fs/portalfs/portal.h
|
||||
OLD_DIRS+=usr/include/fs/portalfs
|
||||
OLD_FILES+=usr/sbin/mount_portalfs
|
||||
OLD_FILES+=usr/share/examples/portal/README
|
||||
OLD_FILES+=usr/share/examples/portal/portal.conf
|
||||
OLD_DIRS+=usr/share/examples/portal
|
||||
OLD_FILES+=usr/share/man/man8/mount_portalfs.8.gz
|
||||
# 20130302: CODAFS support removed
|
||||
OLD_FILES+=usr/share/man/man4/coda.4.gz
|
||||
# 20130302: XFS support removed
|
||||
OLD_FILES+=usr/share/man/man5/xfs.5.gz
|
||||
# 20130302: Capsicum overhaul
|
||||
OLD_FILES+=usr/share/man/man2/cap_getrights.2.gz
|
||||
OLD_FILES+=usr/share/man/man2/cap_new.2.gz
|
||||
# 20130213: OpenSSL 1.0.1e import
|
||||
OLD_FILES+=usr/share/openssl/man/man3/EVP_PKEY_verifyrecover.3.gz
|
||||
OLD_FILES+=usr/share/openssl/man/man3/EVP_PKEY_verifyrecover_init.3.gz
|
||||
# 20130116: removed long unused directories for .1aout section manpages
|
||||
OLD_FILES+=usr/share/man/en.ISO8859-1/man1aout
|
||||
OLD_FILES+=usr/share/man/en.UTF-8/man1aout
|
||||
|
|
@ -45,6 +131,10 @@ OLD_DIRS+=usr/share/man/man1aout
|
|||
OLD_DIRS+=usr/share/man/cat1aout
|
||||
OLD_DIRS+=usr/share/man/en.ISO8859-1/cat1aout
|
||||
OLD_DIRS+=usr/share/man/en.UTF-8/cat1aout
|
||||
# 20130110: bsd.compat.mk removed
|
||||
OLD_FILES+=usr/share/mk/bsd.compat.mk
|
||||
# 20130103: gnats-supfile removed
|
||||
OLD_FILES+=usr/share/examples/cvsup/gnats-supfile
|
||||
# 20121230: libdisk removed
|
||||
OLD_FILES+=usr/share/man/man3/libdisk.3.gz usr/include/libdisk.h
|
||||
OLD_FILES+=usr/lib/libdisk.a usr/lib32/libdisk.a
|
||||
|
|
@ -54,9 +144,10 @@ OLD_DIRS+=var/remote
|
|||
# 20121114: zpool-features manual page moved from section 5 to 7
|
||||
OLD_FILES+=usr/share/man/man5/zpool-features.5.gz
|
||||
# 20121022: remove harp, hfa and idt man page
|
||||
OLD_FILES+=share/man/man4/harp.4
|
||||
OLD_FILES+=share/man/man4/hfa.4
|
||||
OLD_FILES+=share/man/man4/idt.4
|
||||
OLD_FILES+=usr/share/man/man4/harp.4.gz
|
||||
OLD_FILES+=usr/share/man/man4/hfa.4.gz
|
||||
OLD_FILES+=usr/share/man/man4/idt.4.gz
|
||||
OLD_FILES+=usr/share/man/man4/if_idt.4.gz
|
||||
# 20121022: VFS_LOCK_GIANT elimination
|
||||
OLD_FILES+=usr/share/man/man9/VFS_LOCK_GIANT.9.gz
|
||||
OLD_FILES+=usr/share/man/man9/VFS_UNLOCK_GIANT.9.gz
|
||||
|
|
|
|||
48
UPDATING
48
UPDATING
|
|
@ -26,6 +26,50 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 10.x IS SLOW:
|
|||
disable the most expensive debugging functionality run
|
||||
"ln -s 'abort:false,junk:false' /etc/malloc.conf".)
|
||||
|
||||
20130404:
|
||||
Legacy ATA stack, disabled and replaced by new CAM-based one since
|
||||
FreeBSD 9.0, completely removed from the sources. Kernel modules
|
||||
atadisk and atapi*, user-level tools atacontrol and burncd are
|
||||
removed. Kernel option `options ATA_CAM` is now permanently enabled
|
||||
and removed.
|
||||
|
||||
20130319:
|
||||
SOCK_CLOEXEC and SOCK_NONBLOCK flags have been added to socket(2)
|
||||
and socketpair(2). Software, in particular Kerberos, may
|
||||
automatically detect and use these during building. The resulting
|
||||
binaries will not work on older kernels.
|
||||
|
||||
20130308:
|
||||
CTL_DISABLE has also been added to the sparc64 GENERIC (for further
|
||||
information, see the respective 20130304 entry).
|
||||
|
||||
20130304:
|
||||
Recent commits to callout(9) changed the size of struct callout,
|
||||
so the KBI is probably heavily disturbed. Also, some functions
|
||||
in callout(9)/sleep(9)/sleepqueue(9)/condvar(9) KPIs were replaced
|
||||
by macros. Every kernel module using it won't load, so rebuild
|
||||
is requested.
|
||||
|
||||
The ctl device has been re-enabled in GENERIC for i386 and amd64,
|
||||
but does not initialize by default (because of the new CTL_DISABLE
|
||||
option) to save memory. To re-enable it, remove the CTL_DISABLE
|
||||
option from the kernel config file or set kern.cam.ctl.disable=0
|
||||
in /boot/loader.conf.
|
||||
|
||||
20130301:
|
||||
The ctl device has been disabled in GENERIC for i386 and amd64.
|
||||
This was done due to the extra memory being allocated at system
|
||||
initialisation time by the ctl driver which was only used if
|
||||
a CAM target device was created. This makes a FreeBSD system
|
||||
unusable on 128MB or less of RAM.
|
||||
|
||||
20130208:
|
||||
A new compression method (lz4) has been merged to -HEAD. Please
|
||||
refer to zpool-features(7) for more information.
|
||||
|
||||
Please refer to the "ZFS notes" section of this file for information
|
||||
on upgrading boot ZFS pools.
|
||||
|
||||
20130129:
|
||||
A BSD-licensed patch(1) variant has been added and is installed
|
||||
as bsdpatch, being the GNU version the default patch.
|
||||
|
|
@ -39,8 +83,8 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 10.x IS SLOW:
|
|||
unlikely event that -M was the last option on the command line
|
||||
and the command line contained at least two files and a target
|
||||
directory the first file will have logs appended to it. The -M
|
||||
option served little practical purpose in the last decade so it's
|
||||
used expected to be extremely rare.
|
||||
option served little practical purpose in the last decade so its
|
||||
use is expected to be extremely rare.
|
||||
|
||||
20121223:
|
||||
After switching to Clang as the default compiler some users of ZFS
|
||||
|
|
|
|||
|
|
@ -117,11 +117,7 @@ main(int argc, char *argv[])
|
|||
} else
|
||||
fts_options = hflag ? FTS_PHYSICAL : FTS_LOGICAL;
|
||||
|
||||
/* XXX: Why don't chflags and lchflags have compatible prototypes? */
|
||||
if (hflag)
|
||||
change_flags = (int (*)(const char *, unsigned long))lchflags;
|
||||
else
|
||||
change_flags = chflags;
|
||||
change_flags = hflag ? lchflags : chflags;
|
||||
|
||||
flags = *argv;
|
||||
if (*flags >= '0' && *flags <= '7') {
|
||||
|
|
|
|||
23
bin/cp/cp.1
23
bin/cp/cp.1
|
|
@ -32,7 +32,7 @@
|
|||
.\" @(#)cp.1 8.3 (Berkeley) 4/18/94
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd September 4, 2012
|
||||
.Dd March 15, 2013
|
||||
.Dt CP 1
|
||||
.Os
|
||||
.Sh NAME
|
||||
|
|
@ -251,6 +251,27 @@ signal, the current input and output file and the percentage complete
|
|||
will be written to the standard output.
|
||||
.Sh EXIT STATUS
|
||||
.Ex -std
|
||||
.Sh EXAMPLES
|
||||
Make a copy of file
|
||||
.Pa foo
|
||||
named
|
||||
.Pa bar :
|
||||
.Pp
|
||||
.Dl $ cp foo bar
|
||||
.Pp
|
||||
Copy a group of files to the
|
||||
.Pa /tmp
|
||||
directory:
|
||||
.Pp
|
||||
.Dl $ cp *.txt /tmp
|
||||
.Pp
|
||||
Copy the directory
|
||||
.Pa junk
|
||||
and all of its contents (including any subdirectories) to the
|
||||
.Pa /tmp
|
||||
directory:
|
||||
.Pp
|
||||
.Dl $ cp -R junk /tmp
|
||||
.Sh COMPATIBILITY
|
||||
Historic versions of the
|
||||
.Nm
|
||||
|
|
|
|||
|
|
@ -98,6 +98,13 @@ main(int argc __unused, char *argv[])
|
|||
dd_in();
|
||||
|
||||
dd_close();
|
||||
/*
|
||||
* Some devices such as cfi(4) may perform significant amounts
|
||||
* of work when a write descriptor is closed. Close the out
|
||||
* descriptor explicitly so that the summary handler (called
|
||||
* from an atexit() hook) includes this work.
|
||||
*/
|
||||
close(out.fd);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -71,7 +71,6 @@ __FBSDID("$FreeBSD$");
|
|||
#ifdef DES
|
||||
static DES_cblock ivec; /* initialization vector */
|
||||
static DES_cblock pvec; /* padding vector */
|
||||
#endif
|
||||
|
||||
static char bits[] = { /* used to extract bits from a char */
|
||||
'\200', '\100', '\040', '\020', '\010', '\004', '\002', '\001'
|
||||
|
|
@ -79,13 +78,12 @@ static char bits[] = { /* used to extract bits from a char */
|
|||
|
||||
static int pflag; /* 1 to preserve parity bits */
|
||||
|
||||
#ifdef DES
|
||||
static DES_key_schedule schedule; /* expanded DES key */
|
||||
#endif
|
||||
|
||||
static unsigned char des_buf[8];/* shared buffer for get_des_char/put_des_char */
|
||||
static int des_ct = 0; /* count for get_des_char/put_des_char */
|
||||
static int des_n = 0; /* index for put_des_char/get_des_char */
|
||||
#endif
|
||||
|
||||
/* init_des_cipher: initialize DES */
|
||||
void
|
||||
|
|
|
|||
20
bin/ls/ls.1
20
bin/ls/ls.1
|
|
@ -32,7 +32,7 @@
|
|||
.\" @(#)ls.1 8.7 (Berkeley) 7/29/94
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd November 8, 2012
|
||||
.Dd March 15, 2013
|
||||
.Dt LS 1
|
||||
.Os
|
||||
.Sh NAME
|
||||
|
|
@ -718,6 +718,24 @@ for more information.
|
|||
.El
|
||||
.Sh EXIT STATUS
|
||||
.Ex -std
|
||||
.Sh EXAMPLES
|
||||
List the contents of the current working directory in long format:
|
||||
.Pp
|
||||
.Dl $ ls -l
|
||||
.Pp
|
||||
In addition to listing the contents of the current working directory in
|
||||
long format, show inode numbers, file flags (see
|
||||
.Xr chflags 1 ) ,
|
||||
and suffix each filename with a symbol representing its file type:
|
||||
.Pp
|
||||
.Dl $ ls -lioF
|
||||
.Pp
|
||||
List the files in
|
||||
.Pa /var/log ,
|
||||
sorting the output such that the mostly recently modified entries are
|
||||
printed first:
|
||||
.Pp
|
||||
.Dl $ ls -lt /var/log
|
||||
.Sh COMPATIBILITY
|
||||
The group field is now automatically included in the long listing for
|
||||
files in order to be compatible with the
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@
|
|||
.\" @(#)mkdir.1 8.2 (Berkeley) 1/25/94
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd January 25, 1994
|
||||
.Dd March 15, 2013
|
||||
.Dt MKDIR 1
|
||||
.Os
|
||||
.Sh NAME
|
||||
|
|
@ -87,6 +87,23 @@ Be verbose when creating directories, listing them as they are created.
|
|||
The user must have write permission in the parent directory.
|
||||
.Sh EXIT STATUS
|
||||
.Ex -std
|
||||
.Sh EXAMPLES
|
||||
Create a directory named
|
||||
.Pa foobar :
|
||||
.Pp
|
||||
.Dl $ mkdir foobar
|
||||
.Pp
|
||||
Create a directory named
|
||||
.Pa foobar
|
||||
and set its file mode to 700:
|
||||
.Pp
|
||||
.Dl $ mkdir -m 700 foobar
|
||||
.Pp
|
||||
Create a directory named
|
||||
.Pa cow/horse/monkey ,
|
||||
creating any non-existent intermediate directories as necessary:
|
||||
.Pp
|
||||
.Dl $ mkdir -p cow/horse/monkey
|
||||
.Sh COMPATIBILITY
|
||||
The
|
||||
.Fl v
|
||||
|
|
|
|||
12
bin/mv/mv.1
12
bin/mv/mv.1
|
|
@ -32,7 +32,7 @@
|
|||
.\" @(#)mv.1 8.1 (Berkeley) 5/31/93
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd August 28, 2012
|
||||
.Dd March 15, 2013
|
||||
.Dt MV 1
|
||||
.Os
|
||||
.Sh NAME
|
||||
|
|
@ -155,6 +155,16 @@ rm -rf source_file
|
|||
.Ed
|
||||
.Sh EXIT STATUS
|
||||
.Ex -std
|
||||
.Sh EXAMPLES
|
||||
Rename file
|
||||
.Pa foo
|
||||
to
|
||||
.Pa bar ,
|
||||
overwriting
|
||||
.Pa bar
|
||||
if it already exists:
|
||||
.Pp
|
||||
.Dl $ mv -f foo bar
|
||||
.Sh COMPATIBILITY
|
||||
The
|
||||
.Fl h ,
|
||||
|
|
|
|||
|
|
@ -337,7 +337,7 @@ err: if (unlink(to))
|
|||
* on a file that we copied, i.e., that we didn't create.)
|
||||
*/
|
||||
errno = 0;
|
||||
if (fchflags(to_fd, (u_long)sbp->st_flags))
|
||||
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);
|
||||
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@
|
|||
.\" @(#)ps.1 8.3 (Berkeley) 4/18/94
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd February 7, 2013
|
||||
.Dd March 15, 2013
|
||||
.Dt PS 1
|
||||
.Os
|
||||
.Sh NAME
|
||||
|
|
@ -689,6 +689,10 @@ attempts to automatically determine the terminal width.
|
|||
.It Pa /boot/kernel/kernel
|
||||
default system namelist
|
||||
.El
|
||||
.Sh EXAMPLES
|
||||
Display information on all system processes:
|
||||
.Pp
|
||||
.Dl $ ps -auxw
|
||||
.Sh SEE ALSO
|
||||
.Xr kill 1 ,
|
||||
.Xr pgrep 1 ,
|
||||
|
|
|
|||
15
bin/rm/rm.1
15
bin/rm/rm.1
|
|
@ -32,7 +32,7 @@
|
|||
.\" @(#)rm.1 8.5 (Berkeley) 12/5/94
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd October 31, 2010
|
||||
.Dd March 15, 2013
|
||||
.Dt RM 1
|
||||
.Os
|
||||
.Sh NAME
|
||||
|
|
@ -193,6 +193,19 @@ When
|
|||
is specified with
|
||||
.Fl f
|
||||
the file will be overwritten and removed even if it has hard links.
|
||||
.Sh EXAMPLES
|
||||
Recursively remove all files contained within the
|
||||
.Pa foobar
|
||||
directory hierarchy:
|
||||
.Pp
|
||||
.Dl $ rm -rf foobar
|
||||
.Pp
|
||||
Either of these commands will remove the file
|
||||
.Pa -f :
|
||||
.Bd -literal -offset indent
|
||||
$ rm -- -f
|
||||
$ rm ./-f
|
||||
.Ed
|
||||
.Sh COMPATIBILITY
|
||||
The
|
||||
.Nm
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@
|
|||
.\" @(#)rmdir.1 8.1 (Berkeley) 5/31/93
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd March 21, 2004
|
||||
.Dd March 15, 2013
|
||||
.Dt RMDIR 1
|
||||
.Os
|
||||
.Sh NAME
|
||||
|
|
@ -86,6 +86,18 @@ successfully.
|
|||
.It Li >0
|
||||
An error occurred.
|
||||
.El
|
||||
.Sh EXAMPLES
|
||||
Remove the directory
|
||||
.Pa foobar ,
|
||||
if it is empty:
|
||||
.Pp
|
||||
.Dl $ rmdir foobar
|
||||
.Pp
|
||||
Remove all directories up to and including
|
||||
.Pa cow ,
|
||||
stopping at the first non-empty directory (if any):
|
||||
.Pp
|
||||
.Dl $ rmdir -p cow/horse/monkey
|
||||
.Sh SEE ALSO
|
||||
.Xr rm 1
|
||||
.Sh STANDARDS
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@
|
|||
.\"
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd September 2, 2012
|
||||
.Dd April 1, 2013
|
||||
.Dt SETFACL 1
|
||||
.Os
|
||||
.Sh NAME
|
||||
|
|
@ -91,10 +91,16 @@ An error will be reported if any of
|
|||
the specified files cannot have a default entry (i.e.\&
|
||||
non-directories). This option is not applicable to NFSv4 ACLs.
|
||||
.It Fl m Ar entries
|
||||
Modify the ACL entries on the specified files by adding new
|
||||
entries and modifying existing ACL entries with the ACL entries
|
||||
specified in
|
||||
.Ar entries .
|
||||
Modify the ACL on the specified file.
|
||||
New entries will be added, and existing entries will be modified
|
||||
according to the
|
||||
.Ar entries
|
||||
argument.
|
||||
For NFSv4 ACLs, it is recommended to use the
|
||||
.Fl a
|
||||
and
|
||||
.Fl x
|
||||
options instead.
|
||||
.It Fl M Ar file
|
||||
Modify the ACL entries on the specified files by adding new
|
||||
ACL entries and modifying existing ACL entries with the ACL
|
||||
|
|
@ -319,9 +325,9 @@ write_data
|
|||
execute
|
||||
.It p
|
||||
append_data
|
||||
.It d
|
||||
delete_child
|
||||
.It D
|
||||
delete_child
|
||||
.It d
|
||||
delete
|
||||
.It a
|
||||
read_attributes
|
||||
|
|
@ -395,6 +401,10 @@ NFSv4 ACL entries are evaluated in their visible order.
|
|||
.Pp
|
||||
Multiple ACL entries specified on the command line are
|
||||
separated by commas.
|
||||
.Pp
|
||||
Note that the file owner is always granted the read_acl, write_acl,
|
||||
read_attributes, and write_attributes permissions, even if the ACL
|
||||
would deny it.
|
||||
.Sh EXIT STATUS
|
||||
.Ex -std
|
||||
.Sh EXAMPLES
|
||||
|
|
|
|||
|
|
@ -174,6 +174,7 @@ evalstring(char *s, int flags)
|
|||
any = 1;
|
||||
}
|
||||
popstackmark(&smark);
|
||||
setstackmark(&smark);
|
||||
}
|
||||
popfile();
|
||||
popstackmark(&smark);
|
||||
|
|
@ -278,6 +279,8 @@ evaltree(union node *n, int flags)
|
|||
break;
|
||||
case NNOT:
|
||||
evaltree(n->nnot.com, EV_TESTED);
|
||||
if (evalskip)
|
||||
goto out;
|
||||
exitstatus = !exitstatus;
|
||||
break;
|
||||
|
||||
|
|
@ -296,10 +299,11 @@ evaltree(union node *n, int flags)
|
|||
}
|
||||
n = next;
|
||||
popstackmark(&smark);
|
||||
setstackmark(&smark);
|
||||
} while (n != NULL);
|
||||
out:
|
||||
popstackmark(&smark);
|
||||
if (pendingsigs)
|
||||
if (pendingsig)
|
||||
dotrap();
|
||||
if (eflag && exitstatus != 0 && do_etest)
|
||||
exitshell(exitstatus);
|
||||
|
|
|
|||
|
|
@ -165,7 +165,7 @@ tryexec(char *cmd, char **argv, char **envp)
|
|||
}
|
||||
}
|
||||
*argv = cmd;
|
||||
*--argv = _PATH_BSHELL;
|
||||
*--argv = __DECONST(char *, _PATH_BSHELL);
|
||||
execve(_PATH_BSHELL, argv, envp);
|
||||
}
|
||||
errno = e;
|
||||
|
|
@ -188,7 +188,7 @@ padvance(const char **path, const char *name)
|
|||
{
|
||||
const char *p, *start;
|
||||
char *q;
|
||||
int len;
|
||||
size_t len;
|
||||
|
||||
if (*path == NULL)
|
||||
return NULL;
|
||||
|
|
|
|||
|
|
@ -460,7 +460,7 @@ expbackq(union node *cmd, int quoted, int flag)
|
|||
int startloc = dest - stackblock();
|
||||
char const *syntax = quoted? DQSYNTAX : BASESYNTAX;
|
||||
int quotes = flag & (EXP_FULL | EXP_CASE | EXP_REDIR);
|
||||
int nnl;
|
||||
size_t nnl;
|
||||
|
||||
INTOFF;
|
||||
saveifs = ifsfirst;
|
||||
|
|
@ -1163,9 +1163,9 @@ nometa:
|
|||
static void
|
||||
expmeta(char *enddir, char *name)
|
||||
{
|
||||
char *p;
|
||||
char *q;
|
||||
char *start;
|
||||
const char *p;
|
||||
const char *q;
|
||||
const char *start;
|
||||
char *endname;
|
||||
int metaflag;
|
||||
struct stat statb;
|
||||
|
|
@ -1229,7 +1229,7 @@ expmeta(char *enddir, char *name)
|
|||
addfname(expdir);
|
||||
return;
|
||||
}
|
||||
endname = p;
|
||||
endname = name + (p - name);
|
||||
if (start != name) {
|
||||
p = name;
|
||||
while (p < start) {
|
||||
|
|
@ -1412,7 +1412,8 @@ match_charclass(const char *p, wchar_t chr, const char **end)
|
|||
*end = NULL;
|
||||
p++;
|
||||
nameend = strstr(p, ":]");
|
||||
if (nameend == NULL || nameend - p >= sizeof(name) || nameend == p)
|
||||
if (nameend == NULL || (size_t)(nameend - p) >= sizeof(name) ||
|
||||
nameend == p)
|
||||
return 0;
|
||||
memcpy(name, p, nameend - p);
|
||||
name[nameend - p] = '\0';
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ __FBSDID("$FreeBSD$");
|
|||
|
||||
struct strpush {
|
||||
struct strpush *prev; /* preceding string on stack */
|
||||
char *prevstring;
|
||||
const char *prevstring;
|
||||
int prevnleft;
|
||||
int prevlleft;
|
||||
struct alias *ap; /* if push was associated with an alias */
|
||||
|
|
@ -83,7 +83,7 @@ struct parsefile {
|
|||
int fd; /* file descriptor (or -1 if string) */
|
||||
int nleft; /* number of chars left in this line */
|
||||
int lleft; /* number of lines left in this buffer */
|
||||
char *nextc; /* next char in buffer */
|
||||
const char *nextc; /* next char in buffer */
|
||||
char *buf; /* input buffer */
|
||||
struct strpush *strpush; /* for pushing strings at this level */
|
||||
struct strpush basestrpush; /* so pushing one is fast */
|
||||
|
|
@ -93,7 +93,7 @@ struct parsefile {
|
|||
int plinno = 1; /* input line number */
|
||||
int parsenleft; /* copy of parsefile->nleft */
|
||||
MKINIT int parselleft; /* copy of parsefile->lleft */
|
||||
char *parsenextc; /* copy of parsefile->nextc */
|
||||
const char *parsenextc; /* copy of parsefile->nextc */
|
||||
static char basebuf[BUFSIZ + 1];/* buffer for top level input file */
|
||||
static struct parsefile basepf = { /* top level input file */
|
||||
.nextc = basebuf,
|
||||
|
|
@ -185,7 +185,7 @@ retry:
|
|||
nr = el_len;
|
||||
if (nr > BUFSIZ)
|
||||
nr = BUFSIZ;
|
||||
memcpy(parsenextc, rl_cp, nr);
|
||||
memcpy(parsefile->buf, rl_cp, nr);
|
||||
if (nr != el_len) {
|
||||
el_len -= nr;
|
||||
rl_cp += nr;
|
||||
|
|
@ -194,7 +194,7 @@ retry:
|
|||
}
|
||||
} else
|
||||
#endif
|
||||
nr = read(parsefile->fd, parsenextc, BUFSIZ);
|
||||
nr = read(parsefile->fd, parsefile->buf, BUFSIZ);
|
||||
|
||||
if (nr <= 0) {
|
||||
if (nr < 0) {
|
||||
|
|
@ -252,7 +252,7 @@ again:
|
|||
}
|
||||
}
|
||||
|
||||
q = p = parsenextc;
|
||||
q = p = parsefile->buf + (parsenextc - parsefile->buf);
|
||||
|
||||
/* delete nul characters */
|
||||
something = 0;
|
||||
|
|
@ -439,7 +439,7 @@ setinputfd(int fd, int push)
|
|||
*/
|
||||
|
||||
void
|
||||
setinputstring(char *string, int push)
|
||||
setinputstring(const char *string, int push)
|
||||
{
|
||||
INTOFF;
|
||||
if (push)
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@
|
|||
*/
|
||||
extern int plinno;
|
||||
extern int parsenleft; /* number of characters left in input buffer */
|
||||
extern char *parsenextc; /* next character in input buffer */
|
||||
extern const char *parsenextc; /* next character in input buffer */
|
||||
|
||||
struct alias;
|
||||
struct parsefile;
|
||||
|
|
@ -55,7 +55,7 @@ void pungetc(void);
|
|||
void pushstring(char *, int, struct alias *);
|
||||
void setinputfile(const char *, int);
|
||||
void setinputfd(int, int);
|
||||
void setinputstring(char *, int);
|
||||
void setinputstring(const char *, int);
|
||||
void popfile(void);
|
||||
struct parsefile *getcurrentfile(void);
|
||||
void popfilesupto(struct parsefile *);
|
||||
|
|
|
|||
|
|
@ -458,14 +458,15 @@ freejob(struct job *jp)
|
|||
|
||||
|
||||
int
|
||||
waitcmd(int argc, char **argv)
|
||||
waitcmd(int argc __unused, char **argv __unused)
|
||||
{
|
||||
struct job *job;
|
||||
int status, retval;
|
||||
struct job *jp;
|
||||
|
||||
if (argc > 1) {
|
||||
job = getjob(argv[1]);
|
||||
nextopt("");
|
||||
if (*argptr != NULL) {
|
||||
job = getjob(*argptr);
|
||||
} else {
|
||||
job = NULL;
|
||||
}
|
||||
|
|
@ -521,7 +522,7 @@ waitcmd(int argc, char **argv)
|
|||
} while (dowait(DOWAIT_BLOCK | DOWAIT_SIG, (struct job *)NULL) != -1);
|
||||
in_waitcmd--;
|
||||
|
||||
return 0;
|
||||
return pendingsig + 128;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -667,7 +668,8 @@ makejob(union node *node __unused, int nprocs)
|
|||
jobtab = jp;
|
||||
}
|
||||
jp = jobtab + njobs;
|
||||
for (i = 4 ; --i >= 0 ; jobtab[njobs++].used = 0);
|
||||
for (i = 4 ; --i >= 0 ; jobtab[njobs++].used = 0)
|
||||
;
|
||||
INTON;
|
||||
break;
|
||||
}
|
||||
|
|
@ -1004,7 +1006,7 @@ waitforjob(struct job *jp, int *origstatus)
|
|||
|
||||
|
||||
static void
|
||||
dummy_handler(int sig)
|
||||
dummy_handler(int sig __unused)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@ struct jmploc main_handler;
|
|||
int localeisutf8, initial_localeisutf8;
|
||||
|
||||
static void cmdloop(int);
|
||||
static void read_profile(char *);
|
||||
static void read_profile(const char *);
|
||||
static char *find_dot_file(char *);
|
||||
|
||||
/*
|
||||
|
|
@ -196,7 +196,7 @@ cmdloop(int top)
|
|||
TRACE(("cmdloop(%d) called\n", top));
|
||||
setstackmark(&smark);
|
||||
for (;;) {
|
||||
if (pendingsigs)
|
||||
if (pendingsig)
|
||||
dotrap();
|
||||
inter = 0;
|
||||
if (iflag && top) {
|
||||
|
|
@ -239,7 +239,7 @@ cmdloop(int top)
|
|||
*/
|
||||
|
||||
static void
|
||||
read_profile(char *name)
|
||||
read_profile(const char *name)
|
||||
{
|
||||
int fd;
|
||||
const char *expandedname;
|
||||
|
|
|
|||
|
|
@ -233,7 +233,8 @@ growstackblock(int min)
|
|||
|
||||
if (min < stacknleft)
|
||||
min = stacknleft;
|
||||
if (min >= INT_MAX / 2 - ALIGN(sizeof(struct stack_block)))
|
||||
if ((unsigned int)min >=
|
||||
INT_MAX / 2 - ALIGN(sizeof(struct stack_block)))
|
||||
error("Out of space");
|
||||
min += stacknleft;
|
||||
min += ALIGN(sizeof(struct stack_block));
|
||||
|
|
@ -327,7 +328,7 @@ makestrspace(int min, char *p)
|
|||
|
||||
|
||||
char *
|
||||
stputbin(const char *data, int len, char *p)
|
||||
stputbin(const char *data, size_t len, char *p)
|
||||
{
|
||||
CHECKSTRSPACE(len, p);
|
||||
memcpy(p, data, len);
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ void setstackmark(struct stackmark *);
|
|||
void popstackmark(struct stackmark *);
|
||||
char *growstackstr(void);
|
||||
char *makestrspace(int, char *);
|
||||
char *stputbin(const char *data, int len, char *p);
|
||||
char *stputbin(const char *data, size_t len, char *p);
|
||||
char *stputs(const char *data, char *p);
|
||||
|
||||
|
||||
|
|
@ -67,7 +67,7 @@ char *stputs(const char *data, char *p);
|
|||
#define grabstackblock(n) stalloc(n)
|
||||
#define STARTSTACKSTR(p) p = stackblock()
|
||||
#define STPUTC(c, p) do { if (p == sstrend) p = growstackstr(); *p++ = (c); } while(0)
|
||||
#define CHECKSTRSPACE(n, p) { if (sstrend - p < n) p = makestrspace(n, p); }
|
||||
#define CHECKSTRSPACE(n, p) { if ((size_t)(sstrend - p) < n) p = makestrspace(n, p); }
|
||||
#define USTPUTC(c, p) (*p++ = (c))
|
||||
/*
|
||||
* STACKSTRNUL's use is where we want to be able to turn a stack
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ static void calcsize(union node *);
|
|||
static void sizenodelist(struct nodelist *);
|
||||
static union node *copynode(union node *);
|
||||
static struct nodelist *copynodelist(struct nodelist *);
|
||||
static char *nodesavestr(char *);
|
||||
static char *nodesavestr(const char *);
|
||||
|
||||
|
||||
struct funcdef {
|
||||
|
|
@ -147,9 +147,9 @@ copynodelist(struct nodelist *lp)
|
|||
|
||||
|
||||
static char *
|
||||
nodesavestr(char *s)
|
||||
nodesavestr(const char *s)
|
||||
{
|
||||
char *p = s;
|
||||
const char *p = s;
|
||||
char *q = funcstring;
|
||||
char *rtn = funcstring;
|
||||
|
||||
|
|
|
|||
|
|
@ -119,7 +119,7 @@ static void parseheredoc(void);
|
|||
static int peektoken(void);
|
||||
static int readtoken(void);
|
||||
static int xxreadtoken(void);
|
||||
static int readtoken1(int, char const *, char *, int);
|
||||
static int readtoken1(int, const char *, const char *, int);
|
||||
static int noexpand(char *);
|
||||
static void synexpect(int) __dead2;
|
||||
static void synerror(const char *) __dead2;
|
||||
|
|
@ -983,7 +983,7 @@ parsebackq(char *out, struct nodelist **pbqlist,
|
|||
char *volatile str;
|
||||
struct jmploc jmploc;
|
||||
struct jmploc *const savehandler = handler;
|
||||
int savelen;
|
||||
size_t savelen;
|
||||
int saveprompt;
|
||||
const int bq_startlinno = plinno;
|
||||
char *volatile ostr = NULL;
|
||||
|
|
@ -1300,7 +1300,8 @@ readcstyleesc(char *out)
|
|||
#define PARSEARITH() {goto parsearith; parsearith_return:;}
|
||||
|
||||
static int
|
||||
readtoken1(int firstc, char const *initialsyntax, char *eofmark, int striptabs)
|
||||
readtoken1(int firstc, char const *initialsyntax, const char *eofmark,
|
||||
int striptabs)
|
||||
{
|
||||
int c = firstc;
|
||||
char *out;
|
||||
|
|
@ -1521,7 +1522,7 @@ checkend: {
|
|||
}
|
||||
if (c == *eofmark) {
|
||||
if (pfgets(line, sizeof line) != NULL) {
|
||||
char *p, *q;
|
||||
const char *p, *q;
|
||||
|
||||
p = line;
|
||||
for (q = eofmark + 1 ; *q && *p == *q ; p++, q++);
|
||||
|
|
@ -2038,7 +2039,7 @@ getprompt(void *unused __unused)
|
|||
|
||||
|
||||
const char *
|
||||
expandstr(char *ps)
|
||||
expandstr(const char *ps)
|
||||
{
|
||||
union node n;
|
||||
struct jmploc jmploc;
|
||||
|
|
|
|||
|
|
@ -82,4 +82,4 @@ void fixredir(union node *, const char *, int);
|
|||
int goodname(const char *);
|
||||
int isassignment(const char *);
|
||||
char *getprompt(void *);
|
||||
const char *expandstr(char *);
|
||||
const char *expandstr(const char *);
|
||||
|
|
|
|||
|
|
@ -64,7 +64,6 @@ __FBSDID("$FreeBSD$");
|
|||
|
||||
#define EMPTY -2 /* marks an unused slot in redirtab */
|
||||
#define CLOSED -1 /* fd was not open before redir */
|
||||
#define PIPESIZE 4096 /* amount of buffering in a pipe */
|
||||
|
||||
|
||||
MKINIT
|
||||
|
|
@ -253,7 +252,9 @@ openhere(union node *redir)
|
|||
{
|
||||
char *p;
|
||||
int pip[2];
|
||||
int len = 0;
|
||||
size_t len = 0;
|
||||
int flags;
|
||||
ssize_t written = 0;
|
||||
|
||||
if (pipe(pip) < 0)
|
||||
error("Pipe call failed: %s", strerror(errno));
|
||||
|
|
@ -263,9 +264,16 @@ openhere(union node *redir)
|
|||
else
|
||||
p = redir->nhere.doc->narg.text;
|
||||
len = strlen(p);
|
||||
if (len <= PIPESIZE) {
|
||||
xwrite(pip[1], p, len);
|
||||
if (len == 0)
|
||||
goto out;
|
||||
flags = fcntl(pip[1], F_GETFL, 0);
|
||||
if (flags != -1 && fcntl(pip[1], F_SETFL, flags | O_NONBLOCK) != -1) {
|
||||
written = write(pip[1], p, len);
|
||||
if (written < 0)
|
||||
written = 0;
|
||||
if ((size_t)written == len)
|
||||
goto out;
|
||||
fcntl(pip[1], F_SETFL, flags);
|
||||
}
|
||||
|
||||
if (forkshell((struct job *)NULL, (union node *)NULL, FORK_NOJOB) == 0) {
|
||||
|
|
@ -275,7 +283,7 @@ openhere(union node *redir)
|
|||
signal(SIGHUP, SIG_IGN);
|
||||
signal(SIGTSTP, SIG_IGN);
|
||||
signal(SIGPIPE, SIG_DFL);
|
||||
xwrite(pip[1], p, len);
|
||||
xwrite(pip[1], p + written, len - written);
|
||||
_exit(0);
|
||||
}
|
||||
out:
|
||||
|
|
|
|||
15
bin/sh/sh.1
15
bin/sh/sh.1
|
|
@ -32,7 +32,7 @@
|
|||
.\" from: @(#)sh.1 8.6 (Berkeley) 5/4/95
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd January 22, 2013
|
||||
.Dd March 24, 2013
|
||||
.Dt SH 1
|
||||
.Os
|
||||
.Sh NAME
|
||||
|
|
@ -1061,6 +1061,9 @@ A subshell environment may be implemented as a child process or differently.
|
|||
If job control is enabled in an interactive shell,
|
||||
commands grouped in parentheses can be suspended and continued as a unit.
|
||||
.Pp
|
||||
For compatibility with other shells,
|
||||
two open parentheses in sequence should be separated by whitespace.
|
||||
.Pp
|
||||
The second form never forks another shell,
|
||||
so it is slightly more efficient.
|
||||
Grouping commands together this way allows the user to
|
||||
|
|
@ -1618,6 +1621,16 @@ and
|
|||
.Ic times
|
||||
returns information about the same process
|
||||
if they are the only command in a command substitution.
|
||||
.Pp
|
||||
If a command substitution of the
|
||||
.Li $(
|
||||
form begins with a subshell,
|
||||
the
|
||||
.Li $(
|
||||
and
|
||||
.Li (\&
|
||||
must be separated by whitespace
|
||||
to avoid ambiguity with arithmetic expansion.
|
||||
.Ss Arithmetic Expansion
|
||||
Arithmetic expansion provides a mechanism for evaluating an arithmetic
|
||||
expression and substituting its value.
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ __FBSDID("$FreeBSD$");
|
|||
|
||||
|
||||
MKINIT char sigmode[NSIG]; /* current value of signal */
|
||||
int pendingsigs; /* indicates some signal received */
|
||||
volatile sig_atomic_t pendingsig; /* indicates some signal received */
|
||||
int in_dotrap; /* do we execute in a trap handler? */
|
||||
static char *volatile trap[NSIG]; /* trap handler commands */
|
||||
static volatile sig_atomic_t gotsig[NSIG];
|
||||
|
|
@ -150,7 +150,7 @@ printsignals(void)
|
|||
* The trap builtin.
|
||||
*/
|
||||
int
|
||||
trapcmd(int argc, char **argv)
|
||||
trapcmd(int argc __unused, char **argv)
|
||||
{
|
||||
char *action;
|
||||
int signo;
|
||||
|
|
@ -388,22 +388,25 @@ onsig(int signo)
|
|||
return;
|
||||
}
|
||||
|
||||
if (signo != SIGCHLD || !ignore_sigchld)
|
||||
gotsig[signo] = 1;
|
||||
pendingsigs++;
|
||||
|
||||
/* If we are currently in a wait builtin, prepare to break it */
|
||||
if ((signo == SIGINT || signo == SIGQUIT) && in_waitcmd != 0)
|
||||
breakwaitcmd = 1;
|
||||
/*
|
||||
* If a trap is set, not ignored and not the null command, we need
|
||||
* to make sure traps are executed even when a child blocks signals.
|
||||
*/
|
||||
if (Tflag &&
|
||||
trap[signo] != NULL &&
|
||||
! (trap[signo][0] == '\0') &&
|
||||
! (trap[signo][0] == ':' && trap[signo][1] == '\0'))
|
||||
if ((signo == SIGINT || signo == SIGQUIT) && in_waitcmd != 0) {
|
||||
breakwaitcmd = 1;
|
||||
pendingsig = signo;
|
||||
}
|
||||
|
||||
if (trap[signo] != NULL && trap[signo][0] != '\0' &&
|
||||
(signo != SIGCHLD || !ignore_sigchld)) {
|
||||
gotsig[signo] = 1;
|
||||
pendingsig = signo;
|
||||
|
||||
/*
|
||||
* If a trap is set, not ignored and not the null command, we
|
||||
* need to make sure traps are executed even when a child
|
||||
* blocks signals.
|
||||
*/
|
||||
if (Tflag && !(trap[signo][0] == ':' && trap[signo][1] == '\0'))
|
||||
breakwaitcmd = 1;
|
||||
}
|
||||
|
||||
#ifndef NO_HISTORY
|
||||
if (signo == SIGWINCH)
|
||||
|
|
@ -424,7 +427,7 @@ dotrap(void)
|
|||
|
||||
in_dotrap++;
|
||||
for (;;) {
|
||||
pendingsigs = 0;
|
||||
pendingsig = 0;
|
||||
for (i = 1; i < NSIG; i++) {
|
||||
if (gotsig[i]) {
|
||||
gotsig[i] = 0;
|
||||
|
|
@ -452,7 +455,6 @@ dotrap(void)
|
|||
last_trapsig = i;
|
||||
savestatus = exitstatus;
|
||||
evalstring(trap[i], 0);
|
||||
exitstatus = savestatus;
|
||||
|
||||
/*
|
||||
* If such a command was not
|
||||
|
|
@ -461,9 +463,11 @@ dotrap(void)
|
|||
* trap action to have an effect
|
||||
* outside of it.
|
||||
*/
|
||||
if (prev_evalskip != 0) {
|
||||
if (evalskip == 0 ||
|
||||
prev_evalskip != 0) {
|
||||
evalskip = prev_evalskip;
|
||||
skipcount = prev_skipcount;
|
||||
exitstatus = savestatus;
|
||||
}
|
||||
|
||||
if (i == SIGCHLD)
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@
|
|||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
extern int pendingsigs;
|
||||
extern volatile sig_atomic_t pendingsig;
|
||||
extern int in_dotrap;
|
||||
extern volatile sig_atomic_t gotwinch;
|
||||
|
||||
|
|
|
|||
|
|
@ -169,15 +169,65 @@ True if
|
|||
.Ar file
|
||||
exists and is a socket.
|
||||
.It Ar file1 Fl nt Ar file2
|
||||
True if
|
||||
True if both
|
||||
.Ar file1
|
||||
exists and is newer than
|
||||
and
|
||||
.Ar file2
|
||||
exist and
|
||||
.Ar file1
|
||||
is newer than
|
||||
.Ar file2 .
|
||||
.It Ar file1 Fl nt Ns Ar X Ns Ar Y Ar file2
|
||||
True if both
|
||||
.Ar file1
|
||||
and
|
||||
.Ar file2
|
||||
exist and
|
||||
.Ar file1
|
||||
has a more recent last access time
|
||||
.Pq Ar X Ns = Ns Cm a ,
|
||||
inode creation time
|
||||
.Pq Ar X Ns = Ns Cm b ,
|
||||
change time
|
||||
.Pq Ar X Ns = Ns Cm c ,
|
||||
or modification time
|
||||
.Pq Ar X Ns = Ns Cm m
|
||||
than the last access time
|
||||
.Pq Ar Y Ns = Ns Cm a ,
|
||||
inode creation time
|
||||
.Pq Ar Y Ns = Ns Cm b ,
|
||||
change time
|
||||
.Pq Ar Y Ns = Ns Cm c ,
|
||||
or modification time
|
||||
.Pq Ar Y Ns = Ns Cm m
|
||||
of
|
||||
.Ar file2 .
|
||||
Note that
|
||||
.Ic -ntmm
|
||||
is equivalent to
|
||||
.Ic -nt .
|
||||
.It Ar file1 Fl ot Ar file2
|
||||
True if
|
||||
True if both
|
||||
.Ar file1
|
||||
exists and is older than
|
||||
and
|
||||
.Ar file2
|
||||
exist and
|
||||
.Ar file1
|
||||
is older than
|
||||
.Ar file2 .
|
||||
Note that
|
||||
.Ar file1
|
||||
.Ic -ot
|
||||
.Ar file2
|
||||
is equivalent to
|
||||
.Ar file2
|
||||
.Ic -nt
|
||||
.Ar file1
|
||||
.It Ar file1 Fl ot Ns Ar X Ns Ar Y Ar file2
|
||||
Equivalent to
|
||||
.Ar file2
|
||||
.Ic -nt Ns Ar Y Ns Ar X
|
||||
.Ar file1 .
|
||||
.It Ar file1 Fl ef Ar file2
|
||||
True if
|
||||
.Ar file1
|
||||
|
|
|
|||
184
bin/test/test.c
184
bin/test/test.c
|
|
@ -63,7 +63,7 @@ error(const char *msg, ...)
|
|||
"-u"|"-g"|"-k"|"-s"|"-t"|"-z"|"-n"|"-o"|"-O"|"-G"|"-L"|"-S";
|
||||
|
||||
binary-operator ::= "="|"!="|"-eq"|"-ne"|"-ge"|"-gt"|"-le"|"-lt"|
|
||||
"-nt"|"-ot"|"-ef";
|
||||
"-nt"|"-nt[abcm][abcm]"|"-ot"|"-ot[abcm][abcm])"|"-ef";
|
||||
operand ::= <any legal UNIX file name>
|
||||
*/
|
||||
|
||||
|
|
@ -85,8 +85,38 @@ enum token {
|
|||
FILSUID,
|
||||
FILSGID,
|
||||
FILSTCK,
|
||||
FILNT,
|
||||
FILOT,
|
||||
FILNTAA,
|
||||
FILNTAB,
|
||||
FILNTAC,
|
||||
FILNTAM,
|
||||
FILNTBA,
|
||||
FILNTBB,
|
||||
FILNTBC,
|
||||
FILNTBM,
|
||||
FILNTCA,
|
||||
FILNTCB,
|
||||
FILNTCC,
|
||||
FILNTCM,
|
||||
FILNTMA,
|
||||
FILNTMB,
|
||||
FILNTMC,
|
||||
FILNTMM,
|
||||
FILOTAA,
|
||||
FILOTAB,
|
||||
FILOTAC,
|
||||
FILOTAM,
|
||||
FILOTBA,
|
||||
FILOTBB,
|
||||
FILOTBC,
|
||||
FILOTBM,
|
||||
FILOTCA,
|
||||
FILOTCB,
|
||||
FILOTCC,
|
||||
FILOTCM,
|
||||
FILOTMA,
|
||||
FILOTMB,
|
||||
FILOTMC,
|
||||
FILOTMM,
|
||||
FILEQ,
|
||||
FILUID,
|
||||
FILGID,
|
||||
|
|
@ -118,9 +148,16 @@ enum token_types {
|
|||
PAREN
|
||||
};
|
||||
|
||||
enum time_types {
|
||||
ATIME,
|
||||
BTIME,
|
||||
CTIME,
|
||||
MTIME
|
||||
};
|
||||
|
||||
static struct t_op {
|
||||
char op_text[4];
|
||||
short op_num, op_type;
|
||||
char op_text[6];
|
||||
char op_num, op_type;
|
||||
} const ops [] = {
|
||||
{"-r", FILRD, UNOP},
|
||||
{"-w", FILWR, UNOP},
|
||||
|
|
@ -154,8 +191,40 @@ static struct t_op {
|
|||
{"-gt", INTGT, BINOP},
|
||||
{"-le", INTLE, BINOP},
|
||||
{"-lt", INTLT, BINOP},
|
||||
{"-nt", FILNT, BINOP},
|
||||
{"-ot", FILOT, BINOP},
|
||||
{"-nt", FILNTMM, BINOP},
|
||||
{"-ntaa", FILNTAA, BINOP},
|
||||
{"-ntab", FILNTAB, BINOP},
|
||||
{"-ntac", FILNTAC, BINOP},
|
||||
{"-ntam", FILNTAM, BINOP},
|
||||
{"-ntba", FILNTBA, BINOP},
|
||||
{"-ntbb", FILNTBB, BINOP},
|
||||
{"-ntbc", FILNTBC, BINOP},
|
||||
{"-ntbm", FILNTBM, BINOP},
|
||||
{"-ntca", FILNTCA, BINOP},
|
||||
{"-ntcb", FILNTCB, BINOP},
|
||||
{"-ntcc", FILNTCC, BINOP},
|
||||
{"-ntcm", FILNTCM, BINOP},
|
||||
{"-ntma", FILNTMA, BINOP},
|
||||
{"-ntmb", FILNTMB, BINOP},
|
||||
{"-ntmc", FILNTMC, BINOP},
|
||||
{"-ntmm", FILNTMM, BINOP},
|
||||
{"-ot", FILOTMM, BINOP},
|
||||
{"-otaa", FILOTAA, BINOP},
|
||||
{"-otab", FILOTBB, BINOP},
|
||||
{"-otac", FILOTAC, BINOP},
|
||||
{"-otam", FILOTAM, BINOP},
|
||||
{"-otba", FILOTBA, BINOP},
|
||||
{"-otbb", FILOTBB, BINOP},
|
||||
{"-otbc", FILOTBC, BINOP},
|
||||
{"-otbm", FILOTBM, BINOP},
|
||||
{"-otca", FILOTCA, BINOP},
|
||||
{"-otcb", FILOTCB, BINOP},
|
||||
{"-otcc", FILOTCC, BINOP},
|
||||
{"-otcm", FILOTCM, BINOP},
|
||||
{"-otma", FILOTMA, BINOP},
|
||||
{"-otmb", FILOTMB, BINOP},
|
||||
{"-otmc", FILOTMC, BINOP},
|
||||
{"-otmm", FILOTMM, BINOP},
|
||||
{"-ef", FILEQ, BINOP},
|
||||
{"!", UNOT, BUNOP},
|
||||
{"-a", BAND, BBINOP},
|
||||
|
|
@ -180,10 +249,10 @@ static int intcmp(const char *, const char *);
|
|||
static int isunopoperand(void);
|
||||
static int islparenoperand(void);
|
||||
static int isrparenoperand(void);
|
||||
static int newerf(const char *, const char *);
|
||||
static int newerf(const char *, const char *, enum time_types,
|
||||
enum time_types);
|
||||
static int nexpr(enum token);
|
||||
static int oexpr(enum token);
|
||||
static int olderf(const char *, const char *);
|
||||
static int primary(enum token);
|
||||
static void syntax(const char *, const char *);
|
||||
static enum token t_lex(char *);
|
||||
|
|
@ -353,10 +422,70 @@ binop(void)
|
|||
return intcmp(opnd1, opnd2) <= 0;
|
||||
case INTLT:
|
||||
return intcmp(opnd1, opnd2) < 0;
|
||||
case FILNT:
|
||||
return newerf (opnd1, opnd2);
|
||||
case FILOT:
|
||||
return olderf (opnd1, opnd2);
|
||||
case FILNTAA:
|
||||
return newerf(opnd1, opnd2, ATIME, ATIME);
|
||||
case FILNTAB:
|
||||
return newerf(opnd1, opnd2, ATIME, BTIME);
|
||||
case FILNTAC:
|
||||
return newerf(opnd1, opnd2, ATIME, CTIME);
|
||||
case FILNTAM:
|
||||
return newerf(opnd1, opnd2, ATIME, MTIME);
|
||||
case FILNTBA:
|
||||
return newerf(opnd1, opnd2, BTIME, ATIME);
|
||||
case FILNTBB:
|
||||
return newerf(opnd1, opnd2, BTIME, BTIME);
|
||||
case FILNTBC:
|
||||
return newerf(opnd1, opnd2, BTIME, CTIME);
|
||||
case FILNTBM:
|
||||
return newerf(opnd1, opnd2, BTIME, MTIME);
|
||||
case FILNTCA:
|
||||
return newerf(opnd1, opnd2, CTIME, ATIME);
|
||||
case FILNTCB:
|
||||
return newerf(opnd1, opnd2, CTIME, BTIME);
|
||||
case FILNTCC:
|
||||
return newerf(opnd1, opnd2, CTIME, CTIME);
|
||||
case FILNTCM:
|
||||
return newerf(opnd1, opnd2, CTIME, MTIME);
|
||||
case FILNTMA:
|
||||
return newerf(opnd1, opnd2, MTIME, ATIME);
|
||||
case FILNTMB:
|
||||
return newerf(opnd1, opnd2, MTIME, BTIME);
|
||||
case FILNTMC:
|
||||
return newerf(opnd1, opnd2, MTIME, CTIME);
|
||||
case FILNTMM:
|
||||
return newerf(opnd1, opnd2, MTIME, MTIME);
|
||||
case FILOTAA:
|
||||
return newerf(opnd2, opnd1, ATIME, ATIME);
|
||||
case FILOTAB:
|
||||
return newerf(opnd2, opnd1, BTIME, ATIME);
|
||||
case FILOTAC:
|
||||
return newerf(opnd2, opnd1, CTIME, ATIME);
|
||||
case FILOTAM:
|
||||
return newerf(opnd2, opnd1, MTIME, ATIME);
|
||||
case FILOTBA:
|
||||
return newerf(opnd2, opnd1, ATIME, BTIME);
|
||||
case FILOTBB:
|
||||
return newerf(opnd2, opnd1, BTIME, BTIME);
|
||||
case FILOTBC:
|
||||
return newerf(opnd2, opnd1, CTIME, BTIME);
|
||||
case FILOTBM:
|
||||
return newerf(opnd2, opnd1, MTIME, BTIME);
|
||||
case FILOTCA:
|
||||
return newerf(opnd2, opnd1, ATIME, CTIME);
|
||||
case FILOTCB:
|
||||
return newerf(opnd2, opnd1, BTIME, CTIME);
|
||||
case FILOTCC:
|
||||
return newerf(opnd2, opnd1, CTIME, CTIME);
|
||||
case FILOTCM:
|
||||
return newerf(opnd2, opnd1, MTIME, CTIME);
|
||||
case FILOTMA:
|
||||
return newerf(opnd2, opnd1, ATIME, MTIME);
|
||||
case FILOTMB:
|
||||
return newerf(opnd2, opnd1, BTIME, MTIME);
|
||||
case FILOTMC:
|
||||
return newerf(opnd2, opnd1, CTIME, MTIME);
|
||||
case FILOTMM:
|
||||
return newerf(opnd2, opnd1, MTIME, MTIME);
|
||||
case FILEQ:
|
||||
return equalf (opnd1, opnd2);
|
||||
default:
|
||||
|
|
@ -570,25 +699,34 @@ intcmp (const char *s1, const char *s2)
|
|||
}
|
||||
|
||||
static int
|
||||
newerf (const char *f1, const char *f2)
|
||||
newerf (const char *f1, const char *f2, enum time_types t1, enum time_types t2)
|
||||
{
|
||||
struct stat b1, b2;
|
||||
struct timespec *ts1, *ts2;
|
||||
|
||||
if (stat(f1, &b1) != 0 || stat(f2, &b2) != 0)
|
||||
return 0;
|
||||
|
||||
if (b1.st_mtim.tv_sec > b2.st_mtim.tv_sec)
|
||||
switch (t1) {
|
||||
case ATIME: ts1 = &b1.st_atim; break;
|
||||
case BTIME: ts1 = &b1.st_birthtim; break;
|
||||
case CTIME: ts1 = &b1.st_ctim; break;
|
||||
default: ts1 = &b1.st_mtim; break;
|
||||
}
|
||||
|
||||
switch (t2) {
|
||||
case ATIME: ts2 = &b2.st_atim; break;
|
||||
case BTIME: ts2 = &b2.st_birthtim; break;
|
||||
case CTIME: ts2 = &b2.st_ctim; break;
|
||||
default: ts2 = &b2.st_mtim; break;
|
||||
}
|
||||
|
||||
if (ts1->tv_sec > ts2->tv_sec)
|
||||
return 1;
|
||||
if (b1.st_mtim.tv_sec < b2.st_mtim.tv_sec)
|
||||
if (ts1->tv_sec < ts2->tv_sec)
|
||||
return 0;
|
||||
|
||||
return (b1.st_mtim.tv_nsec > b2.st_mtim.tv_nsec);
|
||||
}
|
||||
|
||||
static int
|
||||
olderf (const char *f1, const char *f2)
|
||||
{
|
||||
return (newerf(f2, f1));
|
||||
return (ts1->tv_nsec > ts2->tv_nsec);
|
||||
}
|
||||
|
||||
static int
|
||||
|
|
|
|||
|
|
@ -23,8 +23,9 @@
|
|||
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
|
||||
#pragma ident "%Z%%M% %I% %E% SMI"
|
||||
/*
|
||||
* Copyright (c) 2012 by Delphix. All rights reserved.
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
|
@ -195,6 +196,13 @@ fatal(const char *fmt, ...)
|
|||
verror(fmt, ap);
|
||||
va_end(ap);
|
||||
|
||||
/*
|
||||
* Close the DTrace handle to ensure that any controlled processes are
|
||||
* correctly restored and continued.
|
||||
*/
|
||||
if (g_dtp)
|
||||
dtrace_close(g_dtp);
|
||||
|
||||
exit(E_ERROR);
|
||||
}
|
||||
|
||||
|
|
@ -1402,6 +1410,7 @@ main(int argc, char *argv[])
|
|||
(void) dtrace_setopt(g_dtp, "bufsize", "4m");
|
||||
(void) dtrace_setopt(g_dtp, "aggsize", "4m");
|
||||
#endif
|
||||
(void) dtrace_setopt(g_dtp, "temporal", "yes");
|
||||
|
||||
/*
|
||||
* If -G is specified, enable -xlink=dynamic and -xunodefs to permit
|
||||
|
|
|
|||
|
|
@ -23,7 +23,6 @@
|
|||
# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
|
||||
# Use is subject to license terms.
|
||||
#
|
||||
# ident "%Z%%M% %I% %E% SMI"
|
||||
|
||||
# Exception list: names tests that are bypassed when running in Java
|
||||
# mode (relative to /opt/SUNWdtrt/tst)
|
||||
|
|
@ -52,14 +51,17 @@ common/usdt/tst.enabled.ksh
|
|||
common/usdt/tst.enabled2.ksh
|
||||
common/usdt/tst.entryreturn.ksh
|
||||
common/usdt/tst.fork.ksh
|
||||
common/usdt/tst.header.ksh
|
||||
common/usdt/tst.guess32.ksh
|
||||
common/usdt/tst.guess64.ksh
|
||||
common/usdt/tst.header.ksh
|
||||
common/usdt/tst.linkpriv.ksh
|
||||
common/usdt/tst.linkunpriv.ksh
|
||||
common/usdt/tst.multiple.ksh
|
||||
common/usdt/tst.nodtrace.ksh
|
||||
common/usdt/tst.noreap.ksh
|
||||
common/usdt/tst.noreapring.ksh
|
||||
common/usdt/tst.onlyenabled.ksh
|
||||
common/usdt/tst.reap.ksh
|
||||
common/usdt/tst.reeval.ksh
|
||||
common/usdt/tst.static.ksh
|
||||
common/usdt/tst.static2.ksh
|
||||
|
|
|
|||
|
|
@ -583,6 +583,8 @@ if ($opt_x) {
|
|||
die "$PNAME: failed to open $PNAME.$$.log: $!\n"
|
||||
unless (!$opt_l || open(LOG, ">$PNAME.$$.log"));
|
||||
|
||||
$ENV{'DTRACE_DEBUG_REGSET'} = 'true';
|
||||
|
||||
if ($opt_g) {
|
||||
$ENV{'UMEM_DEBUG'} = 'default,verbose';
|
||||
$ENV{'UMEM_LOGGING'} = 'fail,contents';
|
||||
|
|
|
|||
|
|
@ -0,0 +1,35 @@
|
|||
/*
|
||||
* CDDL HEADER START
|
||||
*
|
||||
* This file and its contents are supplied under the terms of the
|
||||
* Common Development and Distribution License ("CDDL"), version 1.0.
|
||||
* You may only use this file in accordance with the terms of version
|
||||
* 1.0 of the CDDL.
|
||||
*
|
||||
* A full copy of the text of the CDDL should have accompanied this
|
||||
* source. A copy of the CDDL is also available via the Internet at
|
||||
* http://www.illumos.org/license/CDDL.
|
||||
*
|
||||
* CDDL HEADER END
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2012 by Delphix. All rights reserved.
|
||||
*/
|
||||
|
||||
#pragma D option quiet
|
||||
|
||||
/*
|
||||
* Make sure the sizes of compatible keys doesn't affect the sort order.
|
||||
*/
|
||||
|
||||
BEGIN
|
||||
{
|
||||
@[(int)1, 0] = sum(10);
|
||||
@[(uint64_t)2, 0] = sum(20);
|
||||
@[(int)3, 0] = sum(30);
|
||||
@[(uint64_t)4, 0] = sum(40);
|
||||
printa(@);
|
||||
|
||||
exit(0);
|
||||
}
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
|
||||
1 0 10
|
||||
2 0 20
|
||||
3 0 30
|
||||
4 0 40
|
||||
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
The value of i is 6
|
||||
The value of i is 18
|
||||
The value of i is 72
|
||||
The value of i is 25920
|
||||
The value of i is 935761216
|
||||
The value of i is -91738734
|
||||
The value of i is -91738729
|
||||
|
||||
|
|
@ -0,0 +1,50 @@
|
|||
/*
|
||||
* CDDL HEADER START
|
||||
*
|
||||
* This file and its contents are supplied under the terms of the
|
||||
* Common Development and Distribution License ("CDDL"), version 1.0.
|
||||
* You may only use this file in accordance with the terms of version
|
||||
* 1.0 of the CDDL.
|
||||
*
|
||||
* A full copy of the text of the CDDL should have accompanied this
|
||||
* source. A copy of the CDDL is also available via the Internet at
|
||||
* http://www.illumos.org/license/CDDL.
|
||||
*
|
||||
* CDDL HEADER END
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2012 by Delphix. All rights reserved.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Test compile-time casting between integer types of different size.
|
||||
*/
|
||||
|
||||
#pragma D option quiet
|
||||
|
||||
int64_t x;
|
||||
|
||||
BEGIN
|
||||
{
|
||||
x = (int32_t)(int16_t)0xfff0;
|
||||
printf("%16x %20d %20u\n", x, x, x);
|
||||
x = (int32_t)(uint16_t)0xfff0;
|
||||
printf("%16x %20d %20u\n", x, x, x);
|
||||
x = (uint32_t)(int16_t)0xfff0;
|
||||
printf("%16x %20d %20u\n", x, x, x);
|
||||
x = (uint32_t)(uint16_t)0xfff0;
|
||||
printf("%16x %20d %20u\n", x, x, x);
|
||||
printf("\n");
|
||||
|
||||
x = (int16_t)(int32_t)0xfff0;
|
||||
printf("%16x %20d %20u\n", x, x, x);
|
||||
x = (int16_t)(uint32_t)0xfff0;
|
||||
printf("%16x %20d %20u\n", x, x, x);
|
||||
x = (uint16_t)(int32_t)0xfff0;
|
||||
printf("%16x %20d %20u\n", x, x, x);
|
||||
x = (uint16_t)(uint32_t)0xfff0;
|
||||
printf("%16x %20d %20u\n", x, x, x);
|
||||
|
||||
exit(0);
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
fffffffffffffff0 -16 18446744073709551600
|
||||
fff0 65520 65520
|
||||
fffffff0 4294967280 4294967280
|
||||
fff0 65520 65520
|
||||
|
||||
fffffffffffffff0 -16 18446744073709551600
|
||||
fffffffffffffff0 -16 18446744073709551600
|
||||
fff0 65520 65520
|
||||
fff0 65520 65520
|
||||
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
/*
|
||||
* CDDL HEADER START
|
||||
*
|
||||
* This file and its contents are supplied under the terms of the
|
||||
* Common Development and Distribution License ("CDDL"), version 1.0.
|
||||
* You may only use this file in accordance with the terms of version
|
||||
* 1.0 of the CDDL.
|
||||
*
|
||||
* A full copy of the text of the CDDL should have accompanied this
|
||||
* source. A copy of the CDDL is also available via the Internet at
|
||||
* http://www.illumos.org/license/CDDL.
|
||||
*
|
||||
* CDDL HEADER END
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2012 by Delphix. All rights reserved.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Test narrowing at assignment.
|
||||
*/
|
||||
|
||||
#pragma D option quiet
|
||||
|
||||
uint16_t x;
|
||||
uint32_t y;
|
||||
|
||||
BEGIN
|
||||
{
|
||||
x = 0xbeefcafe;
|
||||
y = x;
|
||||
printf("%x", y); /* where's the beef? */
|
||||
|
||||
exit(0);
|
||||
}
|
||||
|
|
@ -0,0 +1 @@
|
|||
cafe
|
||||
|
|
@ -0,0 +1,52 @@
|
|||
/*
|
||||
* CDDL HEADER START
|
||||
*
|
||||
* This file and its contents are supplied under the terms of the
|
||||
* Common Development and Distribution License ("CDDL"), version 1.0.
|
||||
* You may only use this file in accordance with the terms of version
|
||||
* 1.0 of the CDDL.
|
||||
*
|
||||
* A full copy of the text of the CDDL should have accompanied this
|
||||
* source. A copy of the CDDL is also available via the Internet at
|
||||
* http://www.illumos.org/license/CDDL.
|
||||
*
|
||||
* CDDL HEADER END
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2012 by Delphix. All rights reserved.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Test execution-time casting between integer types of different size.
|
||||
*/
|
||||
|
||||
#pragma D option quiet
|
||||
|
||||
int64_t x;
|
||||
|
||||
BEGIN
|
||||
{
|
||||
z = 0xfff0;
|
||||
|
||||
x = (int32_t)(int16_t)z;
|
||||
printf("%16x %20d %20u\n", x, x, x);
|
||||
x = (int32_t)(uint16_t)z;
|
||||
printf("%16x %20d %20u\n", x, x, x);
|
||||
x = (uint32_t)(int16_t)z;
|
||||
printf("%16x %20d %20u\n", x, x, x);
|
||||
x = (uint32_t)(uint16_t)z;
|
||||
printf("%16x %20d %20u\n", x, x, x);
|
||||
printf("\n");
|
||||
|
||||
x = (int16_t)(int32_t)z;
|
||||
printf("%16x %20d %20u\n", x, x, x);
|
||||
x = (int16_t)(uint32_t)z;
|
||||
printf("%16x %20d %20u\n", x, x, x);
|
||||
x = (uint16_t)(int32_t)z;
|
||||
printf("%16x %20d %20u\n", x, x, x);
|
||||
x = (uint16_t)(uint32_t)z;
|
||||
printf("%16x %20d %20u\n", x, x, x);
|
||||
|
||||
exit(0);
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
fffffffffffffff0 -16 18446744073709551600
|
||||
fff0 65520 65520
|
||||
fffffff0 4294967280 4294967280
|
||||
fff0 65520 65520
|
||||
|
||||
fffffffffffffff0 -16 18446744073709551600
|
||||
fffffffffffffff0 -16 18446744073709551600
|
||||
fff0 65520 65520
|
||||
fff0 65520 65520
|
||||
|
||||
|
|
@ -23,26 +23,29 @@
|
|||
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
|
||||
#pragma ident "%Z%%M% %I% %E% SMI"
|
||||
/*
|
||||
* Copyright (c) 2012 by Delphix. All rights reserved.
|
||||
*/
|
||||
|
||||
/*
|
||||
* ASSERTION:
|
||||
* Positive test for fill buffer policy.
|
||||
*
|
||||
* SECTION: Buffers and Buffering/fill Policy;
|
||||
* Buffers and Buffering/Buffer Sizes;
|
||||
* Buffers and Buffering/Buffer Sizes;
|
||||
* Options and Tunables/bufsize;
|
||||
* Options and Tunables/bufpolicy;
|
||||
* Options and Tunables/statusrate
|
||||
*/
|
||||
/*
|
||||
* This is a brute-force way of testing fill buffers. We assume that each
|
||||
* printf() stores 8 bytes. Because each fill buffer is per-CPU, we must
|
||||
* fill up our buffer in one series of enablings on a single CPU.
|
||||
* This is a brute-force way of testing fill buffers. We assume that
|
||||
* each printf() stores 16 bytes (4x 32-bit words for EPID, timestamp
|
||||
* lo, timestamp hi, and the variable i). Because each fill buffer is
|
||||
* per-CPU, we must fill up our buffer in one series of enablings on a
|
||||
* single CPU.
|
||||
*/
|
||||
#pragma D option bufpolicy=fill
|
||||
#pragma D option bufsize=64
|
||||
#pragma D option bufsize=128
|
||||
#pragma D option statusrate=10ms
|
||||
#pragma D option quiet
|
||||
|
||||
|
|
|
|||
|
|
@ -23,8 +23,9 @@
|
|||
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
|
||||
#pragma ident "%Z%%M% %I% %E% SMI"
|
||||
/*
|
||||
* Copyright (c) 2012 by Delphix. All rights reserved.
|
||||
*/
|
||||
|
||||
/*
|
||||
* ASSERTION:
|
||||
|
|
@ -37,19 +38,20 @@
|
|||
*/
|
||||
|
||||
/*
|
||||
* We make some regrettable assumptions about the implementation in this test.
|
||||
* First, we assume that each entry for the printf() of an int takes _exactly_
|
||||
* eight bytes (four bytes for the EPID, four bytes for the payload). Second,
|
||||
* we assume that by allocating storage for n + 1 records, we will get exactly
|
||||
* n. Here is why: the final predicate that evaluates to false will reserve
|
||||
* space that it won't use. This act of reservation will advance the wrapped
|
||||
* offset. That record won't be subsequently used, but the wrapped offset has
|
||||
* advanced. (And in this case, that old record is clobbered by the exit()
|
||||
* anyway.) Thirdly: we rely on t_cpu/cpu_id. Finally: we rely on being
|
||||
* able to run on the CPU that we first ran on.
|
||||
* We make some regrettable assumptions about the implementation in this
|
||||
* test. First, we assume that each entry for the printf() of an int
|
||||
* takes _exactly_ 16 bytes (4 bytes for the EPID, 8 bytes for the
|
||||
* timestamp, 4 bytes for the payload). Second, we assume that by
|
||||
* allocating storage for n + 1 records, we will get exactly n. Here is
|
||||
* why: the final predicate that evaluates to false will reserve space
|
||||
* that it won't use. This act of reservation will advance the wrapped
|
||||
* offset. That record won't be subsequently used, but the wrapped
|
||||
* offset has advanced. (And in this case, that old record is clobbered
|
||||
* by the exit() anyway.) Thirdly: we rely on t_cpu/cpu_id. Finally:
|
||||
* we rely on being able to run on the CPU that we first ran on.
|
||||
*/
|
||||
#pragma D option bufpolicy=ring
|
||||
#pragma D option bufsize=40
|
||||
#pragma D option bufsize=80
|
||||
#pragma D option quiet
|
||||
|
||||
int n;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,41 @@
|
|||
/*
|
||||
* CDDL HEADER START
|
||||
*
|
||||
* This file and its contents are supplied under the terms of the
|
||||
* Common Development and Distribution License ("CDDL"), version 1.0.
|
||||
* You may only use this file in accordance with the terms of version
|
||||
* 1.0 of the CDDL.
|
||||
*
|
||||
* A full copy of the text of the CDDL should have accompanied this
|
||||
* source. A copy of the CDDL is also available via the Internet at
|
||||
* http://www.illumos.org/license/CDDL.
|
||||
*
|
||||
* CDDL HEADER END
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2012 by Delphix. All rights reserved.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Compile some code that requires exactly 9 registers. This should run out
|
||||
* of registers.
|
||||
*
|
||||
* Changes to the code generator might cause this test to succeeed in which
|
||||
* case the code should be changed to another sequence that exhausts the
|
||||
* available internal registers.
|
||||
*
|
||||
* Note that this and err.baddif.d should be kept in sync.
|
||||
*/
|
||||
|
||||
BEGIN
|
||||
{
|
||||
a = 4;
|
||||
trace((a + a) * ((a + a) * ((a + a) * ((a + a) * ((a + a) *
|
||||
((a + a) * (a + a)))))));
|
||||
}
|
||||
|
||||
BEGIN
|
||||
{
|
||||
exit(0);
|
||||
}
|
||||
|
|
@ -0,0 +1,44 @@
|
|||
/*
|
||||
* CDDL HEADER START
|
||||
*
|
||||
* This file and its contents are supplied under the terms of the
|
||||
* Common Development and Distribution License ("CDDL"), version 1.0.
|
||||
* You may only use this file in accordance with the terms of version
|
||||
* 1.0 of the CDDL.
|
||||
*
|
||||
* A full copy of the text of the CDDL should have accompanied this
|
||||
* source. A copy of the CDDL is also available via the Internet at
|
||||
* http://www.illumos.org/license/CDDL.
|
||||
*
|
||||
* CDDL HEADER END
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2012 by Delphix. All rights reserved.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Compile some code that requires exactly 9 registers. This should generate
|
||||
* invalid DIF because the kernel will flag the fact that we're using more
|
||||
* registers than are available internally.
|
||||
*
|
||||
* Changes to the code generator might cause this test to succeeed in which
|
||||
* case the code should be changed to another sequence that exhausts the
|
||||
* available internal registers.
|
||||
*
|
||||
* Note that this and err.D_NOREG.noreg.d should be kept in sync.
|
||||
*/
|
||||
|
||||
#pragma D option iregs=9
|
||||
|
||||
BEGIN
|
||||
{
|
||||
a = 4;
|
||||
trace((a + a) * ((a + a) * ((a + a) * ((a + a) * ((a + a) *
|
||||
((a + a) * (a + a)))))));
|
||||
}
|
||||
|
||||
BEGIN
|
||||
{
|
||||
exit(0);
|
||||
}
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
/*
|
||||
* CDDL HEADER START
|
||||
*
|
||||
* The contents of this file are subject to the terms of the
|
||||
* Common Development and Distribution License (the "License").
|
||||
* You may not use this file except in compliance with the License.
|
||||
*
|
||||
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||
* or http://www.opensolaris.org/os/licensing.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
*
|
||||
* When distributing Covered Code, include this CDDL HEADER in each
|
||||
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||
* If applicable, add the following below this CDDL HEADER, with the
|
||||
* fields enclosed by brackets "[]" replaced with your own identifying
|
||||
* information: Portions Copyright [yyyy] [name of copyright owner]
|
||||
*
|
||||
* CDDL HEADER END
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2011, Joyent, Inc. All rights reserved.
|
||||
*/
|
||||
|
||||
BEGIN
|
||||
{
|
||||
trace(tolower(2152006));
|
||||
exit(1);
|
||||
}
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
/*
|
||||
* CDDL HEADER START
|
||||
*
|
||||
* The contents of this file are subject to the terms of the
|
||||
* Common Development and Distribution License (the "License").
|
||||
* You may not use this file except in compliance with the License.
|
||||
*
|
||||
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||
* or http://www.opensolaris.org/os/licensing.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
*
|
||||
* When distributing Covered Code, include this CDDL HEADER in each
|
||||
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||
* If applicable, add the following below this CDDL HEADER, with the
|
||||
* fields enclosed by brackets "[]" replaced with your own identifying
|
||||
* information: Portions Copyright [yyyy] [name of copyright owner]
|
||||
*
|
||||
* CDDL HEADER END
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2011, Joyent, Inc. All rights reserved.
|
||||
*/
|
||||
|
||||
BEGIN
|
||||
{
|
||||
trace(toupper(timestamp));
|
||||
exit(1);
|
||||
}
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
/*
|
||||
* CDDL HEADER START
|
||||
*
|
||||
* The contents of this file are subject to the terms of the
|
||||
* Common Development and Distribution License (the "License").
|
||||
* You may not use this file except in compliance with the License.
|
||||
*
|
||||
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||
* or http://www.opensolaris.org/os/licensing.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
*
|
||||
* When distributing Covered Code, include this CDDL HEADER in each
|
||||
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||
* If applicable, add the following below this CDDL HEADER, with the
|
||||
* fields enclosed by brackets "[]" replaced with your own identifying
|
||||
* information: Portions Copyright [yyyy] [name of copyright owner]
|
||||
*
|
||||
* CDDL HEADER END
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2011, Joyent, Inc. All rights reserved.
|
||||
*/
|
||||
|
||||
BEGIN
|
||||
{
|
||||
trace(tolower());
|
||||
exit(1);
|
||||
}
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
/*
|
||||
* CDDL HEADER START
|
||||
*
|
||||
* The contents of this file are subject to the terms of the
|
||||
* Common Development and Distribution License (the "License").
|
||||
* You may not use this file except in compliance with the License.
|
||||
*
|
||||
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||
* or http://www.opensolaris.org/os/licensing.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
*
|
||||
* When distributing Covered Code, include this CDDL HEADER in each
|
||||
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||
* If applicable, add the following below this CDDL HEADER, with the
|
||||
* fields enclosed by brackets "[]" replaced with your own identifying
|
||||
* information: Portions Copyright [yyyy] [name of copyright owner]
|
||||
*
|
||||
* CDDL HEADER END
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2011, Joyent, Inc. All rights reserved.
|
||||
*/
|
||||
|
||||
BEGIN
|
||||
{
|
||||
trace(tolower("dory", "eel", "roughy"));
|
||||
exit(1);
|
||||
}
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
/*
|
||||
* CDDL HEADER START
|
||||
*
|
||||
* The contents of this file are subject to the terms of the
|
||||
* Common Development and Distribution License (the "License").
|
||||
* You may not use this file except in compliance with the License.
|
||||
*
|
||||
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||
* or http://www.opensolaris.org/os/licensing.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
*
|
||||
* When distributing Covered Code, include this CDDL HEADER in each
|
||||
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||
* If applicable, add the following below this CDDL HEADER, with the
|
||||
* fields enclosed by brackets "[]" replaced with your own identifying
|
||||
* information: Portions Copyright [yyyy] [name of copyright owner]
|
||||
*
|
||||
* CDDL HEADER END
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2011, Joyent, Inc. All rights reserved.
|
||||
*/
|
||||
|
||||
BEGIN
|
||||
{
|
||||
trace(toupper());
|
||||
exit(1);
|
||||
}
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
/*
|
||||
* CDDL HEADER START
|
||||
*
|
||||
* The contents of this file are subject to the terms of the
|
||||
* Common Development and Distribution License (the "License").
|
||||
* You may not use this file except in compliance with the License.
|
||||
*
|
||||
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||
* or http://www.opensolaris.org/os/licensing.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
*
|
||||
* When distributing Covered Code, include this CDDL HEADER in each
|
||||
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||
* If applicable, add the following below this CDDL HEADER, with the
|
||||
* fields enclosed by brackets "[]" replaced with your own identifying
|
||||
* information: Portions Copyright [yyyy] [name of copyright owner]
|
||||
*
|
||||
* CDDL HEADER END
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2011, Joyent, Inc. All rights reserved.
|
||||
*/
|
||||
|
||||
BEGIN
|
||||
{
|
||||
trace(tolower("haino", "tylo"));
|
||||
exit(1);
|
||||
}
|
||||
|
|
@ -20,38 +20,61 @@
|
|||
*/
|
||||
|
||||
/*
|
||||
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
|
||||
#pragma ident "%Z%%M% %I% %E% SMI"
|
||||
|
||||
/*
|
||||
* ASSERTION:
|
||||
* Complex expressions.
|
||||
* Call complex expressions and make sure test succeeds.
|
||||
* Match expected output in tst.complex.d.out
|
||||
*
|
||||
* SECTION: Types, Operators, and Expressions/Arithmetic Operators
|
||||
*
|
||||
* Copyright (c) 2011, Joyent, Inc. All rights reserved.
|
||||
*/
|
||||
|
||||
#pragma D option quiet
|
||||
|
||||
int64_t val[int];
|
||||
|
||||
BEGIN
|
||||
{
|
||||
base = -2;
|
||||
i = 0;
|
||||
val[i++] = -10;
|
||||
val[i++] = -1;
|
||||
val[i++] = 0;
|
||||
val[i++] = 10;
|
||||
val[i++] = 100;
|
||||
val[i++] = 1000;
|
||||
val[i++] = (1LL << 62);
|
||||
maxval = i;
|
||||
i = 0;
|
||||
i = i++ + ++i;
|
||||
printf("The value of i is %d\n", i);
|
||||
i = i-- - --i;
|
||||
printf("The value of i is %d\n", i);
|
||||
i = i-- + ++i;
|
||||
printf("The value of i is %d\n", i);
|
||||
i += i++ + -- i + ++i - ++i * i ;
|
||||
printf("The value of i is %d\n", i);
|
||||
i -= i++ * 3;
|
||||
printf("The value of i is %d\n", i);
|
||||
i = i++/i--+i++-++i-++i;
|
||||
printf("The value of i is %d\n", i);
|
||||
exit (0);
|
||||
}
|
||||
|
||||
tick-1ms
|
||||
/i < maxval/
|
||||
{
|
||||
printf("base %2d of %20d: ", base, val[i]);
|
||||
}
|
||||
|
||||
tick-1ms
|
||||
/i < maxval/
|
||||
{
|
||||
printf(" %s\n", lltostr(val[i], base));
|
||||
}
|
||||
|
||||
ERROR
|
||||
{
|
||||
printf(" <error>\n");
|
||||
}
|
||||
|
||||
tick-1ms
|
||||
/i < maxval/
|
||||
{
|
||||
i++;
|
||||
}
|
||||
|
||||
tick-1ms
|
||||
/i == maxval/
|
||||
{
|
||||
i = 0;
|
||||
base++;
|
||||
}
|
||||
|
||||
tick-1ms
|
||||
/base > 40/
|
||||
{
|
||||
exit(0);
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,302 @@
|
|||
base -2 of -10: <error>
|
||||
base -2 of -1: <error>
|
||||
base -2 of 0: <error>
|
||||
base -2 of 10: <error>
|
||||
base -2 of 100: <error>
|
||||
base -2 of 1000: <error>
|
||||
base -2 of 4611686018427387904: <error>
|
||||
base -1 of -10: <error>
|
||||
base -1 of -1: <error>
|
||||
base -1 of 0: <error>
|
||||
base -1 of 10: <error>
|
||||
base -1 of 100: <error>
|
||||
base -1 of 1000: <error>
|
||||
base -1 of 4611686018427387904: <error>
|
||||
base 0 of -10: <error>
|
||||
base 0 of -1: <error>
|
||||
base 0 of 0: <error>
|
||||
base 0 of 10: <error>
|
||||
base 0 of 100: <error>
|
||||
base 0 of 1000: <error>
|
||||
base 0 of 4611686018427387904: <error>
|
||||
base 1 of -10: <error>
|
||||
base 1 of -1: <error>
|
||||
base 1 of 0: <error>
|
||||
base 1 of 10: <error>
|
||||
base 1 of 100: <error>
|
||||
base 1 of 1000: <error>
|
||||
base 1 of 4611686018427387904: <error>
|
||||
base 2 of -10: 1111111111111111111111111111111111111111111111111111111111110110
|
||||
base 2 of -1: 1111111111111111111111111111111111111111111111111111111111111111
|
||||
base 2 of 0: 0
|
||||
base 2 of 10: 1010
|
||||
base 2 of 100: 1100100
|
||||
base 2 of 1000: 1111101000
|
||||
base 2 of 4611686018427387904: 100000000000000000000000000000000000000000000000000000000000000
|
||||
base 3 of -10: 11112220022122120101211020120210210211120
|
||||
base 3 of -1: 11112220022122120101211020120210210211220
|
||||
base 3 of 0: 0
|
||||
base 3 of 10: 101
|
||||
base 3 of 100: 10201
|
||||
base 3 of 1000: 1101001
|
||||
base 3 of 4611686018427387904: 1010201120122220002201001122110012110111
|
||||
base 4 of -10: 33333333333333333333333333333312
|
||||
base 4 of -1: 33333333333333333333333333333333
|
||||
base 4 of 0: 0
|
||||
base 4 of 10: 22
|
||||
base 4 of 100: 1210
|
||||
base 4 of 1000: 33220
|
||||
base 4 of 4611686018427387904: 10000000000000000000000000000000
|
||||
base 5 of -10: 2214220303114400424121122411
|
||||
base 5 of -1: 2214220303114400424121122430
|
||||
base 5 of 0: 0
|
||||
base 5 of 10: 20
|
||||
base 5 of 100: 400
|
||||
base 5 of 1000: 13000
|
||||
base 5 of 4611686018427387904: 302141200402211214402403104
|
||||
base 6 of -10: 3520522010102100444244410
|
||||
base 6 of -1: 3520522010102100444244423
|
||||
base 6 of 0: 0
|
||||
base 6 of 10: 14
|
||||
base 6 of 100: 244
|
||||
base 6 of 1000: 4344
|
||||
base 6 of 4611686018427387904: 550120301313313111041104
|
||||
base 7 of -10: 45012021522523134134556
|
||||
base 7 of -1: 45012021522523134134601
|
||||
base 7 of 0: 0
|
||||
base 7 of 10: 13
|
||||
base 7 of 100: 202
|
||||
base 7 of 1000: 2626
|
||||
base 7 of 4611686018427387904: 11154003640456024361134
|
||||
base 8 of -10: 01777777777777777777766
|
||||
base 8 of -1: 01777777777777777777777
|
||||
base 8 of 0: 0
|
||||
base 8 of 10: 012
|
||||
base 8 of 100: 0144
|
||||
base 8 of 1000: 01750
|
||||
base 8 of 4611686018427387904: 0400000000000000000000
|
||||
base 9 of -10: 145808576354216723746
|
||||
base 9 of -1: 145808576354216723756
|
||||
base 9 of 0: 0
|
||||
base 9 of 10: 11
|
||||
base 9 of 100: 121
|
||||
base 9 of 1000: 1331
|
||||
base 9 of 4611686018427387904: 33646586081048405414
|
||||
base 10 of -10: -10
|
||||
base 10 of -1: -1
|
||||
base 10 of 0: 0
|
||||
base 10 of 10: 10
|
||||
base 10 of 100: 100
|
||||
base 10 of 1000: 1000
|
||||
base 10 of 4611686018427387904: 4611686018427387904
|
||||
base 11 of -10: 335500516a429071276
|
||||
base 11 of -1: 335500516a429071284
|
||||
base 11 of 0: 0
|
||||
base 11 of 10: a
|
||||
base 11 of 100: 91
|
||||
base 11 of 1000: 82a
|
||||
base 11 of 4611686018427387904: 9140013181078458a4
|
||||
base 12 of -10: 839365134a2a240706
|
||||
base 12 of -1: 839365134a2a240713
|
||||
base 12 of 0: 0
|
||||
base 12 of 10: a
|
||||
base 12 of 100: 84
|
||||
base 12 of 1000: 6b4
|
||||
base 12 of 4611686018427387904: 20b3a733a268670194
|
||||
base 13 of -10: 219505a9511a867b66
|
||||
base 13 of -1: 219505a9511a867b72
|
||||
base 13 of 0: 0
|
||||
base 13 of 10: a
|
||||
base 13 of 100: 79
|
||||
base 13 of 1000: 5bc
|
||||
base 13 of 4611686018427387904: 6c1349246a2881c84
|
||||
base 14 of -10: 8681049adb03db166
|
||||
base 14 of -1: 8681049adb03db171
|
||||
base 14 of 0: 0
|
||||
base 14 of 10: a
|
||||
base 14 of 100: 72
|
||||
base 14 of 1000: 516
|
||||
base 14 of 4611686018427387904: 219038263637dd3c4
|
||||
base 15 of -10: 2c1d56b648c6cd106
|
||||
base 15 of -1: 2c1d56b648c6cd110
|
||||
base 15 of 0: 0
|
||||
base 15 of 10: a
|
||||
base 15 of 100: 6a
|
||||
base 15 of 1000: 46a
|
||||
base 15 of 4611686018427387904: a7e8ce189a933404
|
||||
base 16 of -10: 0xfffffffffffffff6
|
||||
base 16 of -1: 0xffffffffffffffff
|
||||
base 16 of 0: 0x0
|
||||
base 16 of 10: 0xa
|
||||
base 16 of 100: 0x64
|
||||
base 16 of 1000: 0x3e8
|
||||
base 16 of 4611686018427387904: 0x4000000000000000
|
||||
base 17 of -10: 67979g60f5428008
|
||||
base 17 of -1: 67979g60f5428010
|
||||
base 17 of 0: 0
|
||||
base 17 of 10: a
|
||||
base 17 of 100: 5f
|
||||
base 17 of 1000: 37e
|
||||
base 17 of 4611686018427387904: 1a6a6ca03e10a88d
|
||||
base 18 of -10: 2d3fgb0b9cg4bd26
|
||||
base 18 of -1: 2d3fgb0b9cg4bd2f
|
||||
base 18 of 0: 0
|
||||
base 18 of 10: a
|
||||
base 18 of 100: 5a
|
||||
base 18 of 1000: 31a
|
||||
base 18 of 4611686018427387904: c588bdbfgd12ge4
|
||||
base 19 of -10: 141c8786h1ccaag7
|
||||
base 19 of -1: 141c8786h1ccaagg
|
||||
base 19 of 0: 0
|
||||
base 19 of 10: a
|
||||
base 19 of 100: 55
|
||||
base 19 of 1000: 2ec
|
||||
base 19 of 4611686018427387904: 5ecbb6fi9h7ggi9
|
||||
base 20 of -10: b53bjh07be4dj06
|
||||
base 20 of -1: b53bjh07be4dj0f
|
||||
base 20 of 0: 0
|
||||
base 20 of 10: a
|
||||
base 20 of 100: 50
|
||||
base 20 of 1000: 2a0
|
||||
base 20 of 4611686018427387904: 2g5hjj51hib39f4
|
||||
base 21 of -10: 5e8g4ggg7g56di6
|
||||
base 21 of -1: 5e8g4ggg7g56dif
|
||||
base 21 of 0: 0
|
||||
base 21 of 10: a
|
||||
base 21 of 100: 4g
|
||||
base 21 of 1000: 25d
|
||||
base 21 of 4611686018427387904: 18hjgjjjhebh8f4
|
||||
base 22 of -10: 2l4lf104353j8k6
|
||||
base 22 of -1: 2l4lf104353j8kf
|
||||
base 22 of 0: 0
|
||||
base 22 of 10: a
|
||||
base 22 of 100: 4c
|
||||
base 22 of 1000: 21a
|
||||
base 22 of 4611686018427387904: g6g95gc0hha7g4
|
||||
base 23 of -10: 1ddh88h2782i50j
|
||||
base 23 of -1: 1ddh88h2782i515
|
||||
base 23 of 0: 0
|
||||
base 23 of 10: a
|
||||
base 23 of 100: 48
|
||||
base 23 of 1000: 1kb
|
||||
base 23 of 4611686018427387904: 93a22467dc4chd
|
||||
base 24 of -10: l12ee5fn0ji1i6
|
||||
base 24 of -1: l12ee5fn0ji1if
|
||||
base 24 of 0: 0
|
||||
base 24 of 10: a
|
||||
base 24 of 100: 44
|
||||
base 24 of 1000: 1hg
|
||||
base 24 of 4611686018427387904: 566ffd9ni4mcag
|
||||
base 25 of -10: c9c336o0mlb7e6
|
||||
base 25 of -1: c9c336o0mlb7ef
|
||||
base 25 of 0: 0
|
||||
base 25 of 10: a
|
||||
base 25 of 100: 40
|
||||
base 25 of 1000: 1f0
|
||||
base 25 of 4611686018427387904: 32970kc6bo2kg4
|
||||
base 26 of -10: 7b7n2pcniokcg6
|
||||
base 26 of -1: 7b7n2pcniokcgf
|
||||
base 26 of 0: 0
|
||||
base 26 of 10: a
|
||||
base 26 of 100: 3m
|
||||
base 26 of 1000: 1cc
|
||||
base 26 of 4611686018427387904: 1m8c769io65344
|
||||
base 27 of -10: 4eo8hfam6fllmf
|
||||
base 27 of -1: 4eo8hfam6fllmo
|
||||
base 27 of 0: 0
|
||||
base 27 of 10: a
|
||||
base 27 of 100: 3j
|
||||
base 27 of 1000: 1a1
|
||||
base 27 of 4611686018427387904: 13jfho2j1hc5cd
|
||||
base 28 of -10: 2nc6j26l66rho6
|
||||
base 28 of -1: 2nc6j26l66rhof
|
||||
base 28 of 0: 0
|
||||
base 28 of 10: a
|
||||
base 28 of 100: 3g
|
||||
base 28 of 1000: 17k
|
||||
base 28 of 4611686018427387904: jo1ilfj8fkpd4
|
||||
base 29 of -10: 1n3rsh11f098re
|
||||
base 29 of -1: 1n3rsh11f098rn
|
||||
base 29 of 0: 0
|
||||
base 29 of 10: a
|
||||
base 29 of 100: 3d
|
||||
base 29 of 1000: 15e
|
||||
base 29 of 4611686018427387904: d0slim0b029e6
|
||||
base 30 of -10: 14l9lkmo30o406
|
||||
base 30 of -1: 14l9lkmo30o40f
|
||||
base 30 of 0: 0
|
||||
base 30 of 10: a
|
||||
base 30 of 100: 3a
|
||||
base 30 of 1000: 13a
|
||||
base 30 of 4611686018427387904: 8k9rrkl0ml104
|
||||
base 31 of -10: nd075ib45k866
|
||||
base 31 of -1: nd075ib45k86f
|
||||
base 31 of 0: 0
|
||||
base 31 of 10: a
|
||||
base 31 of 100: 37
|
||||
base 31 of 1000: 118
|
||||
base 31 of 4611686018427387904: 5qfh94i8okhh4
|
||||
base 32 of -10: fvvvvvvvvvvvm
|
||||
base 32 of -1: fvvvvvvvvvvvv
|
||||
base 32 of 0: 0
|
||||
base 32 of 10: a
|
||||
base 32 of 100: 34
|
||||
base 32 of 1000: v8
|
||||
base 32 of 4611686018427387904: 4000000000000
|
||||
base 33 of -10: b1w8p7j5q9r66
|
||||
base 33 of -1: b1w8p7j5q9r6f
|
||||
base 33 of 0: 0
|
||||
base 33 of 10: a
|
||||
base 33 of 100: 31
|
||||
base 33 of 1000: ua
|
||||
base 33 of 4611686018427387904: 2p826a4q6ivi4
|
||||
base 34 of -10: 7orp63sh4dph8
|
||||
base 34 of -1: 7orp63sh4dphh
|
||||
base 34 of 0: 0
|
||||
base 34 of 10: a
|
||||
base 34 of 100: 2w
|
||||
base 34 of 1000: te
|
||||
base 34 of 4611686018427387904: 1vnvr0wl9ketu
|
||||
base 35 of -10: 5g24a25twkwf6
|
||||
base 35 of -1: 5g24a25twkwff
|
||||
base 35 of 0: 0
|
||||
base 35 of 10: a
|
||||
base 35 of 100: 2u
|
||||
base 35 of 1000: sk
|
||||
base 35 of 4611686018427387904: 1cqrb9a7gvgu4
|
||||
base 36 of -10: 3w5e11264sgs6
|
||||
base 36 of -1: 3w5e11264sgsf
|
||||
base 36 of 0: 0
|
||||
base 36 of 10: a
|
||||
base 36 of 100: 2s
|
||||
base 36 of 1000: rs
|
||||
base 36 of 4611686018427387904: z1ci99jj7474
|
||||
base 37 of -10: <error>
|
||||
base 37 of -1: <error>
|
||||
base 37 of 0: <error>
|
||||
base 37 of 10: <error>
|
||||
base 37 of 100: <error>
|
||||
base 37 of 1000: <error>
|
||||
base 37 of 4611686018427387904: <error>
|
||||
base 38 of -10: <error>
|
||||
base 38 of -1: <error>
|
||||
base 38 of 0: <error>
|
||||
base 38 of 10: <error>
|
||||
base 38 of 100: <error>
|
||||
base 38 of 1000: <error>
|
||||
base 38 of 4611686018427387904: <error>
|
||||
base 39 of -10: <error>
|
||||
base 39 of -1: <error>
|
||||
base 39 of 0: <error>
|
||||
base 39 of 10: <error>
|
||||
base 39 of 100: <error>
|
||||
base 39 of 1000: <error>
|
||||
base 39 of 4611686018427387904: <error>
|
||||
base 40 of -10: <error>
|
||||
base 40 of -1: <error>
|
||||
base 40 of 0: <error>
|
||||
base 40 of 10: <error>
|
||||
base 40 of 100: <error>
|
||||
base 40 of 1000: <error>
|
||||
base 40 of 4611686018427387904: <error>
|
||||
|
||||
|
|
@ -20,42 +20,47 @@
|
|||
*/
|
||||
|
||||
/*
|
||||
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
|
||||
#pragma ident "%Z%%M% %I% %E% SMI"
|
||||
|
||||
/*
|
||||
* ASSERTION:
|
||||
* The D inline translation mechanism can be used to facilitate stable
|
||||
* translations.
|
||||
*
|
||||
* SECTION: Translators/ Translator Declarations
|
||||
* SECTION: Translators/ Translate Operator
|
||||
* SECTION: Translators/Stable Translations
|
||||
*
|
||||
* NOTES: Uncomment the pragma that explicitly resets the attributes of
|
||||
* myinfo identifier to Stable/Stable/Common from Private/Private/Unknown.
|
||||
* Run the program with and without the comments as:
|
||||
* /usr/sbin/dtrace -vs man.TestTransStability.d
|
||||
* Copyright (c) 2011, Joyent, Inc. All rights reserved.
|
||||
*/
|
||||
|
||||
#pragma D option quiet
|
||||
|
||||
inline lwpsinfo_t *myinfo = xlate < lwpsinfo_t *> (curthread);
|
||||
|
||||
/*
|
||||
#pragma D attributes Stable/Stable/Common myinfo
|
||||
*/
|
||||
|
||||
BEGIN
|
||||
{
|
||||
trace(myinfo->pr_flag);
|
||||
exit(0);
|
||||
i = 0;
|
||||
|
||||
input[i] = "ahi";
|
||||
expected[i++] = "ahi";
|
||||
|
||||
input[i] = "MaHi!";
|
||||
expected[i++] = "mahi!";
|
||||
|
||||
input[i] = " Nase-5";
|
||||
expected[i++] = " nase-5";
|
||||
|
||||
input[i] = "!@#$%";
|
||||
expected[i++] = "!@#$%";
|
||||
|
||||
i = 0;
|
||||
}
|
||||
|
||||
ERROR
|
||||
tick-1ms
|
||||
/input[i] != NULL && (this->out = tolower(input[i])) != expected[i]/
|
||||
{
|
||||
printf("expected tolower(\"%s\") to be \"%s\"; found \"%s\"\n",
|
||||
input[i], expected[i], this->out);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
tick-1ms
|
||||
/input[i] != NULL/
|
||||
{
|
||||
printf("tolower(\"%s\") is \"%s\", as expected\n",
|
||||
input[i], expected[i]);
|
||||
}
|
||||
|
||||
tick-1ms
|
||||
/input[i++] == NULL/
|
||||
{
|
||||
exit(0);
|
||||
}
|
||||
|
|
@ -0,0 +1,66 @@
|
|||
/*
|
||||
* CDDL HEADER START
|
||||
*
|
||||
* The contents of this file are subject to the terms of the
|
||||
* Common Development and Distribution License (the "License").
|
||||
* You may not use this file except in compliance with the License.
|
||||
*
|
||||
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||
* or http://www.opensolaris.org/os/licensing.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
*
|
||||
* When distributing Covered Code, include this CDDL HEADER in each
|
||||
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||
* If applicable, add the following below this CDDL HEADER, with the
|
||||
* fields enclosed by brackets "[]" replaced with your own identifying
|
||||
* information: Portions Copyright [yyyy] [name of copyright owner]
|
||||
*
|
||||
* CDDL HEADER END
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2011, Joyent, Inc. All rights reserved.
|
||||
*/
|
||||
|
||||
#pragma D option quiet
|
||||
|
||||
BEGIN
|
||||
{
|
||||
i = 0;
|
||||
|
||||
input[i] = "ahi";
|
||||
expected[i++] = "AHI";
|
||||
|
||||
input[i] = "MaHi!";
|
||||
expected[i++] = "MAHI!";
|
||||
|
||||
input[i] = " dace-9";
|
||||
expected[i++] = " DACE-9";
|
||||
|
||||
input[i] = "!@#$%";
|
||||
expected[i++] = "!@#$%";
|
||||
|
||||
i = 0;
|
||||
}
|
||||
|
||||
tick-1ms
|
||||
/input[i] != NULL && (this->out = toupper(input[i])) != expected[i]/
|
||||
{
|
||||
printf("expected toupper(\"%s\") to be \"%s\"; found \"%s\"\n",
|
||||
input[i], expected[i], this->out);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
tick-1ms
|
||||
/input[i] != NULL/
|
||||
{
|
||||
printf("toupper(\"%s\") is \"%s\", as expected\n",
|
||||
input[i], expected[i]);
|
||||
}
|
||||
|
||||
tick-1ms
|
||||
/input[i++] == NULL/
|
||||
{
|
||||
exit(0);
|
||||
}
|
||||
|
|
@ -24,7 +24,9 @@
|
|||
# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
|
||||
# Use is subject to license terms.
|
||||
#
|
||||
# ident "%Z%%M% %I% %E% SMI"
|
||||
|
||||
#
|
||||
# Copyright (c) 2012 by Delphix. All rights reserved.
|
||||
#
|
||||
|
||||
if [ $# != 1 ]; then
|
||||
|
|
@ -49,13 +51,13 @@ tick-1s
|
|||
tick-1s
|
||||
/(i % 2) == 0/
|
||||
{
|
||||
system("dtrace -c date -ln 'pid\$target::main:entry' >/dev/null");
|
||||
system("dtrace -c date -n 'pid\$target::main:entry' >/dev/null");
|
||||
}
|
||||
|
||||
tick-1s
|
||||
/(i % 2) == 1/
|
||||
{
|
||||
system("dtrace -c date -ln 'pid\$target::main:return' >/dev/null");
|
||||
system("dtrace -c date -n 'pid\$target::main:return' >/dev/null");
|
||||
}
|
||||
EOF
|
||||
|
||||
|
|
|
|||
|
|
@ -24,7 +24,9 @@
|
|||
* Use is subject to license terms.
|
||||
*/
|
||||
|
||||
#pragma ident "%Z%%M% %I% %E% SMI"
|
||||
/*
|
||||
* Copyright (c) 2012 by Delphix. All rights reserved.
|
||||
*/
|
||||
|
||||
/*
|
||||
* ASSERTION:
|
||||
|
|
@ -32,44 +34,51 @@
|
|||
* a runtime error.
|
||||
*
|
||||
* SECTION: Pointers and Arrays/Generic Pointers
|
||||
*
|
||||
* NOTES:
|
||||
* This test doesn't apply to x86; for the time being, we're working
|
||||
* around this with the preprocessor.
|
||||
*/
|
||||
|
||||
#pragma D option quiet
|
||||
|
||||
int array[3];
|
||||
uintptr_t uptr;
|
||||
#if defined(__i386) || defined(__amd64)
|
||||
#define __x86 1
|
||||
#endif
|
||||
|
||||
int array[2];
|
||||
char *ptr;
|
||||
int *p;
|
||||
int *q;
|
||||
int *r;
|
||||
|
||||
BEGIN
|
||||
{
|
||||
#ifdef __i386
|
||||
array[0] = 0x12345678;
|
||||
array[1] = 0xabcdefff;
|
||||
|
||||
ptr = (char *) &array[0];
|
||||
|
||||
p = (int *) (ptr);
|
||||
q = (int *) (ptr + 2);
|
||||
r = (int *) (ptr + 3);
|
||||
|
||||
printf("*p: 0x%x\n", *p);
|
||||
printf("*q: 0x%x\n", *q);
|
||||
printf("*r: 0x%x\n", *r);
|
||||
|
||||
/*
|
||||
* On x86, the above unaligned memory accesses are allowed and should
|
||||
* not result in the ERROR probe firing.
|
||||
*/
|
||||
#ifdef __x86
|
||||
exit(1);
|
||||
#else
|
||||
array[0] = 20;
|
||||
array[1] = 40;
|
||||
array[2] = 80;
|
||||
|
||||
uptr = (uintptr_t) &array[0];
|
||||
|
||||
p = (int *) (uptr);
|
||||
q = (int *) (uptr + 2);
|
||||
r = (int *) (uptr + 3);
|
||||
|
||||
printf("array[0]: %d\t*p: %d\n", array[0], *p);
|
||||
printf("array[1]: %d\t*q: %d\n", array[1], *q);
|
||||
printf("array[2]: %d\t*r: %d\n", array[2], *r);
|
||||
|
||||
exit(0);
|
||||
#endif
|
||||
}
|
||||
|
||||
ERROR
|
||||
{
|
||||
#ifdef __x86
|
||||
exit(0);
|
||||
#else
|
||||
exit(1);
|
||||
#endif
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,28 @@
|
|||
/*
|
||||
* CDDL HEADER START
|
||||
*
|
||||
* This file and its contents are supplied under the terms of the
|
||||
* Common Development and Distribution License ("CDDL"), version 1.0.
|
||||
* You may only use this file in accordance with the terms of version
|
||||
* 1.0 of the CDDL.
|
||||
*
|
||||
* A full copy of the text of the CDDL should have accompanied this
|
||||
* source. A copy of the CDDL is also available via the Internet at
|
||||
* http://www.illumos.org/license/CDDL.
|
||||
*
|
||||
* CDDL HEADER END
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2012 by Delphix. All rights reserved.
|
||||
*/
|
||||
|
||||
BEGIN
|
||||
{
|
||||
*((int *)alloca(4)) = 1;
|
||||
}
|
||||
|
||||
BEGIN
|
||||
{
|
||||
exit(0);
|
||||
}
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
/*
|
||||
* CDDL HEADER START
|
||||
*
|
||||
* This file and its contents are supplied under the terms of the
|
||||
* Common Development and Distribution License ("CDDL"), version 1.0.
|
||||
* You may only use this file in accordance with the terms of version
|
||||
* 1.0 of the CDDL.
|
||||
*
|
||||
* A full copy of the text of the CDDL should have accompanied this
|
||||
* source. A copy of the CDDL is also available via the Internet at
|
||||
* http://www.illumos.org/license/CDDL.
|
||||
*
|
||||
* CDDL HEADER END
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2012 by Delphix. All rights reserved.
|
||||
*/
|
||||
|
||||
BEGIN
|
||||
{
|
||||
this->a = alloca(4);
|
||||
*((int *)this->a) = 1;
|
||||
}
|
||||
|
||||
BEGIN
|
||||
{
|
||||
exit(0);
|
||||
}
|
||||
|
|
@ -0,0 +1,106 @@
|
|||
#!/bin/ksh -p
|
||||
#
|
||||
# CDDL HEADER START
|
||||
#
|
||||
# This file and its contents are supplied under the terms of the
|
||||
# Common Development and Distribution License ("CDDL"), version 1.0.
|
||||
# You may only use this file in accordance with the terms of version
|
||||
# 1.0 of the CDDL.
|
||||
#
|
||||
# A full copy of the text of the CDDL should have accompanied this
|
||||
# source. A copy of the CDDL is also available via the Internet at
|
||||
# http://www.illumos.org/license/CDDL.
|
||||
#
|
||||
# CDDL HEADER END
|
||||
#
|
||||
|
||||
#
|
||||
# Copyright (c) 2012 by Delphix. All rights reserved.
|
||||
#
|
||||
|
||||
############################################################################
|
||||
# ASSERTION:
|
||||
# temporal option causes output to be sorted
|
||||
#
|
||||
# SECTION: Pragma
|
||||
#
|
||||
# NOTES: The temporal option has no effect on a single-CPU system, so
|
||||
# this needs to be run on a multi-CPU system to effectively test the
|
||||
# temporal option.
|
||||
#
|
||||
############################################################################
|
||||
|
||||
if [ $# != 1 ]; then
|
||||
echo expected one argument: '<'dtrace-path'>'
|
||||
exit 2
|
||||
fi
|
||||
|
||||
dtrace=$1
|
||||
file=/tmp/out.$$
|
||||
|
||||
rm -f $file
|
||||
|
||||
$dtrace -o $file -c 'sleep 3' -s /dev/stdin <<EOF
|
||||
#pragma D option quiet
|
||||
#pragma D option temporal
|
||||
|
||||
BEGIN
|
||||
{
|
||||
@lines = count();
|
||||
printf("0 begin\n");
|
||||
}
|
||||
|
||||
END
|
||||
{
|
||||
/* Bump @lines every time we print a line. */
|
||||
@lines = count();
|
||||
printf("%u end\n", timestamp);
|
||||
@lines = count();
|
||||
printa("99999999999999999 lines %@u\n", @lines);
|
||||
}
|
||||
|
||||
profile-97hz
|
||||
{
|
||||
@lines = count();
|
||||
printf("%u\n", timestamp);
|
||||
}
|
||||
EOF
|
||||
|
||||
status=$?
|
||||
if [ "$status" -ne 0 ]; then
|
||||
echo $tst: dtrace failed
|
||||
exit $status
|
||||
fi
|
||||
|
||||
# dtrace outputs a blank line at the end, which will sort to the beginning,
|
||||
# so use head to remove the blank line.
|
||||
head -n -1 $file > $file.2
|
||||
|
||||
sort -n $file.2 | diff $file.2 -
|
||||
status=$?
|
||||
if [ "$status" -ne 0 ]; then
|
||||
echo $tst: output is not sorted
|
||||
exit $status
|
||||
fi
|
||||
|
||||
head -n 1 $file.2 | grep begin >/dev/null
|
||||
status=$?
|
||||
if [ "$status" -ne 0 ]; then
|
||||
echo $tst: begin probe did not fire
|
||||
exit $status
|
||||
fi
|
||||
|
||||
tail -n 2 $file.2 | grep end >/dev/null
|
||||
status=$?
|
||||
if [ "$status" -ne 0 ]; then
|
||||
echo $tst: end probe did not fire
|
||||
exit $status
|
||||
fi
|
||||
|
||||
if [ $(tail -n 1 $file.2 | cut -f3 -d ' ') -ne \
|
||||
$(wc -l $file.2) ]; then
|
||||
echo $tst: incorrect number of lines output
|
||||
exit 1
|
||||
fi
|
||||
|
||||
exit $status
|
||||
|
|
@ -0,0 +1,102 @@
|
|||
#!/bin/ksh -p
|
||||
#
|
||||
# CDDL HEADER START
|
||||
#
|
||||
# This file and its contents are supplied under the terms of the
|
||||
# Common Development and Distribution License ("CDDL"), version 1.0.
|
||||
# You may only use this file in accordance with the terms of version
|
||||
# 1.0 of the CDDL.
|
||||
#
|
||||
# A full copy of the text of the CDDL should have accompanied this
|
||||
# source. A copy of the CDDL is also available via the Internet at
|
||||
# http://www.illumos.org/license/CDDL.
|
||||
#
|
||||
# CDDL HEADER END
|
||||
#
|
||||
|
||||
#
|
||||
# Copyright (c) 2012 by Delphix. All rights reserved.
|
||||
#
|
||||
|
||||
############################################################################
|
||||
# ASSERTION:
|
||||
# temporal option causes output to be sorted, even when some
|
||||
# buffers are empty
|
||||
#
|
||||
# SECTION: Pragma
|
||||
#
|
||||
# NOTES: The temporal option has no effect on a single-CPU system, so
|
||||
# this needs to be run on a multi-CPU system to effectively test the
|
||||
# temporal option.
|
||||
#
|
||||
############################################################################
|
||||
|
||||
if [ $# != 1 ]; then
|
||||
echo expected one argument: '<'dtrace-path'>'
|
||||
exit 2
|
||||
fi
|
||||
|
||||
dtrace=$1
|
||||
file=/tmp/out.$$
|
||||
|
||||
rm -f $file
|
||||
|
||||
$dtrace -o $file -s /dev/stdin <<EOF
|
||||
#pragma D option quiet
|
||||
#pragma D option destructive
|
||||
#pragma D option temporal
|
||||
#pragma D option switchrate=1000hz
|
||||
|
||||
/*
|
||||
* Use two enablings of the same probe, so that cpu 0 will always
|
||||
* record its data just a little bit before the other cpus.
|
||||
* We don't want to use the chill() action in the same enabling
|
||||
* that we record the timestamp, because chill() causes the
|
||||
* timestamp to be re-read, and thus not match the timestamp
|
||||
* which libdtrace uses to sort the records.
|
||||
*/
|
||||
|
||||
profile-401
|
||||
/cpu == 0/
|
||||
{
|
||||
printf("%d\n", timestamp);
|
||||
}
|
||||
|
||||
profile-401
|
||||
/cpu != 0/
|
||||
{
|
||||
chill(1000); /* one microsecond */
|
||||
}
|
||||
|
||||
profile-401
|
||||
/cpu != 0/
|
||||
{
|
||||
printf("%d\n", timestamp);
|
||||
}
|
||||
|
||||
tick-1s
|
||||
/k++ == 10/
|
||||
{
|
||||
printf("%d\n", timestamp);
|
||||
exit(0);
|
||||
}
|
||||
EOF
|
||||
|
||||
status=$?
|
||||
if [ "$status" -ne 0 ]; then
|
||||
echo $tst: dtrace failed
|
||||
exit $status
|
||||
fi
|
||||
|
||||
# dtrace outputs a blank line at the end, which will sort to the beginning,
|
||||
# so use grep to remove the blank line.
|
||||
head -n -1 $file > $file.2
|
||||
|
||||
sort -n $file.2 | diff $file.2 -
|
||||
status=$?
|
||||
if [ "$status" -ne 0 ]; then
|
||||
echo $tst: output is not sorted
|
||||
exit $status
|
||||
fi
|
||||
|
||||
exit $status
|
||||
|
|
@ -0,0 +1,48 @@
|
|||
/*
|
||||
* CDDL HEADER START
|
||||
*
|
||||
* This file and its contents are supplied under the terms of the
|
||||
* Common Development and Distribution License ("CDDL"), version 1.0.
|
||||
* You may only use this file in accordance with the terms of version
|
||||
* 1.0 of the CDDL.
|
||||
*
|
||||
* A full copy of the text of the CDDL should have accompanied this
|
||||
* source. A copy of the CDDL is also available via the Internet at
|
||||
* http://www.illumos.org/license/CDDL.
|
||||
*
|
||||
* CDDL HEADER END
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2012 by Delphix. All rights reserved.
|
||||
*/
|
||||
|
||||
/*
|
||||
* This test excercises the "remnant" handling of the temporal option.
|
||||
* At the end of one pass of retrieving and printing data from all CPUs,
|
||||
* some unprocessed data will remain, because its timestamp is after the
|
||||
* time covered by all CPUs' buffers. This unprocessed data is
|
||||
* rearranged in a more space-efficient manner. If this is done
|
||||
* incorrectly, an alignment error may occur. To test this, we use a
|
||||
* high-frequency probe so that data will be recorded in subsequent
|
||||
* CPU's buffers after the first CPU's buffer is obtained. The
|
||||
* combination of data traced here (a 8-byte value and a 4-byte value)
|
||||
* is effective to cause alignment problems with an incorrect
|
||||
* implementation.
|
||||
*
|
||||
* This test needs to be run on a multi-CPU system to be effective.
|
||||
*/
|
||||
|
||||
#pragma D option quiet
|
||||
#pragma D option temporal
|
||||
|
||||
profile-4997
|
||||
{
|
||||
printf("%u %u", 1ULL, 2);
|
||||
}
|
||||
|
||||
tick-1
|
||||
/i++ == 10/
|
||||
{
|
||||
exit(0);
|
||||
}
|
||||
|
|
@ -1,197 +0,0 @@
|
|||
#
|
||||
# CDDL HEADER START
|
||||
#
|
||||
# The contents of this file are subject to the terms of the
|
||||
# Common Development and Distribution License (the "License").
|
||||
# You may not use this file except in compliance with the License.
|
||||
#
|
||||
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||
# or http://www.opensolaris.org/os/licensing.
|
||||
# See the License for the specific language governing permissions
|
||||
# and limitations under the License.
|
||||
#
|
||||
# When distributing Covered Code, include this CDDL HEADER in each
|
||||
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||
# If applicable, add the following below this CDDL HEADER, with the
|
||||
# fields enclosed by brackets "[]" replaced with your own identifying
|
||||
# information: Portions Copyright [yyyy] [name of copyright owner]
|
||||
#
|
||||
# CDDL HEADER END
|
||||
#
|
||||
|
||||
#
|
||||
# Copyright 2007 Sun Microsystems, Inc. All rights reserved.
|
||||
# Use is subject to license terms.
|
||||
#
|
||||
# ident "%Z%%M% %I% %E% SMI"
|
||||
|
||||
unload()
|
||||
{
|
||||
#
|
||||
# Get the list of services whose processes have USDT probes. Ideally
|
||||
# it would be possible to unload the fasttrap provider while USDT
|
||||
# probes exist -- once that fix is integrated, this hack can go away
|
||||
# We create two lists -- one of regular SMF services and one of legacy
|
||||
# services -- since each must be enabled and disabled using a specific
|
||||
# mechanism.
|
||||
#
|
||||
pids=$(dtrace -l | \
|
||||
perl -ne 'print "$1\n" if (/^\s*\S+\s+\S*\D(\d+)\s+/);' | \
|
||||
sort | uniq | tr '\n' ',')
|
||||
|
||||
ctids=$(ps -p $pids -o ctid | tail +2 | sort | uniq)
|
||||
svcs=
|
||||
lrcs=
|
||||
|
||||
for ct in $ctids
|
||||
do
|
||||
line=$(svcs -o fmri,ctid | grep " $ct\$")
|
||||
svc=$(echo $line | cut -d' ' -f1)
|
||||
|
||||
if [[ $(svcs -Ho STA $svc) == "LRC" ]]; then
|
||||
lrc=$(svcs -Ho SVC $svc | tr _ '?')
|
||||
lrcs="$lrcs $lrc"
|
||||
else
|
||||
svcs="$svcs $svc"
|
||||
fi
|
||||
done
|
||||
|
||||
for svc in $svcs
|
||||
do
|
||||
svcadm disable -ts $svc
|
||||
done
|
||||
|
||||
for lrc in $lrcs
|
||||
do
|
||||
#
|
||||
# Does it seem a little paternalistic that lsvcrun requires
|
||||
# this environment variable to be set? I'd say so...
|
||||
#
|
||||
SMF_RESTARTER=svc:/system/svc/restarter:default \
|
||||
/lib/svc/bin/lsvcrun $lrc stop
|
||||
done
|
||||
|
||||
modunload -i 0
|
||||
modunload -i 0
|
||||
modunload -i 0
|
||||
modinfo | grep dtrace
|
||||
success=$?
|
||||
|
||||
for svc in $svcs
|
||||
do
|
||||
svcadm enable -ts $svc
|
||||
done
|
||||
|
||||
for lrc in $lrcs
|
||||
do
|
||||
SMF_RESTARTER=svc:/system/svc/restarter:default \
|
||||
/lib/svc/bin/lsvcrun $lrc start
|
||||
done
|
||||
|
||||
if [ ! $success ]; then
|
||||
echo $tst: could not unload dtrace
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
script1()
|
||||
{
|
||||
$dtrace -s /dev/stdin <<EOF
|
||||
syscall:::entry
|
||||
/pid != $ppid/
|
||||
{
|
||||
@a[probefunc] = count();
|
||||
}
|
||||
|
||||
tick-1sec
|
||||
/i++ == 5/
|
||||
{
|
||||
exit(0);
|
||||
}
|
||||
EOF
|
||||
}
|
||||
|
||||
script2()
|
||||
{
|
||||
$dtrace -s /dev/stdin <<EOF
|
||||
|
||||
#pragma D option statusrate=1ms
|
||||
|
||||
syscall:::entry
|
||||
/pid == $ppid/
|
||||
{
|
||||
ttl++;
|
||||
}
|
||||
|
||||
tick-1sec
|
||||
/i++ == 5/
|
||||
{
|
||||
exit(2);
|
||||
}
|
||||
|
||||
END
|
||||
/ttl/
|
||||
{
|
||||
printf("success; ttl is %d", ttl);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
END
|
||||
/ttl == 0/
|
||||
{
|
||||
printf("error -- total should be non-zero");
|
||||
exit(1);
|
||||
}
|
||||
EOF
|
||||
}
|
||||
|
||||
if [ $# != 1 ]; then
|
||||
echo expected one argument: '<'dtrace-path'>'
|
||||
exit 2
|
||||
fi
|
||||
|
||||
ppid=$$
|
||||
dtrace=$1
|
||||
|
||||
unload
|
||||
script1 &
|
||||
child=$!
|
||||
|
||||
let waited=0
|
||||
|
||||
while [ "$waited" -lt 5 ]; do
|
||||
seconds=`date +%S`
|
||||
|
||||
if [ "$seconds" -ne "$last" ]; then
|
||||
last=$seconds
|
||||
let waited=waited+1
|
||||
fi
|
||||
done
|
||||
|
||||
wait $child
|
||||
status=$?
|
||||
|
||||
if [ "$status" -ne 0 ]; then
|
||||
echo $tst: first dtrace failed
|
||||
exit $status
|
||||
fi
|
||||
|
||||
unload
|
||||
script2 &
|
||||
child=$!
|
||||
|
||||
let waited=0
|
||||
|
||||
while [ "$waited" -lt 10 ]; do
|
||||
seconds=`date +%S`
|
||||
|
||||
if [ "$seconds" -ne "$last" ]; then
|
||||
last=$seconds
|
||||
let waited=waited+1
|
||||
fi
|
||||
done
|
||||
|
||||
wait $child
|
||||
status=$?
|
||||
|
||||
exit $status
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
/*
|
||||
* CDDL HEADER START
|
||||
*
|
||||
* The contents of this file are subject to the terms of the
|
||||
* Common Development and Distribution License (the "License").
|
||||
* You may not use this file except in compliance with the License.
|
||||
*
|
||||
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||
* or http://www.opensolaris.org/os/licensing.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
*
|
||||
* When distributing Covered Code, include this CDDL HEADER in each
|
||||
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||
* If applicable, add the following below this CDDL HEADER, with the
|
||||
* fields enclosed by brackets "[]" replaced with your own identifying
|
||||
* information: Portions Copyright [yyyy] [name of copyright owner]
|
||||
*
|
||||
* CDDL HEADER END
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2011 by Delphix. All rights reserved.
|
||||
*/
|
||||
|
||||
BEGIN
|
||||
{
|
||||
print((void)`p0);
|
||||
}
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
/*
|
||||
* CDDL HEADER START
|
||||
*
|
||||
* The contents of this file are subject to the terms of the
|
||||
* Common Development and Distribution License (the "License").
|
||||
* You may not use this file except in compliance with the License.
|
||||
*
|
||||
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||
* or http://www.opensolaris.org/os/licensing.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
*
|
||||
* When distributing Covered Code, include this CDDL HEADER in each
|
||||
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||
* If applicable, add the following below this CDDL HEADER, with the
|
||||
* fields enclosed by brackets "[]" replaced with your own identifying
|
||||
* information: Portions Copyright [yyyy] [name of copyright owner]
|
||||
*
|
||||
* CDDL HEADER END
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2011 by Delphix. All rights reserved.
|
||||
*/
|
||||
|
||||
BEGIN
|
||||
{
|
||||
print();
|
||||
}
|
||||
|
|
@ -0,0 +1,62 @@
|
|||
/*
|
||||
* CDDL HEADER START
|
||||
*
|
||||
* The contents of this file are subject to the terms of the
|
||||
* Common Development and Distribution License (the "License").
|
||||
* You may not use this file except in compliance with the License.
|
||||
*
|
||||
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||
* or http://www.opensolaris.org/os/licensing.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
*
|
||||
* When distributing Covered Code, include this CDDL HEADER in each
|
||||
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||
* If applicable, add the following below this CDDL HEADER, with the
|
||||
* fields enclosed by brackets "[]" replaced with your own identifying
|
||||
* information: Portions Copyright [yyyy] [name of copyright owner]
|
||||
*
|
||||
* CDDL HEADER END
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2011 by Delphix. All rights reserved.
|
||||
*/
|
||||
|
||||
#pragma D option quiet
|
||||
|
||||
typedef struct bar {
|
||||
int alpha;
|
||||
} bar_t;
|
||||
|
||||
typedef struct foo {
|
||||
int a[3];
|
||||
char b[30];
|
||||
bar_t c[2];
|
||||
char d[3];
|
||||
} foo_t;
|
||||
|
||||
BEGIN
|
||||
{
|
||||
this->f = (foo_t *)alloca(sizeof (foo_t));
|
||||
|
||||
this->f->a[0] = 1;
|
||||
this->f->a[1] = 2;
|
||||
this->f->a[2] = 3;
|
||||
this->f->b[0] = 'a';
|
||||
this->f->b[1] = 'b';
|
||||
this->f->b[2] = 0;
|
||||
this->f->c[0].alpha = 5;
|
||||
this->f->c[1].alpha = 6;
|
||||
this->f->c[2].alpha = 7;
|
||||
this->f->d[0] = 4;
|
||||
this->f->d[1] = 0;
|
||||
this->f->d[2] = 0;
|
||||
|
||||
print(this->f->a);
|
||||
print(this->f->b);
|
||||
print(this->f->c);
|
||||
print(*this->f);
|
||||
|
||||
exit(0);
|
||||
}
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
int [3] [ 0x1, 0x2, 0x3 ]
|
||||
char [30] "ab"
|
||||
bar_t [2] [
|
||||
bar_t {
|
||||
int alpha = 0x5
|
||||
},
|
||||
bar_t {
|
||||
int alpha = 0x6
|
||||
}
|
||||
]
|
||||
foo_t {
|
||||
int [3] a = [ 0x1, 0x2, 0x3 ]
|
||||
char [30] b = [ "ab" ]
|
||||
bar_t [2] c = [
|
||||
bar_t {
|
||||
int alpha = 0x5
|
||||
},
|
||||
bar_t {
|
||||
int alpha = 0x6
|
||||
}
|
||||
]
|
||||
char [3] d = [ '\004', '\0', '\0' ]
|
||||
}
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
/*
|
||||
* CDDL HEADER START
|
||||
*
|
||||
* The contents of this file are subject to the terms of the
|
||||
* Common Development and Distribution License (the "License").
|
||||
* You may not use this file except in compliance with the License.
|
||||
*
|
||||
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||
* or http://www.opensolaris.org/os/licensing.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
*
|
||||
* When distributing Covered Code, include this CDDL HEADER in each
|
||||
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||
* If applicable, add the following below this CDDL HEADER, with the
|
||||
* fields enclosed by brackets "[]" replaced with your own identifying
|
||||
* information: Portions Copyright [yyyy] [name of copyright owner]
|
||||
*
|
||||
* CDDL HEADER END
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2011 by Delphix. All rights reserved.
|
||||
*/
|
||||
|
||||
#pragma D option quiet
|
||||
|
||||
typedef struct forward forward_t;
|
||||
|
||||
typedef struct foo {
|
||||
int a:4;
|
||||
int b:7;
|
||||
int c:1;
|
||||
int d:2;
|
||||
} foo_t;
|
||||
|
||||
BEGIN
|
||||
{
|
||||
this->s = (foo_t *)alloca(sizeof (foo_t));
|
||||
|
||||
this->s->a = 1;
|
||||
this->s->b = 5;
|
||||
this->s->c = 0;
|
||||
this->s->d = 2;
|
||||
|
||||
print(*this->s);
|
||||
|
||||
exit(0);
|
||||
}
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
foo_t {
|
||||
int a :4 = 0x1
|
||||
int b :7 = 0x5
|
||||
int c :1 = 0
|
||||
int d :2 = 0x2
|
||||
}
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
/*
|
||||
* CDDL HEADER START
|
||||
*
|
||||
* This file and its contents are supplied under the terms of the
|
||||
* Common Development and Distribution License ("CDDL"), version 1.0.
|
||||
* You may only use this file in accordance with the terms of version
|
||||
* 1.0 of the CDDL.
|
||||
*
|
||||
* A full copy of the text of the CDDL should have accompanied this
|
||||
* source. A copy of the CDDL is also available via the Internet at
|
||||
* http://www.illumos.org/license/CDDL.
|
||||
*
|
||||
* CDDL HEADER END
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2012 by Delphix. All rights reserved.
|
||||
*/
|
||||
|
||||
BEGIN
|
||||
{
|
||||
print(*curpsinfo);
|
||||
}
|
||||
|
||||
BEGIN
|
||||
{
|
||||
exit(0);
|
||||
}
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
/*
|
||||
* CDDL HEADER START
|
||||
*
|
||||
* The contents of this file are subject to the terms of the
|
||||
* Common Development and Distribution License (the "License").
|
||||
* You may not use this file except in compliance with the License.
|
||||
*
|
||||
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||
* or http://www.opensolaris.org/os/licensing.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
*
|
||||
* When distributing Covered Code, include this CDDL HEADER in each
|
||||
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||
* If applicable, add the following below this CDDL HEADER, with the
|
||||
* fields enclosed by brackets "[]" replaced with your own identifying
|
||||
* information: Portions Copyright [yyyy] [name of copyright owner]
|
||||
*
|
||||
* CDDL HEADER END
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2011 by Delphix. All rights reserved.
|
||||
*/
|
||||
|
||||
#pragma D option quiet
|
||||
|
||||
BEGIN
|
||||
{
|
||||
i = (int)'a';
|
||||
|
||||
printf("\n");
|
||||
|
||||
print((char)'a');
|
||||
print((int)-1);
|
||||
print((unsigned int)23);
|
||||
print((short)456);
|
||||
print((unsigned short)789);
|
||||
print((long)1234);
|
||||
print((ulong_t)56789);
|
||||
print((void *)0x1234);
|
||||
print("hello");
|
||||
|
||||
exit(0);
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
|
||||
char 'a'
|
||||
int 0xffffffff
|
||||
unsigned int 0x17
|
||||
short 0x1c8
|
||||
unsigned short 0x315
|
||||
long 0x4d2
|
||||
ulong_t 0xddd5
|
||||
void * 0x1234
|
||||
string "hello"
|
||||
|
||||
|
|
@ -0,0 +1,59 @@
|
|||
/*
|
||||
* CDDL HEADER START
|
||||
*
|
||||
* The contents of this file are subject to the terms of the
|
||||
* Common Development and Distribution License (the "License").
|
||||
* You may not use this file except in compliance with the License.
|
||||
*
|
||||
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||
* or http://www.opensolaris.org/os/licensing.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
*
|
||||
* When distributing Covered Code, include this CDDL HEADER in each
|
||||
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||
* If applicable, add the following below this CDDL HEADER, with the
|
||||
* fields enclosed by brackets "[]" replaced with your own identifying
|
||||
* information: Portions Copyright [yyyy] [name of copyright owner]
|
||||
*
|
||||
* CDDL HEADER END
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2011 by Delphix. All rights reserved.
|
||||
*/
|
||||
|
||||
#pragma D option quiet
|
||||
|
||||
typedef struct forward forward_t;
|
||||
|
||||
typedef struct foo {
|
||||
int a;
|
||||
void *b;
|
||||
struct {
|
||||
uint64_t alpha;
|
||||
uint64_t beta;
|
||||
} c;
|
||||
ushort_t d;
|
||||
int e;
|
||||
forward_t *f;
|
||||
void (*g)();
|
||||
} foo_t;
|
||||
|
||||
BEGIN
|
||||
{
|
||||
this->s = (foo_t *)alloca(sizeof (foo_t));
|
||||
|
||||
this->s->a = 1;
|
||||
this->s->b = (void *)2;
|
||||
this->s->c.alpha = 3;
|
||||
this->s->c.beta = 4;
|
||||
this->s->d = 5;
|
||||
this->s->e = 6;
|
||||
this->s->f = (void *)7;
|
||||
this->s->g = (void *)8;
|
||||
|
||||
print(*this->s);
|
||||
|
||||
exit(0);
|
||||
}
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
foo_t {
|
||||
int a = 0x1
|
||||
void *b = 0x2
|
||||
struct c = {
|
||||
uint64_t alpha = 0x3
|
||||
uint64_t beta = 0x4
|
||||
}
|
||||
ushort_t d = 0x5
|
||||
int e = 0x6
|
||||
forward_t *f = 0x7
|
||||
int (*)() g = 0x8
|
||||
}
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
/*
|
||||
* CDDL HEADER START
|
||||
*
|
||||
* This file and its contents are supplied under the terms of the
|
||||
* Common Development and Distribution License ("CDDL"), version 1.0.
|
||||
* You may only use this file in accordance with the terms of version
|
||||
* 1.0 of the CDDL.
|
||||
*
|
||||
* A full copy of the text of the CDDL should have accompanied this
|
||||
* source. A copy of the CDDL is also available via the Internet at
|
||||
* http://www.illumos.org/license/CDDL.
|
||||
*
|
||||
* CDDL HEADER END
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2012 by Delphix. All rights reserved.
|
||||
*/
|
||||
|
||||
#pragma D option quiet
|
||||
|
||||
typedef struct pancakes {
|
||||
int i;
|
||||
string s;
|
||||
timespec_t t;
|
||||
} pancakes_t;
|
||||
|
||||
translator pancakes_t < void *V > {
|
||||
i = 2 * 10;
|
||||
s = strjoin("I like ", "pancakes");
|
||||
t = *(timespec_t *)`dtrace_zero;
|
||||
};
|
||||
|
||||
BEGIN
|
||||
{
|
||||
print(*(xlate < pancakes_t * > ((void *)NULL)));
|
||||
}
|
||||
|
||||
BEGIN
|
||||
{
|
||||
exit(0);
|
||||
}
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
pancakes_t {
|
||||
int i = 0x14
|
||||
string s = [ "I like pancakes" ]
|
||||
timespec_t t = {
|
||||
time_t tv_sec = 0
|
||||
long tv_nsec = 0
|
||||
}
|
||||
}
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
239
|
||||
52719
|
||||
-17
|
||||
-12817
|
||||
-1867788817
|
||||
1311768467294899695
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,38 @@
|
|||
/*
|
||||
* CDDL HEADER START
|
||||
*
|
||||
* This file and its contents are supplied under the terms of the
|
||||
* Common Development and Distribution License ("CDDL"), version 1.0.
|
||||
* You may only use this file in accordance with the terms of version
|
||||
* 1.0 of the CDDL.
|
||||
*
|
||||
* A full copy of the text of the CDDL should have accompanied this
|
||||
* source. A copy of the CDDL is also available via the Internet at
|
||||
* http://www.illumos.org/license/CDDL.
|
||||
*
|
||||
* CDDL HEADER END
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2012 by Delphix. All rights reserved.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Check %d v. %i v. %u.
|
||||
*/
|
||||
|
||||
#pragma D option quiet
|
||||
|
||||
uint16_t x;
|
||||
int16_t y;
|
||||
|
||||
BEGIN
|
||||
{
|
||||
x = 0xffffffff;
|
||||
y = 0xffffffff;
|
||||
|
||||
printf("%d %i %u\n", x, x, x);
|
||||
printf("%d %i %u\n", y, y, y);
|
||||
|
||||
exit(0);
|
||||
}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
65535 -1 65535
|
||||
-1 -1 65535
|
||||
|
||||
|
|
@ -24,7 +24,10 @@
|
|||
* Use is subject to license terms.
|
||||
*/
|
||||
|
||||
#pragma ident "%Z%%M% %I% %E% SMI"
|
||||
/*
|
||||
* Copyright (c) 2012 by Delphix. All rights reserved.
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* ASSERTION:
|
||||
|
|
@ -35,17 +38,10 @@
|
|||
*
|
||||
* NOTES: This test behaves differently depending on the values
|
||||
* assigned to bufsize.
|
||||
* 1. 0 > bufsize.
|
||||
* 2. 0 == bufsize.
|
||||
* 3. 0 < bufsize <= 7
|
||||
* 4. 8 <= bufsize <= 31
|
||||
* 5. 32 <= bufsize <= 47
|
||||
* 6. 48 <= bufsize <= 71
|
||||
* 7. 72 <= bufsize
|
||||
*/
|
||||
|
||||
#pragma D option quiet
|
||||
#pragma D option bufsize=41
|
||||
#pragma D option bufsize=49
|
||||
|
||||
BEGIN
|
||||
{
|
||||
|
|
|
|||
|
|
@ -24,7 +24,10 @@
|
|||
* Use is subject to license terms.
|
||||
*/
|
||||
|
||||
#pragma ident "%Z%%M% %I% %E% SMI"
|
||||
/*
|
||||
* Copyright (c) 2012 by Delphix. All rights reserved.
|
||||
*/
|
||||
|
||||
/*
|
||||
* ASSERTION:
|
||||
* Verify the behavior of speculations with changes in specsize.
|
||||
|
|
@ -35,7 +38,7 @@
|
|||
*/
|
||||
|
||||
#pragma D option quiet
|
||||
#pragma D option specsize=40
|
||||
#pragma D option specsize=48
|
||||
|
||||
BEGIN
|
||||
{
|
||||
|
|
|
|||
|
|
@ -0,0 +1,28 @@
|
|||
/*
|
||||
* CDDL HEADER START
|
||||
*
|
||||
* This file and its contents are supplied under the terms of the
|
||||
* Common Development and Distribution License ("CDDL"), version 1.0.
|
||||
* You may only use this file in accordance with the terms of version
|
||||
* 1.0 of the CDDL.
|
||||
*
|
||||
* A full copy of the text of the CDDL should have accompanied this
|
||||
* source. A copy of the CDDL is also available via the Internet at
|
||||
* http://www.illumos.org/license/CDDL.
|
||||
*
|
||||
* CDDL HEADER END
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2012 by Delphix. All rights reserved.
|
||||
*/
|
||||
|
||||
BEGIN
|
||||
{
|
||||
trace(*curpsinfo);
|
||||
}
|
||||
|
||||
BEGIN
|
||||
{
|
||||
exit(0);
|
||||
}
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
/*
|
||||
* CDDL HEADER START
|
||||
*
|
||||
* The contents of this file are subject to the terms of the
|
||||
* Common Development and Distribution License (the "License").
|
||||
* You may not use this file except in compliance with the License.
|
||||
*
|
||||
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||
* or http://www.opensolaris.org/os/licensing.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
*
|
||||
* When distributing Covered Code, include this CDDL HEADER in each
|
||||
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||
* If applicable, add the following below this CDDL HEADER, with the
|
||||
* fields enclosed by brackets "[]" replaced with your own identifying
|
||||
* information: Portions Copyright [yyyy] [name of copyright owner]
|
||||
*
|
||||
* CDDL HEADER END
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2011, Joyent, Inc. All rights reserved.
|
||||
*/
|
||||
|
||||
BEGIN
|
||||
{
|
||||
tracemem(`dtrace_zero, 256, 0, "fishpong");
|
||||
}
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
/*
|
||||
* CDDL HEADER START
|
||||
*
|
||||
* The contents of this file are subject to the terms of the
|
||||
* Common Development and Distribution License (the "License").
|
||||
* You may not use this file except in compliance with the License.
|
||||
*
|
||||
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||
* or http://www.opensolaris.org/os/licensing.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
*
|
||||
* When distributing Covered Code, include this CDDL HEADER in each
|
||||
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||
* If applicable, add the following below this CDDL HEADER, with the
|
||||
* fields enclosed by brackets "[]" replaced with your own identifying
|
||||
* information: Portions Copyright [yyyy] [name of copyright owner]
|
||||
*
|
||||
* CDDL HEADER END
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2011, Joyent, Inc. All rights reserved.
|
||||
*/
|
||||
|
||||
BEGIN
|
||||
{
|
||||
tracemem(`dtrace_zero, 256, "fishpong");
|
||||
exit(0);
|
||||
}
|
||||
|
|
@ -20,20 +20,26 @@
|
|||
*/
|
||||
|
||||
/*
|
||||
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
|
||||
* Use is subject to license terms.
|
||||
* Copyright (c) 2011, Joyent, Inc. All rights reserved.
|
||||
*/
|
||||
|
||||
#pragma ident "%Z%%M% %I% %E% SMI"
|
||||
|
||||
/*
|
||||
* ASSERTION:
|
||||
* Test tracemem() with too many arguments.
|
||||
*
|
||||
* SECTION: Actions and Subroutines/tracemem()
|
||||
*/
|
||||
#pragma D option quiet
|
||||
|
||||
BEGIN
|
||||
{
|
||||
tracemem(123, 456, 789);
|
||||
i = -10;
|
||||
}
|
||||
|
||||
tick-10ms
|
||||
/i++ < 150/
|
||||
{
|
||||
printf("%d:", i);
|
||||
tracemem(`dtrace_zero, 128, i);
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
tick-10ms
|
||||
/i >= 150/
|
||||
{
|
||||
exit(0);
|
||||
}
|
||||
File diff suppressed because it is too large
Load diff
|
|
@ -0,0 +1,62 @@
|
|||
#
|
||||
# CDDL HEADER START
|
||||
#
|
||||
# The contents of this file are subject to the terms of the
|
||||
# Common Development and Distribution License (the "License").
|
||||
# You may not use this file except in compliance with the License.
|
||||
#
|
||||
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||
# or http://www.opensolaris.org/os/licensing.
|
||||
# See the License for the specific language governing permissions
|
||||
# and limitations under the License.
|
||||
#
|
||||
# When distributing Covered Code, include this CDDL HEADER in each
|
||||
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||
# If applicable, add the following below this CDDL HEADER, with the
|
||||
# fields enclosed by brackets "[]" replaced with your own identifying
|
||||
# information: Portions Copyright [yyyy] [name of copyright owner]
|
||||
#
|
||||
# CDDL HEADER END
|
||||
#
|
||||
|
||||
#
|
||||
# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
|
||||
# Use is subject to license terms.
|
||||
#
|
||||
|
||||
#
|
||||
# Copyright (c) 2012 by Delphix. All rights reserved.
|
||||
#
|
||||
|
||||
#
|
||||
# Test the output for stable translations.
|
||||
#
|
||||
|
||||
if [ $# != 1 ]; then
|
||||
echo expected one argument: '<'dtrace-path'>'
|
||||
exit 2
|
||||
fi
|
||||
|
||||
dtrace=$1
|
||||
|
||||
$dtrace -v -s /dev/stdin <<EOF
|
||||
|
||||
#pragma D option quiet
|
||||
|
||||
inline lwpsinfo_t *myinfo = xlate < lwpsinfo_t *> (curthread);
|
||||
|
||||
#pragma D attributes Stable/Stable/Common myinfo
|
||||
|
||||
BEGIN
|
||||
{
|
||||
this->a = myinfo->pr_flag;
|
||||
exit(0);
|
||||
}
|
||||
|
||||
BEGIN
|
||||
{
|
||||
exit(1);
|
||||
}
|
||||
EOF
|
||||
|
||||
exit $?
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
|
||||
Stability attributes for script /dev/stdin:
|
||||
|
||||
Minimum Probe Description Attributes
|
||||
Identifier Names: Unstable
|
||||
Data Semantics: Unstable
|
||||
Dependency Class: Common
|
||||
|
||||
Minimum Statement Attributes
|
||||
Identifier Names: Stable
|
||||
Data Semantics: Stable
|
||||
Dependency Class: Common
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,60 @@
|
|||
#
|
||||
# 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 2006 Sun Microsystems, Inc. All rights reserved.
|
||||
# Use is subject to license terms.
|
||||
#
|
||||
|
||||
#
|
||||
# Copyright (c) 2012 by Delphix. All rights reserved.
|
||||
#
|
||||
|
||||
#
|
||||
# Test the output of unstable translations.
|
||||
#
|
||||
|
||||
if [ $# != 1 ]; then
|
||||
echo expected one argument: '<'dtrace-path'>'
|
||||
exit 2
|
||||
fi
|
||||
|
||||
dtrace=$1
|
||||
|
||||
$dtrace -v -s /dev/stdin <<EOF
|
||||
|
||||
#pragma D option quiet
|
||||
|
||||
inline lwpsinfo_t *myinfo = xlate < lwpsinfo_t *> (curthread);
|
||||
|
||||
BEGIN
|
||||
{
|
||||
this->a = myinfo->pr_flag;
|
||||
exit(0);
|
||||
}
|
||||
|
||||
BEGIN
|
||||
{
|
||||
exit(1);
|
||||
}
|
||||
EOF
|
||||
|
||||
exit $?
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
|
||||
Stability attributes for script /dev/stdin:
|
||||
|
||||
Minimum Probe Description Attributes
|
||||
Identifier Names: Unstable
|
||||
Data Semantics: Unstable
|
||||
Dependency Class: Common
|
||||
|
||||
Minimum Statement Attributes
|
||||
Identifier Names: Private
|
||||
Data Semantics: Private
|
||||
Dependency Class: Unknown
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,128 @@
|
|||
#
|
||||
# CDDL HEADER START
|
||||
#
|
||||
# The contents of this file are subject to the terms of the
|
||||
# Common Development and Distribution License (the "License").
|
||||
# You may not use this file except in compliance with the License.
|
||||
#
|
||||
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||
# or http://www.opensolaris.org/os/licensing.
|
||||
# See the License for the specific language governing permissions
|
||||
# and limitations under the License.
|
||||
#
|
||||
# When distributing Covered Code, include this CDDL HEADER in each
|
||||
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||
# If applicable, add the following below this CDDL HEADER, with the
|
||||
# fields enclosed by brackets "[]" replaced with your own identifying
|
||||
# information: Portions Copyright [yyyy] [name of copyright owner]
|
||||
#
|
||||
# CDDL HEADER END
|
||||
#
|
||||
|
||||
#
|
||||
# Copyright (c) 2011, Joyent, Inc. All rights reserved.
|
||||
#
|
||||
|
||||
if [ $# != 1 ]; then
|
||||
echo expected one argument: '<'dtrace-path'>'
|
||||
exit 2
|
||||
fi
|
||||
|
||||
dtrace=$1
|
||||
DIR=/var/tmp/dtest.$$
|
||||
|
||||
mkdir $DIR
|
||||
cd $DIR
|
||||
|
||||
cat > test.c <<EOF
|
||||
#include <unistd.h>
|
||||
#include <sys/sdt.h>
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
DTRACE_PROBE(test_prov, probe1);
|
||||
}
|
||||
EOF
|
||||
|
||||
cat > prov.d <<EOF
|
||||
provider test_prov {
|
||||
probe probe1();
|
||||
};
|
||||
EOF
|
||||
|
||||
gcc -c test.c
|
||||
if [ $? -ne 0 ]; then
|
||||
print -u2 "failed to compile test.c"
|
||||
exit 1
|
||||
fi
|
||||
$dtrace -G -32 -s prov.d test.o
|
||||
if [ $? -ne 0 ]; then
|
||||
print -u2 "failed to create DOF"
|
||||
exit 1
|
||||
fi
|
||||
gcc -o test test.o prov.o
|
||||
if [ $? -ne 0 ]; then
|
||||
print -u2 "failed to link final executable"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
script()
|
||||
{
|
||||
$dtrace -Zwqs /dev/stdin <<EOF
|
||||
|
||||
BEGIN
|
||||
{
|
||||
spec = speculation();
|
||||
speculate(spec);
|
||||
printf("this is speculative!\n");
|
||||
}
|
||||
|
||||
test_prov*:::
|
||||
{
|
||||
probeid = id;
|
||||
}
|
||||
|
||||
tick-1sec
|
||||
/probeid == 0/
|
||||
{
|
||||
printf("launching test\n");
|
||||
system("./test");
|
||||
}
|
||||
|
||||
tick-1sec
|
||||
/probeid != 0/
|
||||
{
|
||||
printf("attempting re-enabling\n");
|
||||
system("dtrace -e -x errtags -i %d", probeid);
|
||||
attempts++;
|
||||
}
|
||||
|
||||
tick-1sec
|
||||
/attempts > 10/
|
||||
{
|
||||
exit(0);
|
||||
}
|
||||
EOF
|
||||
}
|
||||
|
||||
script 2>&1 | tee test.out
|
||||
|
||||
#
|
||||
# It should be true that our probe was not reaped after the provider was made
|
||||
# defunct: the speculative tracing action prevents reaping of any ECB in the
|
||||
# enabling.
|
||||
#
|
||||
status=0
|
||||
|
||||
if grep D_PDESC_INVAL test.out 2> /dev/null 1>&2 ; then
|
||||
status=1
|
||||
else
|
||||
grep D_PROC_GRAB test.out 2> /dev/null 1>&2
|
||||
status=$?
|
||||
fi
|
||||
|
||||
cd /
|
||||
/usr/bin/rm -rf $DIR
|
||||
|
||||
exit $status
|
||||
|
|
@ -0,0 +1,124 @@
|
|||
#
|
||||
# CDDL HEADER START
|
||||
#
|
||||
# The contents of this file are subject to the terms of the
|
||||
# Common Development and Distribution License (the "License").
|
||||
# You may not use this file except in compliance with the License.
|
||||
#
|
||||
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||
# or http://www.opensolaris.org/os/licensing.
|
||||
# See the License for the specific language governing permissions
|
||||
# and limitations under the License.
|
||||
#
|
||||
# When distributing Covered Code, include this CDDL HEADER in each
|
||||
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||
# If applicable, add the following below this CDDL HEADER, with the
|
||||
# fields enclosed by brackets "[]" replaced with your own identifying
|
||||
# information: Portions Copyright [yyyy] [name of copyright owner]
|
||||
#
|
||||
# CDDL HEADER END
|
||||
#
|
||||
|
||||
#
|
||||
# Copyright (c) 2011, Joyent, Inc. All rights reserved.
|
||||
#
|
||||
|
||||
if [ $# != 1 ]; then
|
||||
echo expected one argument: '<'dtrace-path'>'
|
||||
exit 2
|
||||
fi
|
||||
|
||||
dtrace=$1
|
||||
DIR=/var/tmp/dtest.$$
|
||||
|
||||
mkdir $DIR
|
||||
cd $DIR
|
||||
|
||||
cat > test.c <<EOF
|
||||
#include <unistd.h>
|
||||
#include <sys/sdt.h>
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
DTRACE_PROBE(test_prov, probe1);
|
||||
}
|
||||
EOF
|
||||
|
||||
cat > prov.d <<EOF
|
||||
provider test_prov {
|
||||
probe probe1();
|
||||
};
|
||||
EOF
|
||||
|
||||
gcc -c test.c
|
||||
if [ $? -ne 0 ]; then
|
||||
print -u2 "failed to compile test.c"
|
||||
exit 1
|
||||
fi
|
||||
$dtrace -G -32 -s prov.d test.o
|
||||
if [ $? -ne 0 ]; then
|
||||
print -u2 "failed to create DOF"
|
||||
exit 1
|
||||
fi
|
||||
gcc -o test test.o prov.o
|
||||
if [ $? -ne 0 ]; then
|
||||
print -u2 "failed to link final executable"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
script()
|
||||
{
|
||||
$dtrace -Zwqs /dev/stdin <<EOF
|
||||
test_prov*:::
|
||||
{
|
||||
probeid = id;
|
||||
}
|
||||
|
||||
tick-1sec
|
||||
/probeid == 0/
|
||||
{
|
||||
printf("launching test\n");
|
||||
system("./test");
|
||||
}
|
||||
|
||||
tick-1sec
|
||||
/probeid != 0/
|
||||
{
|
||||
printf("attempting re-enabling\n");
|
||||
system("dtrace -e -x errtags -i %d", probeid);
|
||||
attempts++;
|
||||
}
|
||||
|
||||
tick-1sec
|
||||
/attempts > 10/
|
||||
{
|
||||
exit(0);
|
||||
}
|
||||
EOF
|
||||
}
|
||||
|
||||
$dtrace -x bufpolicy=ring -ZwqP test_prov\* > /dev/null 2>&1 &
|
||||
background=$!
|
||||
echo launched ring buffered enabling as pid $background
|
||||
script 2>&1 | tee test.out
|
||||
|
||||
#
|
||||
# It should be true that our probe was not reaped after the provider was made
|
||||
# defunct: the active ring buffer in the earlier enabling prevents reaping of
|
||||
# any of the earlier enabling's ECBs.
|
||||
#
|
||||
status=0
|
||||
|
||||
if grep D_PDESC_INVAL test.out 2> /dev/null 1>&2 ; then
|
||||
status=1
|
||||
else
|
||||
grep D_PROC_GRAB test.out 2> /dev/null 1>&2
|
||||
status=$?
|
||||
fi
|
||||
|
||||
kill $background
|
||||
cd /
|
||||
/usr/bin/rm -rf $DIR
|
||||
|
||||
exit $status
|
||||
|
|
@ -0,0 +1,115 @@
|
|||
#
|
||||
# CDDL HEADER START
|
||||
#
|
||||
# The contents of this file are subject to the terms of the
|
||||
# Common Development and Distribution License (the "License").
|
||||
# You may not use this file except in compliance with the License.
|
||||
#
|
||||
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||
# or http://www.opensolaris.org/os/licensing.
|
||||
# See the License for the specific language governing permissions
|
||||
# and limitations under the License.
|
||||
#
|
||||
# When distributing Covered Code, include this CDDL HEADER in each
|
||||
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||
# If applicable, add the following below this CDDL HEADER, with the
|
||||
# fields enclosed by brackets "[]" replaced with your own identifying
|
||||
# information: Portions Copyright [yyyy] [name of copyright owner]
|
||||
#
|
||||
# CDDL HEADER END
|
||||
#
|
||||
|
||||
#
|
||||
# Copyright (c) 2011, Joyent, Inc. All rights reserved.
|
||||
#
|
||||
|
||||
if [ $# != 1 ]; then
|
||||
echo expected one argument: '<'dtrace-path'>'
|
||||
exit 2
|
||||
fi
|
||||
|
||||
dtrace=$1
|
||||
DIR=/var/tmp/dtest.$$
|
||||
|
||||
mkdir $DIR
|
||||
cd $DIR
|
||||
|
||||
cat > test.c <<EOF
|
||||
#include <unistd.h>
|
||||
#include <sys/sdt.h>
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
DTRACE_PROBE(test_prov, probe1);
|
||||
}
|
||||
EOF
|
||||
|
||||
cat > prov.d <<EOF
|
||||
provider test_prov {
|
||||
probe probe1();
|
||||
};
|
||||
EOF
|
||||
|
||||
gcc -c test.c
|
||||
if [ $? -ne 0 ]; then
|
||||
print -u2 "failed to compile test.c"
|
||||
exit 1
|
||||
fi
|
||||
$dtrace -G -32 -s prov.d test.o
|
||||
if [ $? -ne 0 ]; then
|
||||
print -u2 "failed to create DOF"
|
||||
exit 1
|
||||
fi
|
||||
gcc -o test test.o prov.o
|
||||
if [ $? -ne 0 ]; then
|
||||
print -u2 "failed to link final executable"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
script()
|
||||
{
|
||||
$dtrace -Zwqs /dev/stdin <<EOF
|
||||
test_prov*:::
|
||||
{
|
||||
probeid = id;
|
||||
}
|
||||
|
||||
tick-1sec
|
||||
/probeid == 0/
|
||||
{
|
||||
printf("launching test\n");
|
||||
system("./test");
|
||||
}
|
||||
|
||||
tick-1sec
|
||||
/probeid != 0/
|
||||
{
|
||||
printf("attempting re-enabling\n");
|
||||
system("dtrace -e -x errtags -i %d", probeid);
|
||||
attempts++;
|
||||
}
|
||||
|
||||
tick-1sec
|
||||
/attempts > 10/
|
||||
{
|
||||
exit(0);
|
||||
}
|
||||
EOF
|
||||
}
|
||||
|
||||
script 2>&1 | tee test.out
|
||||
|
||||
#
|
||||
# It should be true that our probe was reaped over the course of the enabling,
|
||||
# causing the embedded DTrace invocation to fail on an invalid probe (that is,
|
||||
# D_PDESC_INVAL) instead of an inability to grab the underlying process
|
||||
# (D_PROC_GRAB).
|
||||
#
|
||||
grep D_PDESC_INVAL test.out 2> /dev/null 1>&2
|
||||
status=$?
|
||||
|
||||
cd /
|
||||
/usr/bin/rm -rf $DIR
|
||||
|
||||
exit $status
|
||||
|
|
@ -21,10 +21,11 @@
|
|||
|
||||
/*
|
||||
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2012 by Delphix. All rights reserved.
|
||||
* Copyright (c) 2013 by Delphix. All rights reserved.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <stdio_ext.h>
|
||||
#include <stdlib.h>
|
||||
#include <ctype.h>
|
||||
|
|
@ -57,6 +58,7 @@
|
|||
#include <sys/arc.h>
|
||||
#include <sys/ddt.h>
|
||||
#include <sys/zfeature.h>
|
||||
#include <zfs_comutil.h>
|
||||
#undef ZFS_MAXNAMELEN
|
||||
#undef verify
|
||||
#include <libzfs.h>
|
||||
|
|
@ -206,6 +208,27 @@ dump_packed_nvlist(objset_t *os, uint64_t object, void *data, size_t size)
|
|||
nvlist_free(nv);
|
||||
}
|
||||
|
||||
/* ARGSUSED */
|
||||
static void
|
||||
dump_history_offsets(objset_t *os, uint64_t object, void *data, size_t size)
|
||||
{
|
||||
spa_history_phys_t *shp = data;
|
||||
|
||||
if (shp == NULL)
|
||||
return;
|
||||
|
||||
(void) printf("\t\tpool_create_len = %llu\n",
|
||||
(u_longlong_t)shp->sh_pool_create_len);
|
||||
(void) printf("\t\tphys_max_off = %llu\n",
|
||||
(u_longlong_t)shp->sh_phys_max_off);
|
||||
(void) printf("\t\tbof = %llu\n",
|
||||
(u_longlong_t)shp->sh_bof);
|
||||
(void) printf("\t\teof = %llu\n",
|
||||
(u_longlong_t)shp->sh_eof);
|
||||
(void) printf("\t\trecords_lost = %llu\n",
|
||||
(u_longlong_t)shp->sh_records_lost);
|
||||
}
|
||||
|
||||
static void
|
||||
zdb_nicenum(uint64_t num, char *buf)
|
||||
{
|
||||
|
|
@ -215,18 +238,18 @@ zdb_nicenum(uint64_t num, char *buf)
|
|||
nicenum(num, buf);
|
||||
}
|
||||
|
||||
const char dump_zap_stars[] = "****************************************";
|
||||
const int dump_zap_width = sizeof (dump_zap_stars) - 1;
|
||||
const char histo_stars[] = "****************************************";
|
||||
const int histo_width = sizeof (histo_stars) - 1;
|
||||
|
||||
static void
|
||||
dump_zap_histogram(uint64_t histo[ZAP_HISTOGRAM_SIZE])
|
||||
dump_histogram(const uint64_t *histo, int size)
|
||||
{
|
||||
int i;
|
||||
int minidx = ZAP_HISTOGRAM_SIZE - 1;
|
||||
int minidx = size - 1;
|
||||
int maxidx = 0;
|
||||
uint64_t max = 0;
|
||||
|
||||
for (i = 0; i < ZAP_HISTOGRAM_SIZE; i++) {
|
||||
for (i = 0; i < size; i++) {
|
||||
if (histo[i] > max)
|
||||
max = histo[i];
|
||||
if (histo[i] > 0 && i > maxidx)
|
||||
|
|
@ -235,12 +258,14 @@ dump_zap_histogram(uint64_t histo[ZAP_HISTOGRAM_SIZE])
|
|||
minidx = i;
|
||||
}
|
||||
|
||||
if (max < dump_zap_width)
|
||||
max = dump_zap_width;
|
||||
if (max < histo_width)
|
||||
max = histo_width;
|
||||
|
||||
for (i = minidx; i <= maxidx; i++)
|
||||
(void) printf("\t\t\t%u: %6llu %s\n", i, (u_longlong_t)histo[i],
|
||||
&dump_zap_stars[(max - histo[i]) * dump_zap_width / max]);
|
||||
for (i = minidx; i <= maxidx; i++) {
|
||||
(void) printf("\t\t\t%3u: %6llu %s\n",
|
||||
i, (u_longlong_t)histo[i],
|
||||
&histo_stars[(max - histo[i]) * histo_width / max]);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -291,19 +316,19 @@ dump_zap_stats(objset_t *os, uint64_t object)
|
|||
(u_longlong_t)zs.zs_salt);
|
||||
|
||||
(void) printf("\t\tLeafs with 2^n pointers:\n");
|
||||
dump_zap_histogram(zs.zs_leafs_with_2n_pointers);
|
||||
dump_histogram(zs.zs_leafs_with_2n_pointers, ZAP_HISTOGRAM_SIZE);
|
||||
|
||||
(void) printf("\t\tBlocks with n*5 entries:\n");
|
||||
dump_zap_histogram(zs.zs_blocks_with_n5_entries);
|
||||
dump_histogram(zs.zs_blocks_with_n5_entries, ZAP_HISTOGRAM_SIZE);
|
||||
|
||||
(void) printf("\t\tBlocks n/10 full:\n");
|
||||
dump_zap_histogram(zs.zs_blocks_n_tenths_full);
|
||||
dump_histogram(zs.zs_blocks_n_tenths_full, ZAP_HISTOGRAM_SIZE);
|
||||
|
||||
(void) printf("\t\tEntries with n chunks:\n");
|
||||
dump_zap_histogram(zs.zs_entries_using_n_chunks);
|
||||
dump_histogram(zs.zs_entries_using_n_chunks, ZAP_HISTOGRAM_SIZE);
|
||||
|
||||
(void) printf("\t\tBuckets with n entries:\n");
|
||||
dump_zap_histogram(zs.zs_buckets_with_n_entries);
|
||||
dump_histogram(zs.zs_buckets_with_n_entries, ZAP_HISTOGRAM_SIZE);
|
||||
}
|
||||
|
||||
/*ARGSUSED*/
|
||||
|
|
@ -545,7 +570,7 @@ static void
|
|||
dump_metaslab_stats(metaslab_t *msp)
|
||||
{
|
||||
char maxbuf[32];
|
||||
space_map_t *sm = &msp->ms_map;
|
||||
space_map_t *sm = msp->ms_map;
|
||||
avl_tree_t *t = sm->sm_pp_root;
|
||||
int free_pct = sm->sm_space * 100 / sm->sm_size;
|
||||
|
||||
|
|
@ -561,7 +586,7 @@ dump_metaslab(metaslab_t *msp)
|
|||
{
|
||||
vdev_t *vd = msp->ms_group->mg_vd;
|
||||
spa_t *spa = vd->vdev_spa;
|
||||
space_map_t *sm = &msp->ms_map;
|
||||
space_map_t *sm = msp->ms_map;
|
||||
space_map_obj_t *smo = &msp->ms_smo;
|
||||
char freebuf[32];
|
||||
|
||||
|
|
@ -857,21 +882,22 @@ dump_history(spa_t *spa)
|
|||
for (int i = 0; i < num; i++) {
|
||||
uint64_t time, txg, ievent;
|
||||
char *cmd, *intstr;
|
||||
boolean_t printed = B_FALSE;
|
||||
|
||||
if (nvlist_lookup_uint64(events[i], ZPOOL_HIST_TIME,
|
||||
&time) != 0)
|
||||
continue;
|
||||
goto next;
|
||||
if (nvlist_lookup_string(events[i], ZPOOL_HIST_CMD,
|
||||
&cmd) != 0) {
|
||||
if (nvlist_lookup_uint64(events[i],
|
||||
ZPOOL_HIST_INT_EVENT, &ievent) != 0)
|
||||
continue;
|
||||
goto next;
|
||||
verify(nvlist_lookup_uint64(events[i],
|
||||
ZPOOL_HIST_TXG, &txg) == 0);
|
||||
verify(nvlist_lookup_string(events[i],
|
||||
ZPOOL_HIST_INT_STR, &intstr) == 0);
|
||||
if (ievent >= LOG_END)
|
||||
continue;
|
||||
if (ievent >= ZFS_NUM_LEGACY_HISTORY_EVENTS)
|
||||
goto next;
|
||||
|
||||
(void) snprintf(internalstr,
|
||||
sizeof (internalstr),
|
||||
|
|
@ -884,6 +910,14 @@ dump_history(spa_t *spa)
|
|||
(void) localtime_r(&tsec, &t);
|
||||
(void) strftime(tbuf, sizeof (tbuf), "%F.%T", &t);
|
||||
(void) printf("%s %s\n", tbuf, cmd);
|
||||
printed = B_TRUE;
|
||||
|
||||
next:
|
||||
if (dump_opt['h'] > 1) {
|
||||
if (!printed)
|
||||
(void) printf("unrecognized record:\n");
|
||||
dump_nvlist(events[i], 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -916,7 +950,7 @@ sprintf_blkptr_compact(char *blkbuf, const blkptr_t *bp)
|
|||
const dva_t *dva = bp->blk_dva;
|
||||
int ndvas = dump_opt['d'] > 5 ? BP_GET_NDVAS(bp) : 1;
|
||||
|
||||
if (dump_opt['b'] >= 5) {
|
||||
if (dump_opt['b'] >= 6) {
|
||||
sprintf_blkptr(blkbuf, bp);
|
||||
return;
|
||||
}
|
||||
|
|
@ -983,7 +1017,7 @@ visit_indirect(spa_t *spa, const dnode_phys_t *dnp,
|
|||
arc_buf_t *buf;
|
||||
uint64_t fill = 0;
|
||||
|
||||
err = arc_read_nolock(NULL, spa, bp, arc_getbuf_func, &buf,
|
||||
err = arc_read(NULL, spa, bp, arc_getbuf_func, &buf,
|
||||
ZIO_PRIORITY_ASYNC_READ, ZIO_FLAG_CANFAIL, &flags, zb);
|
||||
if (err)
|
||||
return (err);
|
||||
|
|
@ -1189,7 +1223,7 @@ dump_bpobj_cb(void *arg, const blkptr_t *bp, dmu_tx_t *tx)
|
|||
}
|
||||
|
||||
static void
|
||||
dump_bpobj(bpobj_t *bpo, char *name)
|
||||
dump_bpobj(bpobj_t *bpo, char *name, int indent)
|
||||
{
|
||||
char bytes[32];
|
||||
char comp[32];
|
||||
|
|
@ -1199,31 +1233,57 @@ dump_bpobj(bpobj_t *bpo, char *name)
|
|||
return;
|
||||
|
||||
zdb_nicenum(bpo->bpo_phys->bpo_bytes, bytes);
|
||||
if (bpo->bpo_havesubobj) {
|
||||
if (bpo->bpo_havesubobj && bpo->bpo_phys->bpo_subobjs != 0) {
|
||||
zdb_nicenum(bpo->bpo_phys->bpo_comp, comp);
|
||||
zdb_nicenum(bpo->bpo_phys->bpo_uncomp, uncomp);
|
||||
(void) printf("\n %s: %llu local blkptrs, %llu subobjs, "
|
||||
"%s (%s/%s comp)\n",
|
||||
name, (u_longlong_t)bpo->bpo_phys->bpo_num_blkptrs,
|
||||
(void) printf(" %*s: object %llu, %llu local blkptrs, "
|
||||
"%llu subobjs, %s (%s/%s comp)\n",
|
||||
indent * 8, name,
|
||||
(u_longlong_t)bpo->bpo_object,
|
||||
(u_longlong_t)bpo->bpo_phys->bpo_num_blkptrs,
|
||||
(u_longlong_t)bpo->bpo_phys->bpo_num_subobjs,
|
||||
bytes, comp, uncomp);
|
||||
|
||||
for (uint64_t i = 0; i < bpo->bpo_phys->bpo_num_subobjs; i++) {
|
||||
uint64_t subobj;
|
||||
bpobj_t subbpo;
|
||||
int error;
|
||||
VERIFY0(dmu_read(bpo->bpo_os,
|
||||
bpo->bpo_phys->bpo_subobjs,
|
||||
i * sizeof (subobj), sizeof (subobj), &subobj, 0));
|
||||
error = bpobj_open(&subbpo, bpo->bpo_os, subobj);
|
||||
if (error != 0) {
|
||||
(void) printf("ERROR %u while trying to open "
|
||||
"subobj id %llu\n",
|
||||
error, (u_longlong_t)subobj);
|
||||
continue;
|
||||
}
|
||||
dump_bpobj(&subbpo, "subobj", indent + 1);
|
||||
bpobj_close(&subbpo);
|
||||
}
|
||||
} else {
|
||||
(void) printf("\n %s: %llu blkptrs, %s\n",
|
||||
name, (u_longlong_t)bpo->bpo_phys->bpo_num_blkptrs, bytes);
|
||||
(void) printf(" %*s: object %llu, %llu blkptrs, %s\n",
|
||||
indent * 8, name,
|
||||
(u_longlong_t)bpo->bpo_object,
|
||||
(u_longlong_t)bpo->bpo_phys->bpo_num_blkptrs,
|
||||
bytes);
|
||||
}
|
||||
|
||||
if (dump_opt['d'] < 5)
|
||||
return;
|
||||
|
||||
(void) printf("\n");
|
||||
|
||||
(void) bpobj_iterate_nofree(bpo, dump_bpobj_cb, NULL, NULL);
|
||||
if (indent == 0) {
|
||||
(void) bpobj_iterate_nofree(bpo, dump_bpobj_cb, NULL, NULL);
|
||||
(void) printf("\n");
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
dump_deadlist(dsl_deadlist_t *dl)
|
||||
{
|
||||
dsl_deadlist_entry_t *dle;
|
||||
uint64_t unused;
|
||||
char bytes[32];
|
||||
char comp[32];
|
||||
char uncomp[32];
|
||||
|
|
@ -1242,14 +1302,24 @@ dump_deadlist(dsl_deadlist_t *dl)
|
|||
|
||||
(void) printf("\n");
|
||||
|
||||
/* force the tree to be loaded */
|
||||
dsl_deadlist_space_range(dl, 0, UINT64_MAX, &unused, &unused, &unused);
|
||||
|
||||
for (dle = avl_first(&dl->dl_tree); dle;
|
||||
dle = AVL_NEXT(&dl->dl_tree, dle)) {
|
||||
(void) printf(" mintxg %llu -> obj %llu\n",
|
||||
(longlong_t)dle->dle_mintxg,
|
||||
(longlong_t)dle->dle_bpobj.bpo_object);
|
||||
if (dump_opt['d'] >= 5) {
|
||||
char buf[128];
|
||||
(void) snprintf(buf, sizeof (buf), "mintxg %llu -> ",
|
||||
(longlong_t)dle->dle_mintxg,
|
||||
(longlong_t)dle->dle_bpobj.bpo_object);
|
||||
|
||||
if (dump_opt['d'] >= 5)
|
||||
dump_bpobj(&dle->dle_bpobj, "");
|
||||
dump_bpobj(&dle->dle_bpobj, buf, 0);
|
||||
} else {
|
||||
(void) printf("mintxg %llu -> obj %llu\n",
|
||||
(longlong_t)dle->dle_mintxg,
|
||||
(longlong_t)dle->dle_bpobj.bpo_object);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1272,7 +1342,7 @@ fuid_table_destroy()
|
|||
* print uid or gid information.
|
||||
* For normal POSIX id just the id is printed in decimal format.
|
||||
* For CIFS files with FUID the fuid is printed in hex followed by
|
||||
* the doman-rid string.
|
||||
* the domain-rid string.
|
||||
*/
|
||||
static void
|
||||
print_idstr(uint64_t id, const char *id_type)
|
||||
|
|
@ -1460,7 +1530,7 @@ static object_viewer_t *object_viewer[DMU_OT_NUMTYPES + 1] = {
|
|||
dump_zap, /* other ZAP */
|
||||
dump_zap, /* persistent error log */
|
||||
dump_uint8, /* SPA history */
|
||||
dump_uint64, /* SPA history offsets */
|
||||
dump_history_offsets, /* SPA history offsets */
|
||||
dump_zap, /* Pool properties */
|
||||
dump_zap, /* DSL permissions */
|
||||
dump_acl, /* ZFS ACL */
|
||||
|
|
@ -1625,7 +1695,9 @@ dump_dir(objset_t *os)
|
|||
int print_header = 1;
|
||||
int i, error;
|
||||
|
||||
dsl_pool_config_enter(dmu_objset_pool(os), FTAG);
|
||||
dmu_objset_fast_stat(os, &dds);
|
||||
dsl_pool_config_exit(dmu_objset_pool(os), FTAG);
|
||||
|
||||
if (dds.dds_type < DMU_OST_NUMTYPES)
|
||||
type = objset_types[dds.dds_type];
|
||||
|
|
@ -1917,11 +1989,13 @@ dump_one_dir(const char *dsname, void *arg)
|
|||
/*
|
||||
* Block statistics.
|
||||
*/
|
||||
#define PSIZE_HISTO_SIZE (SPA_MAXBLOCKSIZE / SPA_MINBLOCKSIZE + 1)
|
||||
typedef struct zdb_blkstats {
|
||||
uint64_t zb_asize;
|
||||
uint64_t zb_lsize;
|
||||
uint64_t zb_psize;
|
||||
uint64_t zb_count;
|
||||
uint64_t zb_asize;
|
||||
uint64_t zb_lsize;
|
||||
uint64_t zb_psize;
|
||||
uint64_t zb_count;
|
||||
uint64_t zb_psize_histogram[PSIZE_HISTO_SIZE];
|
||||
} zdb_blkstats_t;
|
||||
|
||||
/*
|
||||
|
|
@ -1945,6 +2019,9 @@ typedef struct zdb_cb {
|
|||
zdb_blkstats_t zcb_type[ZB_TOTAL + 1][ZDB_OT_TOTAL + 1];
|
||||
uint64_t zcb_dedup_asize;
|
||||
uint64_t zcb_dedup_blocks;
|
||||
uint64_t zcb_start;
|
||||
uint64_t zcb_lastprint;
|
||||
uint64_t zcb_totalasize;
|
||||
uint64_t zcb_errors[256];
|
||||
int zcb_readfails;
|
||||
int zcb_haderrors;
|
||||
|
|
@ -1971,6 +2048,7 @@ zdb_count_block(zdb_cb_t *zcb, zilog_t *zilog, const blkptr_t *bp,
|
|||
zb->zb_lsize += BP_GET_LSIZE(bp);
|
||||
zb->zb_psize += BP_GET_PSIZE(bp);
|
||||
zb->zb_count++;
|
||||
zb->zb_psize_histogram[BP_GET_PSIZE(bp) >> SPA_MINBLOCKSHIFT]++;
|
||||
}
|
||||
|
||||
if (dump_opt['L'])
|
||||
|
|
@ -2001,9 +2079,8 @@ zdb_count_block(zdb_cb_t *zcb, zilog_t *zilog, const blkptr_t *bp,
|
|||
bp, NULL, NULL, ZIO_FLAG_CANFAIL)), ==, 0);
|
||||
}
|
||||
|
||||
/* ARGSUSED */
|
||||
static int
|
||||
zdb_blkptr_cb(spa_t *spa, zilog_t *zilog, const blkptr_t *bp, arc_buf_t *pbuf,
|
||||
zdb_blkptr_cb(spa_t *spa, zilog_t *zilog, const blkptr_t *bp,
|
||||
const zbookmark_t *zb, const dnode_phys_t *dnp, void *arg)
|
||||
{
|
||||
zdb_cb_t *zcb = arg;
|
||||
|
|
@ -2035,7 +2112,6 @@ zdb_blkptr_cb(spa_t *spa, zilog_t *zilog, const blkptr_t *bp, arc_buf_t *pbuf,
|
|||
NULL, NULL, ZIO_PRIORITY_ASYNC_READ, flags, zb));
|
||||
|
||||
free(data);
|
||||
|
||||
if (ioerr && !(flags & ZIO_FLAG_SPECULATIVE)) {
|
||||
zcb->zcb_haderrors = 1;
|
||||
zcb->zcb_errors[ioerr]++;
|
||||
|
|
@ -2059,7 +2135,7 @@ zdb_blkptr_cb(spa_t *spa, zilog_t *zilog, const blkptr_t *bp, arc_buf_t *pbuf,
|
|||
|
||||
zcb->zcb_readfails = 0;
|
||||
|
||||
if (dump_opt['b'] >= 4) {
|
||||
if (dump_opt['b'] >= 5) {
|
||||
sprintf_blkptr(blkbuf, bp);
|
||||
(void) printf("objset %llu object %llu "
|
||||
"level %lld offset 0x%llx %s\n",
|
||||
|
|
@ -2070,6 +2146,28 @@ zdb_blkptr_cb(spa_t *spa, zilog_t *zilog, const blkptr_t *bp, arc_buf_t *pbuf,
|
|||
blkbuf);
|
||||
}
|
||||
|
||||
if (dump_opt['b'] < 5 && isatty(STDERR_FILENO) &&
|
||||
gethrtime() > zcb->zcb_lastprint + NANOSEC) {
|
||||
uint64_t now = gethrtime();
|
||||
char buf[10];
|
||||
uint64_t bytes = zcb->zcb_type[ZB_TOTAL][ZDB_OT_TOTAL].zb_asize;
|
||||
int kb_per_sec =
|
||||
1 + bytes / (1 + ((now - zcb->zcb_start) / 1000 / 1000));
|
||||
int sec_remaining =
|
||||
(zcb->zcb_totalasize - bytes) / 1024 / kb_per_sec;
|
||||
|
||||
zfs_nicenum(bytes, buf, sizeof (buf));
|
||||
(void) fprintf(stderr,
|
||||
"\r%5s completed (%4dMB/s) "
|
||||
"estimated time remaining: %uhr %02umin %02usec ",
|
||||
buf, kb_per_sec / 1024,
|
||||
sec_remaining / 60 / 60,
|
||||
sec_remaining / 60 % 60,
|
||||
sec_remaining % 60);
|
||||
|
||||
zcb->zcb_lastprint = now;
|
||||
}
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
|
@ -2161,11 +2259,11 @@ zdb_leak_init(spa_t *spa, zdb_cb_t *zcb)
|
|||
for (int m = 0; m < vd->vdev_ms_count; m++) {
|
||||
metaslab_t *msp = vd->vdev_ms[m];
|
||||
mutex_enter(&msp->ms_lock);
|
||||
space_map_unload(&msp->ms_map);
|
||||
VERIFY(space_map_load(&msp->ms_map,
|
||||
space_map_unload(msp->ms_map);
|
||||
VERIFY(space_map_load(msp->ms_map,
|
||||
&zdb_space_map_ops, SM_ALLOC, &msp->ms_smo,
|
||||
spa->spa_meta_objset) == 0);
|
||||
msp->ms_map.sm_ppd = vd;
|
||||
msp->ms_map->sm_ppd = vd;
|
||||
mutex_exit(&msp->ms_lock);
|
||||
}
|
||||
}
|
||||
|
|
@ -2188,7 +2286,7 @@ zdb_leak_fini(spa_t *spa)
|
|||
for (int m = 0; m < vd->vdev_ms_count; m++) {
|
||||
metaslab_t *msp = vd->vdev_ms[m];
|
||||
mutex_enter(&msp->ms_lock);
|
||||
space_map_unload(&msp->ms_map);
|
||||
space_map_unload(msp->ms_map);
|
||||
mutex_exit(&msp->ms_lock);
|
||||
}
|
||||
}
|
||||
|
|
@ -2201,7 +2299,7 @@ count_block_cb(void *arg, const blkptr_t *bp, dmu_tx_t *tx)
|
|||
{
|
||||
zdb_cb_t *zcb = arg;
|
||||
|
||||
if (dump_opt['b'] >= 4) {
|
||||
if (dump_opt['b'] >= 5) {
|
||||
char blkbuf[BP_SPRINTF_LEN];
|
||||
sprintf_blkptr(blkbuf, bp);
|
||||
(void) printf("[%s] %s\n",
|
||||
|
|
@ -2220,7 +2318,7 @@ dump_block_stats(spa_t *spa)
|
|||
int flags = TRAVERSE_PRE | TRAVERSE_PREFETCH_METADATA | TRAVERSE_HARD;
|
||||
int leaks = 0;
|
||||
|
||||
(void) printf("\nTraversing all blocks %s%s%s%s%s...\n",
|
||||
(void) printf("\nTraversing all blocks %s%s%s%s%s...\n\n",
|
||||
(dump_opt['c'] || !dump_opt['L']) ? "to verify " : "",
|
||||
(dump_opt['c'] == 1) ? "metadata " : "",
|
||||
dump_opt['c'] ? "checksums " : "",
|
||||
|
|
@ -2256,6 +2354,8 @@ dump_block_stats(spa_t *spa)
|
|||
if (dump_opt['c'] > 1)
|
||||
flags |= TRAVERSE_PREFETCH_DATA;
|
||||
|
||||
zcb.zcb_totalasize = metaslab_class_get_alloc(spa_normal_class(spa));
|
||||
zcb.zcb_start = zcb.zcb_lastprint = gethrtime();
|
||||
zcb.zcb_haderrors |= traverse_pool(spa, 0, flags, zdb_blkptr_cb, &zcb);
|
||||
|
||||
if (zcb.zcb_haderrors) {
|
||||
|
|
@ -2383,6 +2483,14 @@ dump_block_stats(spa_t *spa)
|
|||
else
|
||||
(void) printf(" L%d %s\n",
|
||||
level, typename);
|
||||
|
||||
if (dump_opt['b'] >= 4) {
|
||||
(void) printf("psize "
|
||||
"(in 512-byte sectors): "
|
||||
"number of blocks\n");
|
||||
dump_histogram(zb->zb_psize_histogram,
|
||||
PSIZE_HISTO_SIZE);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2410,7 +2518,7 @@ typedef struct zdb_ddt_entry {
|
|||
/* ARGSUSED */
|
||||
static int
|
||||
zdb_ddt_add_cb(spa_t *spa, zilog_t *zilog, const blkptr_t *bp,
|
||||
arc_buf_t *pbuf, const zbookmark_t *zb, const dnode_phys_t *dnp, void *arg)
|
||||
const zbookmark_t *zb, const dnode_phys_t *dnp, void *arg)
|
||||
{
|
||||
avl_tree_t *t = arg;
|
||||
avl_index_t where;
|
||||
|
|
@ -2530,10 +2638,11 @@ dump_zpool(spa_t *spa)
|
|||
if (dump_opt['d'] || dump_opt['i']) {
|
||||
dump_dir(dp->dp_meta_objset);
|
||||
if (dump_opt['d'] >= 3) {
|
||||
dump_bpobj(&spa->spa_deferred_bpobj, "Deferred frees");
|
||||
dump_bpobj(&spa->spa_deferred_bpobj,
|
||||
"Deferred frees", 0);
|
||||
if (spa_version(spa) >= SPA_VERSION_DEADLISTS) {
|
||||
dump_bpobj(&spa->spa_dsl_pool->dp_free_bpobj,
|
||||
"Pool snapshot frees");
|
||||
"Pool snapshot frees", 0);
|
||||
}
|
||||
|
||||
if (spa_feature_is_active(spa,
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue