# # 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 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # include $(SRC)/Makefile.master # Hammerhead: amd64-only, removed architecture-specific test dirs # Original: SUBDIRS= common $(MACH:i386=i386 i86xpv) SUBDIRS= common include ../Makefile.subdirs dstyle : TARGET += dstyle check: FRC @$(ECHO) "checking dstyle" @$(MAKE) dstyle dstyle: $(SUBDIRS) # # 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 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # Copyright (c) 2018, Joyent, Inc. include $(SRC)/cmd/Makefile.cmd .KEEP_STATE: ROOTOPTPKG = $(ROOT)/opt/SUNWdtrt ROOTTST = $(ROOTOPTPKG)/tst SUBDIR = $(shell basename `pwd`) TSTDIR = $(ROOTTST)/$(SUBDIR) DSTYLE = $(ROOTOPTPKG)/bin/dstyle # Hammerhead: exclude nfs/tst.call3.c (requires rpcgen-generated nfs_prot.c) CSRCS = $(shell find . -name SCCS -prune -o -name *.c -print | grep -v nfs/tst.call3.c | cut -b3-) SSRCS = $(shell find . -name SCCS -prune -o -name *.S -print | cut -b3-) DSRCS = $(shell find . -name SCCS -prune -o -name *.d -print | cut -b3-) # Hammerhead: Fixed $(shell) syntax for GNU Make compatibility TSTS = $(shell find . -name 'tst.*.d' -o -name 'err.*.d' -o -name 'tst.*.d.out' -o -name 'err.*.d.out' -o -name 'tst.*.ksh' -o -name 'err.*.ksh' -o -name 'tst.*.ksh.out' -o -name 'drp.*.d' -o -name 'get.*.pl') EXES = $(shell find . -name SCCS -prune -o \( -name '*.exe' -o -name '*.pl' \) -print | cut -b3-) EXES += $(CSRCS:%.c=%.exe) EXES += $(SSRCS:%.S=%.exe) ROOT_TSTS = $(TSTS:%=$(TSTDIR)/%) ROOT_EXES = $(EXES:%=$(TSTDIR)/%) $(ROOT_TSTS) : FILEMODE = 0444 $(ROOT_EXES) : FILEMODE = 0555 # The DTrace tests rely on "normal" behaviour from the compiler which # agressive optimization of small, simple, one compilation-unit programs may # utterly subvert. We force the compiler to not optimize rather than engage # in an arms race with increasingly belligerent optimizers. # Hammerhead: Changed from -xO0 (Sun Studio) to -O0 (GCC) COPTFLAG= -O0 CERRWARN += -Wno-switch CERRWARN += -Wno-unused-variable CERRWARN += -Wno-implicit-function-declaration CERRWARN += -Wno-unused-function CERRWARN += -Wno-unused-variable # Hammerhead: Suppress pointer/int cast warnings in legacy code CERRWARN += -Wno-pointer-to-int-cast CERRWARN += -Wno-int-to-pointer-cast # not linted SMATCH=off all: $(EXES) clean lint: clobber: FRC -$(RM) $(CSRCS:%.c=%.exe) $(CSRCS:%.c=%.o) -$(RM) $(SSRCS:%.S=%.exe) $(SSRCS:%.S=%.o) -$(RM) $(DSRCS:%.d=%.o) -$(RM) $(CLOBBERFILES) install: $(ROOT_TSTS) $(ROOT_EXES) $(ROOT_TSTS): $(TSTDIR) $(ROOT_EXES): $(TSTDIR) $(TSTDIR): $(INS.dir) $(TSTDIR)/%: % $(INS) -s -d -m $(DIRMODE) $(@D) $(INS.file) %.exe: %.c $(LINK.c) -o $@ $< $(LDLIBS) $(POST_PROCESS) ; $(STRIP_STABS) %.exe: %.o $(LINK.c) -o $@ $< $(LDLIBS) $(POST_PROCESS) ; $(STRIP_STABS) %.o: %.c $(COMPILE.c) -o $@ $< $(POST_PROCESS_O) %.o: %.S $(COMPILE.s) -o $@ $< $(POST_PROCESS_O) scripts: FRC @cd ../cmd/scripts; pwd; $(MAKE) install dstyle: FRC @if [ -n "$(DSRCS)" ]; then $(DSTYLE) $(DSRCS); fi FRC: # # 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 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # # Copyright (c) 2012 by Delphix. All rights reserved. # Copyright 2015 Nexenta Systems, Inc. All rights reserved. # Copyright 2018 Joyent, Inc. # Copyright 2022 Oxide Computer Company # # # WARNING: Do not include Makefile.ctf here. That will cause tests to # break. # include $(SRC)/Makefile.master include ../Makefile.com SNOOPDIR = $(SRC)/cmd/cmd-inet/usr.sbin/snoop SNOOPOBJS = nfs4_xdr.o SNOOPSRCS = ${SNOOPOBJS:%.o=%.c} CLOBBERFILES += nfs/$(SNOOPOBJS) # Hammerhead: NFS rpcgen test disabled (rpcgen removed from build, NFS planned for removal) # RPCSVCDIR = $(SRC)/head/rpcsvc # RPCSVCOBJS = nfs_prot.o # RPCSVCSRCS = ${RPCSVCOBJS:%o=%c} # CLOBBERFILES += nfs/$(RPCSVCOBJS) $(RPCSVCDIR)/$(RPCSVCSRCS) CLOBBERFILES += usdt/forker.h usdt/lazyprobe.h fasttrap/tst.fasttrap.exe : LDLIBS += -ldtrace fasttrap/tst.stack.exe : LDLIBS += -ldtrace ip/msnc.exe : LDLIBS += -lsocket sysevent/tst.post.exe : LDLIBS += -lsysevent sysevent/tst.post_chan.exe : LDLIBS += -lsysevent # Hammerhead: USDT test executables link dtrace-generated objects containing # dlink_init.c which calls dlinfo() - GNU ld requires explicit -ldl json/tst.usdt.exe : LDLIBS += -ldl usdt/tst.args.exe : LDLIBS += -ldl usdt/tst.argmap.exe : LDLIBS += -ldl usdt/tst.forker.exe : LDLIBS += -ldl usdt/tst.lazyprobe.exe : LDLIBS += -ldl # Hammerhead: Changed from -xO1 (Sun Studio) to -O1 (GCC) ustack/tst.bigstack.exe : COPTFLAG += -O1 CSTD = $(CSTD_GNU99) nfs/%.o: $(SNOOPDIR)/%.c $(COMPILE.c) -o $@ $< -I$(SNOOPDIR) $(POST_PROCESS_O) nfs/tst.call.exe: nfs/tst.call.o nfs/$(SNOOPOBJS) $(LINK.c) -o $@ nfs/tst.call.o nfs/$(SNOOPOBJS) $(LDLIBS) -lnsl $(POST_PROCESS) ; $(STRIP_STABS) # Hammerhead: NFS rpcgen test disabled (rpcgen removed from build) # $(RPCSVCDIR)/%.c: $(RPCSVCDIR)/%.x # $(RPCGEN) -Cc $< > $@ # nfs/$(RPCSVCOBJS): $(RPCSVCDIR)/$(RPCSVCSRCS) # $(COMPILE.c) -o $@ $(RPCSVCDIR)/$(RPCSVCSRCS) # nfs/tst.call3.exe: nfs/tst.call3.o nfs/$(RPCSVCOBJS) # $(LINK.c) -o $@ nfs/tst.call3.o nfs/$(RPCSVCOBJS) \ # $(LDLIBS) -lnsl -lrpcsvc json/tst.usdt.o: json/usdt.h json/usdt.h: json/usdt.d $(DTRACE) -h -s json/usdt.d -o json/usdt.h CLOBBERFILES += json/usdt.h json/usdt.o: json/usdt.d json/tst.usdt.o $(COMPILE.d) -o json/usdt.o -s json/usdt.d json/tst.usdt.o json/tst.usdt.exe: json/tst.usdt.o json/usdt.o $(LINK.c) -o json/tst.usdt.exe json/tst.usdt.o json/usdt.o $(LDLIBS) $(POST_PROCESS) ; $(STRIP_STABS) # # Tests that use the next programs rely on the binaries having valid CTF # data. # bitfields/tst.bitfields.exe: bitfields/tst.bitfields.c $(COMPILE.c) $(CTF_FLAGS) -o bitfields/tst.bitfields.o bitfields/tst.bitfields.c $(CTFCONVERT) -i -L VERSION bitfields/tst.bitfields.o $(LINK.c) -o bitfields/tst.bitfields.exe bitfields/tst.bitfields.o $(LDLIBS) $(CTFMERGE) -L VERSION -o $@ bitfields/tst.bitfields.o $(POST_PROCESS) ; $(STRIP_STABS) offsetof/tst.anon.exe: offsetof/tst.anon.c $(COMPILE.c) $(CTF_FLAGS) -o offsetof/tst.anon.o offsetof/tst.anon.c $(CTFCONVERT) -i -L VERSION offsetof/tst.anon.o $(LINK.c) -o offsetof/tst.anon.exe offsetof/tst.anon.o $(LDLIBS) $(CTFMERGE) -L VERSION -o $@ offsetof/tst.anon.o $(POST_PROCESS) ; $(STRIP_STABS) print/tst.anon.exe: print/tst.anon.c $(COMPILE.c) $(CTF_FLAGS) -o print/tst.anon.o print/tst.anon.c $(CTFCONVERT) -i -L VERSION print/tst.anon.o $(LINK.c) -o print/tst.anon.exe print/tst.anon.o $(LDLIBS) $(CTFMERGE) -L VERSION -o $@ print/tst.anon.o $(POST_PROCESS) ; $(STRIP_STABS) uctf/tst.aouttype.exe: uctf/tst.aouttype.c $(COMPILE.c) $(CTF_FLAGS) -o uctf/tst.aouttype.o uctf/tst.aouttype.c $(CTFCONVERT) -i -L VERSION uctf/tst.aouttype.o $(LINK.c) -o uctf/tst.aouttype.exe uctf/tst.aouttype.o $(LDLIBS) $(CTFMERGE) -L VERSION -o $@ uctf/tst.aouttype.o $(POST_PROCESS) ; $(STRIP_STABS) uctf/tst.chasestrings.exe: uctf/tst.chasestrings.c $(COMPILE.c) $(CTF_FLAGS) -o uctf/tst.chasestrings.o uctf/tst.chasestrings.c $(CTFCONVERT) -i -L VERSION uctf/tst.chasestrings.o $(LINK.c) -o uctf/tst.chasestrings.exe uctf/tst.chasestrings.o $(LDLIBS) $(CTFMERGE) -L VERSION -o $@ uctf/tst.chasestrings.o $(POST_PROCESS) ; $(STRIP_STABS) uctf/tst.printtype.exe: uctf/tst.printtype.c $(COMPILE.c) $(CTF_FLAGS) -o uctf/tst.printtype.o uctf/tst.printtype.c $(CTFCONVERT) -i -L VERSION uctf/tst.printtype.o $(LINK.c) -o uctf/tst.printtype.exe uctf/tst.printtype.o $(LDLIBS) $(CTFMERGE) -L VERSION -o $@ uctf/tst.printtype.o $(POST_PROCESS) ; $(STRIP_STABS) # # This program should never have any ctf data in it. # uctf/tst.libtype.exe: $(LINK.c) -o uctf/tst.libtype.exe uctf/tst.libtype.c $(LDLIBS) $(POST_PROCESS) ; $(STRIP_STABS) usdt/tst.args.exe: usdt/tst.args.o usdt/args.o $(LINK.c) -o usdt/tst.args.exe usdt/tst.args.o usdt/args.o $(LDLIBS) $(POST_PROCESS) ; $(STRIP_STABS) usdt/args.o: usdt/args.d usdt/tst.args.o $(COMPILE.d) -o usdt/args.o -s usdt/args.d usdt/tst.args.o usdt/tst.argmap.exe: usdt/tst.argmap.o usdt/argmap.o $(LINK.c) -o usdt/tst.argmap.exe \ usdt/tst.argmap.o usdt/argmap.o $(LDLIBS) $(POST_PROCESS) ; $(STRIP_STABS) usdt/argmap.o: usdt/argmap.d usdt/tst.argmap.o $(COMPILE.d) -o usdt/argmap.o -s usdt/argmap.d usdt/tst.argmap.o usdt/tst.forker.exe: usdt/tst.forker.o usdt/forker.o $(LINK.c) -o usdt/tst.forker.exe \ usdt/tst.forker.o usdt/forker.o $(LDLIBS) $(POST_PROCESS) ; $(STRIP_STABS) usdt/forker.o: usdt/forker.d usdt/tst.forker.o $(COMPILE.d) -o usdt/forker.o -s usdt/forker.d usdt/tst.forker.o usdt/tst.forker.o: usdt/forker.h usdt/forker.h: usdt/forker.d $(DTRACE) -h -s usdt/forker.d -o usdt/forker.h usdt/tst.lazyprobe.exe: usdt/tst.lazyprobe.o usdt/lazyprobe.o $(LINK.c) -o usdt/tst.lazyprobe.exe \ usdt/tst.lazyprobe.o usdt/lazyprobe.o $(LDLIBS) $(POST_PROCESS) ; $(STRIP_STABS) usdt/lazyprobe.o: usdt/lazyprobe.d usdt/tst.lazyprobe.o $(COMPILE.d) -xlazyload -o usdt/lazyprobe.o \ -s usdt/lazyprobe.d usdt/tst.lazyprobe.o usdt/tst.lazyprobe.o: usdt/lazyprobe.h usdt/lazyprobe.h: usdt/lazyprobe.d $(DTRACE) -h -s usdt/lazyprobe.d -o usdt/lazyprobe.h # Hammerhead: Removed java_api (Java DTrace API tests - no Java JDK) # SUBDIRS = java_api # include ../../Makefile.subdirs /* * 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. */ /* * ASSERTION: * An aggregation must call an aggregating function. * * SECTION: Aggregations/Aggregations * */ BEGIN { @counts["xyz"] = breakpoint(); exit(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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * ASSERTION: * An aggregation may not be used as a multi-dimensional array * * SECTION: Aggregations/Aggregations * */ BEGIN { @counts[0][2] = count(); exit(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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * ASSERTION: * An aggregation must have an aggregating function applied. * * SECTION: Aggregations/Aggregations * */ BEGIN { @a[1]; } /* * 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. */ /* * ASSERTION: * Test redefining the aggregation * * SECTION: Aggregations/Aggregations * */ BEGIN { @a = count(); } END { @a = max(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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * ASSERTION: * avg() should not accept a non-scalar value * * SECTION: Aggregations/Aggregations * */ #pragma D option quiet BEGIN { @a[pid] = avg(probefunc); } /* * 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. */ /* * ASSERTION: * max() should not accept a non-scalar value * * SECTION: Aggregations/Aggregations * */ BEGIN { @a[pid] = max(probefunc); } /* * 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. */ /* * ASSERTION: * min() should not accept a non-scalar value * * SECTION: Aggregations/Aggregations * */ BEGIN { @a[pid] = min(probefunc); } /* * 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. */ /* * ASSERTION: * quantize() should not accept a non-scalar value * * SECTION: Aggregations/Aggregations * */ BEGIN { @a[pid] = quantize(probefunc); } /* * 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 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * ASSERTION: * stddev() should not accept a non-scalar value * * SECTION: Aggregations/Aggregations * */ #pragma D option quiet BEGIN { @a[pid] = stddev(probefunc); } /* * 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. */ /* * ASSERTION: * sum() should not accept a non-scalar value * * SECTION: Aggregations/Aggregations * */ BEGIN { @a[pid] = sum(probefunc); } /* * 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. */ /* * ASSERTION: * The argument to clear() must be an aggregation. * * SECTION: Aggregations/Clearing aggregations * * */ #pragma D option quiet #pragma D option aggrate=10ms #pragma D option switchrate=10ms BEGIN { i = 0; start = timestamp; } tick-100ms /i < 20/ { @func[i%5] = sum(i * 100); i++; } tick-100ms /i == 10/ { printf("Aggregation data before clear():\n"); printa(@func); clear(count()); printf("Aggregation data after clear():\n"); printa(@func); i++; } tick-100ms /i == 20/ { printf("Final aggregation data:\n"); printa(@func); exit(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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * ASSERTION: * clear() should handle no args as an error. * * SECTION: Aggregations/Clearing aggregations * * */ #pragma D option quiet #pragma D option aggrate=10ms #pragma D option switchrate=10ms BEGIN { i = 0; start = timestamp; } tick-100ms /i < 20/ { @func[i%5] = sum(i * 100); i++; } tick-100ms /i == 10/ { printf("Aggregation data before clear():\n"); printa(@func); clear(); printf("Aggregation data after clear():\n"); printa(@func); i++; } tick-100ms /i == 20/ { printf("Final aggregation data:\n"); printa(@func); exit(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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * ASSERTION: * An aggregation must call an aggregating function, not a probe * * SECTION: Aggregations/Aggregations * */ BEGIN { @counts[0][2] = tick-1(); exit(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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * ASSERTION: * Test the use of a non-supported aggregate function. * * SECTION: Aggregations/Aggregations * */ BEGIN { @counts["badtest"] = foo(); } /* * 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. */ /* * ASSERTION: * Test using an aggregation in an expression context. * This should result in a compile-time error. * * SECTION: Aggregations/Aggregations * */ BEGIN { trace(@a + 3); } /* * 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. */ /* * ASSERTION: * Test the use of a dynamic expression as an aggregation key. * * SECTION: Aggregations/Aggregations * */ BEGIN { @t[i] = count(); } /* * 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. */ /* * ASSERTION: * Test compiling an aggregation statement that has no effect. * This should result in a compile-time error. * * SECTION: Aggregations/Aggregations * */ BEGIN { @a; } /* * 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. */ /* * ASSERTION: * Test the use of a void expression as an aggregation key. * This should result in a compile-time error. * * SECTION: Aggregations/Aggregations * */ BEGIN { @a[1, (void)0] = count(); } /* * 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. */ /* * ASSERTION: * Test the use of a dynamic expression as an aggregation key. * This should result in a compile-time error. * * SECTION: Aggregations/Aggregations * */ BEGIN { @a[0] = count(); @b[@a] = count(); } /* * 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. */ /* * ASSERTION: * Test the use of a dynamic expression as an aggregation key. * This should result in a compile-time error. * * SECTION: Aggregations/Aggregations * */ BEGIN { @a[curpsinfo] = count(); } /* * 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. */ /* * ASSERTION: * lquantize() lower bound around must be an integer constant * * SECTION: Aggregations/Aggregations * */ BEGIN { x = 'a'; @a[1] = lquantize(timestamp, x, 1000, 1); } /* * 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. */ /* * ASSERTION: * lquantize() lower bound around must be an integer constant * * SECTION: Aggregations/Aggregations * */ BEGIN { x = 'a'; @a[1] = lquantize(timestamp, x, 1000, 1); } /* * 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. */ /* * ASSERTION: * lquantize() lower bound must be a 32-bit quantity * * SECTION: Aggregations/Aggregations * */ BEGIN { @a[1] = lquantize(timestamp, 2147483657, 1000, 1); } /* * 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. */ /* * ASSERTION: * lquantize() upper bound around must be an integer constant * * SECTION: Aggregations/Aggregations * */ BEGIN { x = 'a'; @a[1] = lquantize(timestamp, 100, rand(), 1); } /* * 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. */ /* * ASSERTION: * lquantize() upper bound around must be an integer constant * * SECTION: Aggregations/Aggregations * */ BEGIN { x = 'a'; @a[1] = lquantize(timestamp, 100, 2147483657, 1); } /* * 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. */ BEGIN { @ = lquantize(0, 10, 20, 1); @ = lquantize(0, 15, 20, 1); } /* * 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. */ BEGIN { @ = lquantize(0, 10, 20, 1); @ = lquantize(0, 15, 30, 10); } /* * 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. */ BEGIN { @ = lquantize(0, 10, 20, 1); @ = lquantize(0, 10, 2000, 1); } /* * 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. */ BEGIN { @ = lquantize(0, 10, 20, 1); @ = lquantize(0, 10, 2000, 10); } /* * 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. */ BEGIN { @ = lquantize(0, 10, 20, 1); @ = lquantize(0, 10, 20, 2); } /* * 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. */ /* * ASSERTION: * Upper bound must be greater than lower bound argument * * SECTION: Aggregations/Aggregations */ #pragma D option quiet BEGIN { i = 0; } tick-1 /i < 1000/ { @a[i] = lquantize(i, 1100, -100, -100 ); i += 100; } tick-1 /i == 1000/ { exit(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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * ASSERTION: * lquantize() should not accept more than 4 arguments. * * SECTION: Aggregations/Aggregations * */ BEGIN { @a[1] = lquantize(1, 2, 3, 4, 5); } /* * 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. */ /* * ASSERTION: * Number of quantization levels must be a 16-bit quantity * * SECTION: Aggregations/Aggregations * */ BEGIN { i = 0; } tick-10ms /i < 1000/ { @a[i] = lquantize(i, 0, 1000000, 10); i += 100; } tick-10ms /i == 1000/ { exit(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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * ASSERTION: * Upper bound must be greater than lower bound argument * * SECTION: Aggregations/Aggregations * */ #pragma D option quiet BEGIN { i = 0; } tick-1 /i < 1000/ { @a[i] = lquantize(i, 0, 1100, -100); i += 100; } tick-1 /i == 1000/ { exit(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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * ASSERTION: * lquantize() step value should be a 16-bit quantity * * SECTION: Aggregations/Aggregations * */ BEGIN { i = 0; } tick-10ms /i < 1000/ { @a[i] = lquantize(i, 100, 1100, 200000 ); i += 100; } tick-10ms /i == 1000/ { exit(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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * ASSERTION: * The first argument to normalize() should be an aggregation. * * SECTION: Aggregations/Clearing aggregations * * */ #pragma D option quiet #pragma D option aggrate=1ms #pragma D option switchrate=1ms BEGIN { i = 0; start = timestamp; } tick-100ms /i < 20/ { @func[i % 5] = sum(i * 100); i++; } tick-100ms /i == 20/ { printf("normalized data:\n"); normalize(count(), 4); exit(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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * ASSERTION: * normalize() accepts 2 args - passing fewer is an error. * * SECTION: Aggregations/Clearing aggregations * * */ #pragma D option quiet #pragma D option aggrate=1ms #pragma D option switchrate=1ms BEGIN { i = 0; start = timestamp; } tick-100ms /i < 20/ { @func[i % 5] = sum(i * 100); i++; } tick-100ms /i == 20/ { printf("normalized data:\n"); normalize(@func); exit(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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * ASSERTION: * The second argument to normalize() should be a scalar. * * SECTION: Aggregations/Clearing aggregations * * */ #pragma D option quiet #pragma D option aggrate=1ms #pragma D option switchrate=1ms BEGIN { i = 0; start = timestamp; } tick-100ms /i < 20/ { @func[i % 5] = sum(i * 100); i++; } tick-100ms /i == 20/ { printf("normalized data:\n"); normalize(@func, "hello"); exit(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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * ASSERTION: * lquantize() should not accept a non-scalar value * * SECTION: Aggregations/Aggregations * */ BEGIN { @a[pid] = lquantize(probefunc, probefunc, probefunc, probefunc); } /* * 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. */ /* * ASSERTION: * avg() should not accept a call with no arguments * * SECTION: Aggregations/Aggregations * */ #pragma D option quiet BEGIN { @a[1] = avg(); } /* * 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. */ /* * ASSERTION: * avg() should not more than one argument * * SECTION: Aggregations/Aggregations * */ #pragma D option quiet BEGIN { @a[1] = avg(1, 2); } /* * 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. */ /* * ASSERTION: * count() should not accept any arguments * * SECTION: Aggregations/Aggregations * */ BEGIN { @a["badtest"] = count(1); } /* * 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. */ /* * ASSERTION: * lquantize() should not accept a call with no arguments * * SECTION: Aggregations/Aggregations * */ BEGIN { @a[1] = lquantize(); } /* * 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. */ /* * ASSERTION: * lquantize() should not have more than five (!) arguments * * SECTION: Aggregations/Aggregations * */ BEGIN { @[1] = lquantize(10, 0, 100, 1, 10, 20); } /* * 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. */ /* * ASSERTION: * max() should not accept a call with no arguments * * SECTION: Aggregations/Aggregations * */ BEGIN { @a[1] = max(); } /* * 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. */ /* * ASSERTION: * max() should not more than one argument * * SECTION: Aggregations/Aggregations * */ BEGIN { @a[1] = max(1, 2); } /* * 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. */ /* * ASSERTION: * min() should not accept a call with no arguments * * SECTION: Aggregations/Aggregations * */ BEGIN { @a[1] = min(); } /* * 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. */ /* * ASSERTION: * min() should not more than one argument * * SECTION: Aggregations/Aggregations * */ BEGIN { @a[1] = min(1, 2); } /* * 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. */ /* * ASSERTION: * quantize() should not accept a call with no arguments * * SECTION: Aggregations/Aggregations * */ BEGIN { @a[1] = quantize(); } /* * 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. */ /* * ASSERTION: * quantize() should not have more than two arguments * * SECTION: Aggregations/Aggregations * */ BEGIN { @a[1] = quantize(1, 2, 3); } /* * 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 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * ASSERTION: * stddev() should not accept a call with no arguments * * SECTION: Aggregations/Aggregations * */ #pragma D option quiet BEGIN { @a[1] = stddev(); } /* * 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 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * ASSERTION: * stddev() should not have more than one argument * * SECTION: Aggregations/Aggregations * */ #pragma D option quiet BEGIN { @a[1] = stddev(1, 2); } /* * 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. */ /* * ASSERTION: * sum() should not accept a call with no arguments * * SECTION: Aggregations/Aggregations * */ BEGIN { @a[pid] = sum(); } /* * 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. */ /* * ASSERTION: * sum() should not more than one argument * * SECTION: Aggregations/Aggregations * */ BEGIN { @a[pid] = sum(1, 2); } /* * 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. */ int i; BEGIN { trunc(i); exit(1); } /* * 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. */ BEGIN { @[0] = count(); trunc(@, 10, 20); exit(1); } /* * 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. */ BEGIN { trunc(); exit(1); } /* * 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. */ BEGIN { @[0] = count(); trunc(@, @); exit(1); } /* * This file and its contents are supplied under the terms of the * Common Development and Distribution License ("CDDL"), version 1.0. * You may only use this file in accordance with the terms of version * 1.0 of the CDDL. * * A full copy of the text of the CDDL should have accompanied this * source. A copy of the CDDL is also available via the Internet at * http://www.illumos.org/license/CDDL. */ /* * Copyright (c) 2013 Joyent, Inc. All rights reserved. */ #pragma D option quiet #pragma D option encoding=utf8 #pragma D option aggzoom tick-1ms /i++ < 320/ { @ = lquantize(i, 0, 640, 1, i); @ = lquantize(641 - i, 0, 640, 1, i); } tick-1ms /i == 320/ { printa(@); exit(0); } value ------------- Distribution ------------- count 0 | 0 1 | 1 2 |▏ 2 3 |▎ 3 4 |▍ 4 5 |▌ 5 6 |▋ 6 7 |▊ 7 8 |▉ 8 9 |█ 9 10 |█▏ 10 11 |█▎ 11 12 |█▍ 12 13 |█▌ 13 14 |█▋ 14 15 |█▊ 15 16 |█▉ 16 17 |██ 17 18 |██▏ 18 19 |██▎ 19 20 |██▍ 20 21 |██▍ 21 22 |██▌ 22 23 |██▋ 23 24 |██▊ 24 25 |██▉ 25 26 |███ 26 27 |███▏ 27 28 |███▎ 28 29 |███▍ 29 30 |███▌ 30 31 |███▋ 31 32 |███▊ 32 33 |███▉ 33 34 |████ 34 35 |████▏ 35 36 |████▎ 36 37 |████▍ 37 38 |████▌ 38 39 |████▋ 39 40 |████▊ 40 41 |████▊ 41 42 |████▉ 42 43 |█████ 43 44 |█████▏ 44 45 |█████▎ 45 46 |█████▍ 46 47 |█████▌ 47 48 |█████▋ 48 49 |█████▊ 49 50 |█████▉ 50 51 |██████ 51 52 |██████▏ 52 53 |██████▎ 53 54 |██████▍ 54 55 |██████▌ 55 56 |██████▋ 56 57 |██████▊ 57 58 |██████▉ 58 59 |███████ 59 60 |███████▏ 60 61 |███████▏ 61 62 |███████▎ 62 63 |███████▍ 63 64 |███████▌ 64 65 |███████▋ 65 66 |███████▊ 66 67 |███████▉ 67 68 |████████ 68 69 |████████▏ 69 70 |████████▎ 70 71 |████████▍ 71 72 |████████▌ 72 73 |████████▋ 73 74 |████████▊ 74 75 |████████▉ 75 76 |█████████ 76 77 |█████████▏ 77 78 |█████████▎ 78 79 |█████████▍ 79 80 |█████████▌ 80 81 |█████████▌ 81 82 |█████████▋ 82 83 |█████████▊ 83 84 |█████████▉ 84 85 |██████████ 85 86 |██████████▏ 86 87 |██████████▎ 87 88 |██████████▍ 88 89 |██████████▌ 89 90 |██████████▋ 90 91 |██████████▊ 91 92 |██████████▉ 92 93 |███████████ 93 94 |███████████▏ 94 95 |███████████▎ 95 96 |███████████▍ 96 97 |███████████▌ 97 98 |███████████▋ 98 99 |███████████▊ 99 100 |███████████▉ 100 101 |███████████▉ 101 102 |████████████ 102 103 |████████████▏ 103 104 |████████████▎ 104 105 |████████████▍ 105 106 |████████████▌ 106 107 |████████████▋ 107 108 |████████████▊ 108 109 |████████████▉ 109 110 |█████████████ 110 111 |█████████████▏ 111 112 |█████████████▎ 112 113 |█████████████▍ 113 114 |█████████████▌ 114 115 |█████████████▋ 115 116 |█████████████▊ 116 117 |█████████████▉ 117 118 |██████████████ 118 119 |██████████████▏ 119 120 |██████████████▎ 120 121 |██████████████▎ 121 122 |██████████████▍ 122 123 |██████████████▌ 123 124 |██████████████▋ 124 125 |██████████████▊ 125 126 |██████████████▉ 126 127 |███████████████ 127 128 |███████████████▏ 128 129 |███████████████▎ 129 130 |███████████████▍ 130 131 |███████████████▌ 131 132 |███████████████▋ 132 133 |███████████████▊ 133 134 |███████████████▉ 134 135 |████████████████ 135 136 |████████████████▏ 136 137 |████████████████▎ 137 138 |████████████████▍ 138 139 |████████████████▌ 139 140 |████████████████▋ 140 141 |████████████████▋ 141 142 |████████████████▊ 142 143 |████████████████▉ 143 144 |█████████████████ 144 145 |█████████████████▏ 145 146 |█████████████████▎ 146 147 |█████████████████▍ 147 148 |█████████████████▌ 148 149 |█████████████████▋ 149 150 |█████████████████▊ 150 151 |█████████████████▉ 151 152 |██████████████████ 152 153 |██████████████████▏ 153 154 |██████████████████▎ 154 155 |██████████████████▍ 155 156 |██████████████████▌ 156 157 |██████████████████▋ 157 158 |██████████████████▊ 158 159 |██████████████████▉ 159 160 |███████████████████ 160 161 |███████████████████ 161 162 |███████████████████▏ 162 163 |███████████████████▎ 163 164 |███████████████████▍ 164 165 |███████████████████▌ 165 166 |███████████████████▋ 166 167 |███████████████████▊ 167 168 |███████████████████▉ 168 169 |████████████████████ 169 170 |████████████████████▏ 170 171 |████████████████████▎ 171 172 |████████████████████▍ 172 173 |████████████████████▌ 173 174 |████████████████████▋ 174 175 |████████████████████▊ 175 176 |████████████████████▉ 176 177 |█████████████████████ 177 178 |█████████████████████▏ 178 179 |█████████████████████▎ 179 180 |█████████████████████▍ 180 181 |█████████████████████▍ 181 182 |█████████████████████▌ 182 183 |█████████████████████▋ 183 184 |█████████████████████▊ 184 185 |█████████████████████▉ 185 186 |██████████████████████ 186 187 |██████████████████████▏ 187 188 |██████████████████████▎ 188 189 |██████████████████████▍ 189 190 |██████████████████████▌ 190 191 |██████████████████████▋ 191 192 |██████████████████████▊ 192 193 |██████████████████████▉ 193 194 |███████████████████████ 194 195 |███████████████████████▏ 195 196 |███████████████████████▎ 196 197 |███████████████████████▍ 197 198 |███████████████████████▌ 198 199 |███████████████████████▋ 199 200 |███████████████████████▊ 200 201 |███████████████████████▊ 201 202 |███████████████████████▉ 202 203 |████████████████████████ 203 204 |████████████████████████▏ 204 205 |████████████████████████▎ 205 206 |████████████████████████▍ 206 207 |████████████████████████▌ 207 208 |████████████████████████▋ 208 209 |████████████████████████▊ 209 210 |████████████████████████▉ 210 211 |█████████████████████████ 211 212 |█████████████████████████▏ 212 213 |█████████████████████████▎ 213 214 |█████████████████████████▍ 214 215 |█████████████████████████▌ 215 216 |█████████████████████████▋ 216 217 |█████████████████████████▊ 217 218 |█████████████████████████▉ 218 219 |██████████████████████████ 219 220 |██████████████████████████▏ 220 221 |██████████████████████████▏ 221 222 |██████████████████████████▎ 222 223 |██████████████████████████▍ 223 224 |██████████████████████████▌ 224 225 |██████████████████████████▋ 225 226 |██████████████████████████▊ 226 227 |██████████████████████████▉ 227 228 |███████████████████████████ 228 229 |███████████████████████████▏ 229 230 |███████████████████████████▎ 230 231 |███████████████████████████▍ 231 232 |███████████████████████████▌ 232 233 |███████████████████████████▋ 233 234 |███████████████████████████▊ 234 235 |███████████████████████████▉ 235 236 |████████████████████████████ 236 237 |████████████████████████████▏ 237 238 |████████████████████████████▎ 238 239 |████████████████████████████▍ 239 240 |████████████████████████████▌ 240 241 |████████████████████████████▌ 241 242 |████████████████████████████▋ 242 243 |████████████████████████████▊ 243 244 |████████████████████████████▉ 244 245 |█████████████████████████████ 245 246 |█████████████████████████████▏ 246 247 |█████████████████████████████▎ 247 248 |█████████████████████████████▍ 248 249 |█████████████████████████████▌ 249 250 |█████████████████████████████▋ 250 251 |█████████████████████████████▊ 251 252 |█████████████████████████████▉ 252 253 |██████████████████████████████ 253 254 |██████████████████████████████▏ 254 255 |██████████████████████████████▎ 255 256 |██████████████████████████████▍ 256 257 |██████████████████████████████▌ 257 258 |██████████████████████████████▋ 258 259 |██████████████████████████████▊ 259 260 |██████████████████████████████▉ 260 261 |██████████████████████████████▉ 261 262 |███████████████████████████████ 262 263 |███████████████████████████████▏ 263 264 |███████████████████████████████▎ 264 265 |███████████████████████████████▍ 265 266 |███████████████████████████████▌ 266 267 |███████████████████████████████▋ 267 268 |███████████████████████████████▊ 268 269 |███████████████████████████████▉ 269 270 |████████████████████████████████ 270 271 |████████████████████████████████▏ 271 272 |████████████████████████████████▎ 272 273 |████████████████████████████████▍ 273 274 |████████████████████████████████▌ 274 275 |████████████████████████████████▋ 275 276 |████████████████████████████████▊ 276 277 |████████████████████████████████▉ 277 278 |█████████████████████████████████ 278 279 |█████████████████████████████████▏ 279 280 |█████████████████████████████████▎ 280 281 |█████████████████████████████████▎ 281 282 |█████████████████████████████████▍ 282 283 |█████████████████████████████████▌ 283 284 |█████████████████████████████████▋ 284 285 |█████████████████████████████████▊ 285 286 |█████████████████████████████████▉ 286 287 |██████████████████████████████████ 287 288 |██████████████████████████████████▏ 288 289 |██████████████████████████████████▎ 289 290 |██████████████████████████████████▍ 290 291 |██████████████████████████████████▌ 291 292 |██████████████████████████████████▋ 292 293 |██████████████████████████████████▊ 293 294 |██████████████████████████████████▉ 294 295 |███████████████████████████████████ 295 296 |███████████████████████████████████▏ 296 297 |███████████████████████████████████▎ 297 298 |███████████████████████████████████▍ 298 299 |███████████████████████████████████▌ 299 300 |███████████████████████████████████▋ 300 301 |███████████████████████████████████▋ 301 302 |███████████████████████████████████▊ 302 303 |███████████████████████████████████▉ 303 304 |████████████████████████████████████ 304 305 |████████████████████████████████████▏ 305 306 |████████████████████████████████████▎ 306 307 |████████████████████████████████████▍ 307 308 |████████████████████████████████████▌ 308 309 |████████████████████████████████████▋ 309 310 |████████████████████████████████████▊ 310 311 |████████████████████████████████████▉ 311 312 |█████████████████████████████████████ 312 313 |█████████████████████████████████████▏ 313 314 |█████████████████████████████████████▎ 314 315 |█████████████████████████████████████▍ 315 316 |█████████████████████████████████████▌ 316 317 |█████████████████████████████████████▋ 317 318 |█████████████████████████████████████▊ 318 319 |█████████████████████████████████████▉ 319 320 |██████████████████████████████████████ 320 321 |██████████████████████████████████████ 320 322 |█████████████████████████████████████▉ 319 323 |█████████████████████████████████████▊ 318 324 |█████████████████████████████████████▋ 317 325 |█████████████████████████████████████▌ 316 326 |█████████████████████████████████████▍ 315 327 |█████████████████████████████████████▎ 314 328 |█████████████████████████████████████▏ 313 329 |█████████████████████████████████████ 312 330 |████████████████████████████████████▉ 311 331 |████████████████████████████████████▊ 310 332 |████████████████████████████████████▋ 309 333 |████████████████████████████████████▌ 308 334 |████████████████████████████████████▍ 307 335 |████████████████████████████████████▎ 306 336 |████████████████████████████████████▏ 305 337 |████████████████████████████████████ 304 338 |███████████████████████████████████▉ 303 339 |███████████████████████████████████▊ 302 340 |███████████████████████████████████▋ 301 341 |███████████████████████████████████▋ 300 342 |███████████████████████████████████▌ 299 343 |███████████████████████████████████▍ 298 344 |███████████████████████████████████▎ 297 345 |███████████████████████████████████▏ 296 346 |███████████████████████████████████ 295 347 |██████████████████████████████████▉ 294 348 |██████████████████████████████████▊ 293 349 |██████████████████████████████████▋ 292 350 |██████████████████████████████████▌ 291 351 |██████████████████████████████████▍ 290 352 |██████████████████████████████████▎ 289 353 |██████████████████████████████████▏ 288 354 |██████████████████████████████████ 287 355 |█████████████████████████████████▉ 286 356 |█████████████████████████████████▊ 285 357 |█████████████████████████████████▋ 284 358 |█████████████████████████████████▌ 283 359 |█████████████████████████████████▍ 282 360 |█████████████████████████████████▎ 281 361 |█████████████████████████████████▎ 280 362 |█████████████████████████████████▏ 279 363 |█████████████████████████████████ 278 364 |████████████████████████████████▉ 277 365 |████████████████████████████████▊ 276 366 |████████████████████████████████▋ 275 367 |████████████████████████████████▌ 274 368 |████████████████████████████████▍ 273 369 |████████████████████████████████▎ 272 370 |████████████████████████████████▏ 271 371 |████████████████████████████████ 270 372 |███████████████████████████████▉ 269 373 |███████████████████████████████▊ 268 374 |███████████████████████████████▋ 267 375 |███████████████████████████████▌ 266 376 |███████████████████████████████▍ 265 377 |███████████████████████████████▎ 264 378 |███████████████████████████████▏ 263 379 |███████████████████████████████ 262 380 |██████████████████████████████▉ 261 381 |██████████████████████████████▉ 260 382 |██████████████████████████████▊ 259 383 |██████████████████████████████▋ 258 384 |██████████████████████████████▌ 257 385 |██████████████████████████████▍ 256 386 |██████████████████████████████▎ 255 387 |██████████████████████████████▏ 254 388 |██████████████████████████████ 253 389 |█████████████████████████████▉ 252 390 |█████████████████████████████▊ 251 391 |█████████████████████████████▋ 250 392 |█████████████████████████████▌ 249 393 |█████████████████████████████▍ 248 394 |█████████████████████████████▎ 247 395 |█████████████████████████████▏ 246 396 |█████████████████████████████ 245 397 |████████████████████████████▉ 244 398 |████████████████████████████▊ 243 399 |████████████████████████████▋ 242 400 |████████████████████████████▌ 241 401 |████████████████████████████▌ 240 402 |████████████████████████████▍ 239 403 |████████████████████████████▎ 238 404 |████████████████████████████▏ 237 405 |████████████████████████████ 236 406 |███████████████████████████▉ 235 407 |███████████████████████████▊ 234 408 |███████████████████████████▋ 233 409 |███████████████████████████▌ 232 410 |███████████████████████████▍ 231 411 |███████████████████████████▎ 230 412 |███████████████████████████▏ 229 413 |███████████████████████████ 228 414 |██████████████████████████▉ 227 415 |██████████████████████████▊ 226 416 |██████████████████████████▋ 225 417 |██████████████████████████▌ 224 418 |██████████████████████████▍ 223 419 |██████████████████████████▎ 222 420 |██████████████████████████▏ 221 421 |██████████████████████████▏ 220 422 |██████████████████████████ 219 423 |█████████████████████████▉ 218 424 |█████████████████████████▊ 217 425 |█████████████████████████▋ 216 426 |█████████████████████████▌ 215 427 |█████████████████████████▍ 214 428 |█████████████████████████▎ 213 429 |█████████████████████████▏ 212 430 |█████████████████████████ 211 431 |████████████████████████▉ 210 432 |████████████████████████▊ 209 433 |████████████████████████▋ 208 434 |████████████████████████▌ 207 435 |████████████████████████▍ 206 436 |████████████████████████▎ 205 437 |████████████████████████▏ 204 438 |████████████████████████ 203 439 |███████████████████████▉ 202 440 |███████████████████████▊ 201 441 |███████████████████████▊ 200 442 |███████████████████████▋ 199 443 |███████████████████████▌ 198 444 |███████████████████████▍ 197 445 |███████████████████████▎ 196 446 |███████████████████████▏ 195 447 |███████████████████████ 194 448 |██████████████████████▉ 193 449 |██████████████████████▊ 192 450 |██████████████████████▋ 191 451 |██████████████████████▌ 190 452 |██████████████████████▍ 189 453 |██████████████████████▎ 188 454 |██████████████████████▏ 187 455 |██████████████████████ 186 456 |█████████████████████▉ 185 457 |█████████████████████▊ 184 458 |█████████████████████▋ 183 459 |█████████████████████▌ 182 460 |█████████████████████▍ 181 461 |█████████████████████▍ 180 462 |█████████████████████▎ 179 463 |█████████████████████▏ 178 464 |█████████████████████ 177 465 |████████████████████▉ 176 466 |████████████████████▊ 175 467 |████████████████████▋ 174 468 |████████████████████▌ 173 469 |████████████████████▍ 172 470 |████████████████████▎ 171 471 |████████████████████▏ 170 472 |████████████████████ 169 473 |███████████████████▉ 168 474 |███████████████████▊ 167 475 |███████████████████▋ 166 476 |███████████████████▌ 165 477 |███████████████████▍ 164 478 |███████████████████▎ 163 479 |███████████████████▏ 162 480 |███████████████████ 161 481 |███████████████████ 160 482 |██████████████████▉ 159 483 |██████████████████▊ 158 484 |██████████████████▋ 157 485 |██████████████████▌ 156 486 |██████████████████▍ 155 487 |██████████████████▎ 154 488 |██████████████████▏ 153 489 |██████████████████ 152 490 |█████████████████▉ 151 491 |█████████████████▊ 150 492 |█████████████████▋ 149 493 |█████████████████▌ 148 494 |█████████████████▍ 147 495 |█████████████████▎ 146 496 |█████████████████▏ 145 497 |█████████████████ 144 498 |████████████████▉ 143 499 |████████████████▊ 142 500 |████████████████▋ 141 501 |████████████████▋ 140 502 |████████████████▌ 139 503 |████████████████▍ 138 504 |████████████████▎ 137 505 |████████████████▏ 136 506 |████████████████ 135 507 |███████████████▉ 134 508 |███████████████▊ 133 509 |███████████████▋ 132 510 |███████████████▌ 131 511 |███████████████▍ 130 512 |███████████████▎ 129 513 |███████████████▏ 128 514 |███████████████ 127 515 |██████████████▉ 126 516 |██████████████▊ 125 517 |██████████████▋ 124 518 |██████████████▌ 123 519 |██████████████▍ 122 520 |██████████████▎ 121 521 |██████████████▎ 120 522 |██████████████▏ 119 523 |██████████████ 118 524 |█████████████▉ 117 525 |█████████████▊ 116 526 |█████████████▋ 115 527 |█████████████▌ 114 528 |█████████████▍ 113 529 |█████████████▎ 112 530 |█████████████▏ 111 531 |█████████████ 110 532 |████████████▉ 109 533 |████████████▊ 108 534 |████████████▋ 107 535 |████████████▌ 106 536 |████████████▍ 105 537 |████████████▎ 104 538 |████████████▏ 103 539 |████████████ 102 540 |███████████▉ 101 541 |███████████▉ 100 542 |███████████▊ 99 543 |███████████▋ 98 544 |███████████▌ 97 545 |███████████▍ 96 546 |███████████▎ 95 547 |███████████▏ 94 548 |███████████ 93 549 |██████████▉ 92 550 |██████████▊ 91 551 |██████████▋ 90 552 |██████████▌ 89 553 |██████████▍ 88 554 |██████████▎ 87 555 |██████████▏ 86 556 |██████████ 85 557 |█████████▉ 84 558 |█████████▊ 83 559 |█████████▋ 82 560 |█████████▌ 81 561 |█████████▌ 80 562 |█████████▍ 79 563 |█████████▎ 78 564 |█████████▏ 77 565 |█████████ 76 566 |████████▉ 75 567 |████████▊ 74 568 |████████▋ 73 569 |████████▌ 72 570 |████████▍ 71 571 |████████▎ 70 572 |████████▏ 69 573 |████████ 68 574 |███████▉ 67 575 |███████▊ 66 576 |███████▋ 65 577 |███████▌ 64 578 |███████▍ 63 579 |███████▎ 62 580 |███████▏ 61 581 |███████▏ 60 582 |███████ 59 583 |██████▉ 58 584 |██████▊ 57 585 |██████▋ 56 586 |██████▌ 55 587 |██████▍ 54 588 |██████▎ 53 589 |██████▏ 52 590 |██████ 51 591 |█████▉ 50 592 |█████▊ 49 593 |█████▋ 48 594 |█████▌ 47 595 |█████▍ 46 596 |█████▎ 45 597 |█████▏ 44 598 |█████ 43 599 |████▉ 42 600 |████▊ 41 601 |████▊ 40 602 |████▋ 39 603 |████▌ 38 604 |████▍ 37 605 |████▎ 36 606 |████▏ 35 607 |████ 34 608 |███▉ 33 609 |███▊ 32 610 |███▋ 31 611 |███▌ 30 612 |███▍ 29 613 |███▎ 28 614 |███▏ 27 615 |███ 26 616 |██▉ 25 617 |██▊ 24 618 |██▋ 23 619 |██▌ 22 620 |██▍ 21 621 |██▍ 20 622 |██▎ 19 623 |██▏ 18 624 |██ 17 625 |█▉ 16 626 |█▊ 15 627 |█▋ 14 628 |█▌ 13 629 |█▍ 12 630 |█▎ 11 631 |█▏ 10 632 |█ 9 633 |▉ 8 634 |▊ 7 635 |▋ 6 636 |▌ 5 637 |▍ 4 638 |▎ 3 639 |▏ 2 >= 640 | 1 /* * This file and its contents are supplied under the terms of the * Common Development and Distribution License ("CDDL"), version 1.0. * You may only use this file in accordance with the terms of version * 1.0 of the CDDL. * * A full copy of the text of the CDDL should have accompanied this * source. A copy of the CDDL is also available via the Internet at * http://www.illumos.org/license/CDDL. */ /* * Copyright (c) 2013 Joyent, Inc. All rights reserved. */ #pragma D option agghist #pragma D option quiet BEGIN { @["demerit"] = sum(-10); @["wtf"] = sum(10); @["bot"] = sum(20); @bagnoogle["SOAP/XML"] = sum(1); @bagnoogle["XACML store"] = sum(5); @bagnoogle["SAML token"] = sum(6); @stalloogle["breakfast"] = sum(-5); @stalloogle["non-diet pepsi"] = sum(-20); @stalloogle["parrot"] = sum(-100); printa(@); printa(@bagnoogle); printa(@stalloogle); printf("\nzoomed:"); setopt("aggzoom"); printa(@); printa(@bagnoogle); printa(@stalloogle); exit(0); } key ------------- Distribution ------------- count demerit @@@@@| -10 wtf |@@@@@ 10 bot |@@@@@@@@@@ 20 key ------------- Distribution ------------- count SOAP/XML |@@@ 1 XACML store |@@@@@@@@@@@@@@@@@ 5 SAML token |@@@@@@@@@@@@@@@@@@@@ 6 key ------------- Distribution ------------- count parrot @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -100 non-diet pepsi @@@@@@| -20 breakfast @@| -5 zoomed: key ------------- Distribution ------------- count demerit @@@@@@@@@@| -10 wtf |@@@@@@@@@@ 10 bot |@@@@@@@@@@@@@@@@@@@ 20 key ------------- Distribution ------------- count SOAP/XML |@@@@@@@ 1 XACML store |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 5 SAML token |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 6 key ------------- Distribution ------------- count parrot @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -100 non-diet pepsi @@@@@@@@| -20 breakfast @@| -5 /* * This file and its contents are supplied under the terms of the * Common Development and Distribution License ("CDDL"), version 1.0. * You may only use this file in accordance with the terms of version * 1.0 of the CDDL. * * A full copy of the text of the CDDL should have accompanied this * source. A copy of the CDDL is also available via the Internet at * http://www.illumos.org/license/CDDL. */ /* * Copyright (c) 2013 Joyent, Inc. All rights reserved. */ #pragma D option aggpack #pragma D option encoding=ascii #pragma D option quiet BEGIN { @x = quantize(1 << 32); @y[1] = quantize(1); @z["mumble"] = quantize(1); @xx["foo", (char)1, (short)2, (long)3] = quantize(1); @neg = lquantize(-10, -10, 20, 1, -1); @neg = lquantize(-5, -10, 20, 1, 1); @neg = lquantize(0, -10, 20, 1, 1); i = 0; } tick-1ms { @a[i] = quantize(0, i); @a[i] = quantize(1, 100 - i); i++; } tick-1ms /i > 100/ { exit(0); } END { setopt("aggzoom", "true"); printa(@neg); setopt("aggzoom", "false"); printa(@neg); } min .--------------------------------. max | count < -10 : V X X : >= 20 | 1 min .--------------------------------. max | count < -10 : v x x : >= 20 | 1 min .---. max | count 2147483648 : X : 8589934592 | 1 key min .---. max | count 1 0 : X : 2 | 1 key min .---. max | count mumble 0 : X : 2 | 1 key min .---. max | count foo 1 2 3 0 : X : 2 | 1 key min .---. max | count 100 0 :X : 2 | 100 99 0 :X_ : 2 | 100 98 0 :X_ : 2 | 100 97 0 :X_ : 2 | 100 96 0 :X_ : 2 | 100 95 0 :X_ : 2 | 100 94 0 :X_ : 2 | 100 93 0 :X_ : 2 | 100 92 0 :X_ : 2 | 100 91 0 :X_ : 2 | 100 90 0 :X_ : 2 | 100 89 0 :X_ : 2 | 100 88 0 :X_ : 2 | 100 87 0 :X_ : 2 | 100 86 0 :X_ : 2 | 100 85 0 :X_ : 2 | 100 84 0 :X_ : 2 | 100 83 0 :X_ : 2 | 100 82 0 :X_ : 2 | 100 81 0 :X_ : 2 | 100 80 0 :X_ : 2 | 100 79 0 :X_ : 2 | 100 78 0 :xx : 2 | 100 77 0 :xx : 2 | 100 76 0 :xx : 2 | 100 75 0 :xx : 2 | 100 74 0 :xx : 2 | 100 73 0 :xx : 2 | 100 72 0 :xx : 2 | 100 71 0 :xx : 2 | 100 70 0 :xx : 2 | 100 69 0 :xx : 2 | 100 68 0 :xx : 2 | 100 67 0 :xx : 2 | 100 66 0 :xx : 2 | 100 65 0 :xx : 2 | 100 64 0 :xx : 2 | 100 63 0 :xx : 2 | 100 62 0 :xx : 2 | 100 61 0 :xx : 2 | 100 60 0 :xx : 2 | 100 59 0 :xx : 2 | 100 58 0 :xx : 2 | 100 57 0 :xx : 2 | 100 56 0 :xx : 2 | 100 55 0 :xx : 2 | 100 54 0 :xx : 2 | 100 53 0 :xx : 2 | 100 52 0 :xx : 2 | 100 51 0 :xx : 2 | 100 50 0 :xx : 2 | 100 49 0 :xx : 2 | 100 48 0 :xx : 2 | 100 47 0 :xx : 2 | 100 46 0 :xx : 2 | 100 45 0 :xx : 2 | 100 44 0 :xx : 2 | 100 43 0 :xx : 2 | 100 42 0 :xx : 2 | 100 41 0 :xx : 2 | 100 40 0 :xx : 2 | 100 39 0 :xx : 2 | 100 38 0 :xx : 2 | 100 37 0 :xx : 2 | 100 36 0 :xx : 2 | 100 35 0 :xx : 2 | 100 34 0 :xx : 2 | 100 33 0 :xx : 2 | 100 32 0 :xx : 2 | 100 31 0 :xx : 2 | 100 30 0 :xx : 2 | 100 29 0 :xx : 2 | 100 28 0 :xx : 2 | 100 27 0 :xx : 2 | 100 26 0 :xx : 2 | 100 25 0 :xx : 2 | 100 24 0 :xx : 2 | 100 23 0 :xx : 2 | 100 22 0 :xx : 2 | 100 21 0 :_X : 2 | 100 20 0 :_X : 2 | 100 19 0 :_X : 2 | 100 18 0 :_X : 2 | 100 17 0 :_X : 2 | 100 16 0 :_X : 2 | 100 15 0 :_X : 2 | 100 14 0 :_X : 2 | 100 13 0 :_X : 2 | 100 12 0 :_X : 2 | 100 11 0 :_X : 2 | 100 10 0 :_X : 2 | 100 9 0 :_X : 2 | 100 8 0 :_X : 2 | 100 7 0 :_X : 2 | 100 6 0 :_X : 2 | 100 5 0 :_X : 2 | 100 4 0 :_X : 2 | 100 3 0 :_X : 2 | 100 2 0 :_X : 2 | 100 1 0 :_X : 2 | 100 0 0 : X : 2 | 100 # # This file and its contents are supplied under the terms of the # Common Development and Distribution License ("CDDL"), version 1.0. # You may only use this file in accordance with the terms of version # 1.0 of the CDDL. # # A full copy of the text of the CDDL should have accompanied this # source. A copy of the CDDL is also available via the Internet at # http://www.illumos.org/license/CDDL. # # # Copyright (c) 2013 Joyent, Inc. All rights reserved. # let width=8 function outputchar { banner $3 | /bin/nawk -v line=$1 -v pos=$2 -v width=$width '{ \ for (i = 1; i <= length($0); i++) { \ if (substr($0, i, 1) == " ") \ continue; \ printf("\t@letter%d[%d] = lquantize(%d, 0, 40, 1);\n", \ line, NR, i + (pos * width)); } \ }' } function outputstr { let pos=0; let line=0 printf "#pragma D option aggpack\n#pragma D option aggsortkey\n" printf "BEGIN\n{\n" for c in `echo "$1" | /bin/nawk '{ \ for (i = 1; i <= length($0); i++) { \ c = substr($0, i, 1); \ printf("%s\n", c == " " ? "space" : \ c == "\n" ? "newline" : c); \ } \ }'`; do if [[ "$c" == "space" ]]; then let line=line+1 let pos=0 continue fi outputchar $line $pos $c let pos=pos+1 done let i=0 while [[ $i -le $line ]]; do printf "\tprinta(@letter%d);\n" $i let i=i+1 done printf "\texit(0);\n}\n" } dtrace -qs /dev/stdin -x encoding=utf8 <= 40 | 6 3 < 0 : ▂ ▂ ▂ ▂ ▂ ▂ : >= 40 | 6 4 < 0 : ▂ ▂ ▂▂▂▂▂▂ ▂ : >= 40 | 9 5 < 0 : ▂ ▂▂ ▂ ▂ ▂ ▂ : >= 40 | 7 6 < 0 : ▂▂ ▂▂ ▂ ▂ ▂ : >= 40 | 7 7 < 0 : ▂ ▂ ▂ ▂ ▂ : >= 40 | 5 key min .------------------------------------------. max | count 2 < 0 : ▂ ▂ ▂ ▂ ▂▂▂▂ ▂▂▂▂▂ : >= 40 | 13 3 < 0 : ▂▂ ▂▂ ▂ ▂ ▂ ▂ : >= 40 | 8 4 < 0 : ▂ ▂▂ ▂ ▂ ▂ ▂▂▂▂ ▂ : >= 40 | 11 5 < 0 : ▂ ▂ ▂ ▂ ▂ ▂ : >= 40 | 6 6 < 0 : ▂ ▂ ▂ ▂ ▂ ▂ ▂ : >= 40 | 7 7 < 0 : ▂ ▂ ▂▂▂▂ ▂▂▂▂ ▂ : >= 40 | 11 key min .------------------------------------------. max | count 2 < 0 : █ : >= 40 | 1 3 < 0 : █ : >= 40 | 1 4 < 0 : █ : >= 40 | 1 5 < 0 : █ : >= 40 | 1 6 < 0 : █ : >= 40 | 1 7 < 0 : █ : >= 40 | 1 key min .------------------------------------------. max | count 2 < 0 : ▂▂▂▂▂ ▂▂▂▂ : >= 40 | 9 3 < 0 : ▃ ▃ ▃ ▃ : >= 40 | 4 4 < 0 : ▃ ▃ ▃ ▃ : >= 40 | 4 5 < 0 : ▃ ▃ ▃ ▃ : >= 40 | 4 6 < 0 : ▃ ▃ ▃ ▃ : >= 40 | 4 7 < 0 : ▂▂▂▂▂ ▂▂▂▂ : >= 40 | 9 key min .------------------------------------------. max | count 2 < 0 : ▂▂▂▂▂ ▂ ▂ ▂ ▂▂▂▂ : >= 40 | 12 3 < 0 : ▂ ▂ ▂ ▂ ▂ : >= 40 | 5 4 < 0 : ▂ ▂▂▂▂▂▂ ▂ ▂▂▂▂ : >= 40 | 12 5 < 0 : ▂ ▂ ▂ ▂ ▂ : >= 40 | 5 6 < 0 : ▂ ▂ ▂ ▂ ▂ ▂ : >= 40 | 6 7 < 0 : ▂ ▂ ▂ ▂ ▂▂▂▂ : >= 40 | 8 key min .------------------------------------------. max | count 2 < 0 : X : >= 40 | 1 3 < 0 : X : >= 40 | 1 4 < 0 : X : >= 40 | 1 5 < 0 : X : >= 40 | 1 6 < 0 : X : >= 40 | 1 7 < 0 : X : >= 40 | 1 key min .------------------------------------------. max | count 2 < 0 : XX X X : >= 40 | 4 3 < 0 : X X XX XX : >= 40 | 6 4 < 0 : X X X XX X : >= 40 | 6 5 < 0 : XXXXXX X X : >= 40 | 8 6 < 0 : X X X X : >= 40 | 4 7 < 0 : X X X X : >= 40 | 4 key min .------------------------------------------. max | count 2 < 0 : X X XXXX XXXXX : >= 40 | 11 3 < 0 : XX X X X X : >= 40 | 6 4 < 0 : X X X X X X : >= 40 | 6 5 < 0 : X X X X X X : >= 40 | 6 6 < 0 : X XX X X X : >= 40 | 6 7 < 0 : X X XXXX X : >= 40 | 7 key min .------------------------------------------. max | count 2 < 0 : X X XXXXXX X X : >= 40 | 10 3 < 0 : X X X X X : >= 40 | 5 4 < 0 : X X XXXXX X X : >= 40 | 9 5 < 0 : X XX X X X X : >= 40 | 7 6 < 0 : XX XX X X X : >= 40 | 7 7 < 0 : X X XXXXXX XXXXXX XXXXXX : >= 40 | 20 key min .------------------------------------------. max | count 2 < 0 : ████ ██████ █ █ █████ : >= 40 | 17 3 < 0 : █ █ ██ █ █ █ : >= 40 | 7 4 < 0 : ████ █████ █ █ █ █ █ : >= 40 | 14 5 < 0 : █ █ █ █ █ █ █ : >= 40 | 7 6 < 0 : █ █ █ █ ██ █ █ : >= 40 | 8 7 < 0 : ████ ██████ █ █ █████ : >= 40 | 17 key min .------------------------------------------. max | count 2 < 0 : █ █ ██████ █ █████ : >= 40 | 14 3 < 0 : █ █ █ █ █ █ : >= 40 | 6 4 < 0 : ██████ █████ █ █ █ : >= 40 | 14 5 < 0 : █ █ █ █ █████ : >= 40 | 9 6 < 0 : █ █ █ █ █ : >= 40 | 5 7 < 0 : █ █ ██████ ██████ █ : >= 40 | 15 /* * This file and its contents are supplied under the terms of the * Common Development and Distribution License ("CDDL"), version 1.0. * You may only use this file in accordance with the terms of version * 1.0 of the CDDL. * * A full copy of the text of the CDDL should have accompanied this * source. A copy of the CDDL is also available via the Internet at * http://www.illumos.org/license/CDDL. */ /* * Copyright (c) 2013 Joyent, Inc. All rights reserved. */ #pragma D option encoding=ascii #pragma D option quiet tick-1ms /i++ < 30/ { @[1] = lquantize(i, 0, 40, 1, 1000); @[2] = lquantize(i, 0, 40, 1, 1000); @[3] = lquantize(i, 0, 40, 1, 1000); } tick-1ms /i == 40/ { @[1] = lquantize(0, 0, 40, 1, 1); @[1] = lquantize(i, 0, 40, 1, 2000); @[2] = lquantize(0, 0, 40, 1, 1); @[2] = lquantize(i, 0, 40, 1, 2000); @[3] = lquantize(0, 0, 40, 1, 1); @[3] = lquantize(i, 0, 40, 1, 2000); printa(@); setopt("aggpack"); printa(@); setopt("aggzoom"); printa(@); exit(0); } 1 value ------------- Distribution ------------- count < 0 | 0 0 | 1 1 |@ 1000 2 |@ 1000 3 |@ 1000 4 |@ 1000 5 |@ 1000 6 |@ 1000 7 |@ 1000 8 |@ 1000 9 |@ 1000 10 |@ 1000 11 |@ 1000 12 |@ 1000 13 |@ 1000 14 |@ 1000 15 |@ 1000 16 |@ 1000 17 |@ 1000 18 |@ 1000 19 |@ 1000 20 |@ 1000 21 |@ 1000 22 |@ 1000 23 |@ 1000 24 |@ 1000 25 |@ 1000 26 |@ 1000 27 |@ 1000 28 |@ 1000 29 |@ 1000 30 |@ 1000 31 | 0 32 | 0 33 | 0 34 | 0 35 | 0 36 | 0 37 | 0 38 | 0 39 | 0 >= 40 |@@ 2000 2 value ------------- Distribution ------------- count < 0 | 0 0 | 1 1 |@ 1000 2 |@ 1000 3 |@ 1000 4 |@ 1000 5 |@ 1000 6 |@ 1000 7 |@ 1000 8 |@ 1000 9 |@ 1000 10 |@ 1000 11 |@ 1000 12 |@ 1000 13 |@ 1000 14 |@ 1000 15 |@ 1000 16 |@ 1000 17 |@ 1000 18 |@ 1000 19 |@ 1000 20 |@ 1000 21 |@ 1000 22 |@ 1000 23 |@ 1000 24 |@ 1000 25 |@ 1000 26 |@ 1000 27 |@ 1000 28 |@ 1000 29 |@ 1000 30 |@ 1000 31 | 0 32 | 0 33 | 0 34 | 0 35 | 0 36 | 0 37 | 0 38 | 0 39 | 0 >= 40 |@@ 2000 3 value ------------- Distribution ------------- count < 0 | 0 0 | 1 1 |@ 1000 2 |@ 1000 3 |@ 1000 4 |@ 1000 5 |@ 1000 6 |@ 1000 7 |@ 1000 8 |@ 1000 9 |@ 1000 10 |@ 1000 11 |@ 1000 12 |@ 1000 13 |@ 1000 14 |@ 1000 15 |@ 1000 16 |@ 1000 17 |@ 1000 18 |@ 1000 19 |@ 1000 20 |@ 1000 21 |@ 1000 22 |@ 1000 23 |@ 1000 24 |@ 1000 25 |@ 1000 26 |@ 1000 27 |@ 1000 28 |@ 1000 29 |@ 1000 30 |@ 1000 31 | 0 32 | 0 33 | 0 34 | 0 35 | 0 36 | 0 37 | 0 38 | 0 39 | 0 >= 40 |@@ 2000 key min .------------------------------------------. max | count 1 < 0 : _______________________________ _: >= 40 | 32001 2 < 0 : _______________________________ _: >= 40 | 32001 3 < 0 : _______________________________ _: >= 40 | 32001 key min .------------------------------------------. max | count 1 < 0 : _xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx X: >= 40 | 32001 2 < 0 : _xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx X: >= 40 | 32001 3 < 0 : _xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx X: >= 40 | 32001 /* * This file and its contents are supplied under the terms of the * Common Development and Distribution License ("CDDL"), version 1.0. * You may only use this file in accordance with the terms of version * 1.0 of the CDDL. * * A full copy of the text of the CDDL should have accompanied this * source. A copy of the CDDL is also available via the Internet at * http://www.illumos.org/license/CDDL. */ /* * Copyright (c) 2013 Joyent, Inc. All rights reserved. */ #pragma D option encoding=ascii #pragma D option quiet tick-1ms /i++ < 90/ { @ = lquantize(i, 0, 100, 1, 1000); } tick-1ms /i == 100/ { @ = lquantize(i++, 0, 100, 1, 2000); @ = lquantize(i++, 0, 100, 1, 3000); printa(@); setopt("aggzoom"); printa(@); exit(0); } value ------------- Distribution ------------- count 0 | 0 1 | 1000 2 | 1000 3 | 1000 4 | 1000 5 | 1000 6 | 1000 7 | 1000 8 | 1000 9 | 1000 10 | 1000 11 | 1000 12 | 1000 13 | 1000 14 | 1000 15 | 1000 16 | 1000 17 | 1000 18 | 1000 19 | 1000 20 | 1000 21 | 1000 22 | 1000 23 | 1000 24 | 1000 25 | 1000 26 | 1000 27 | 1000 28 | 1000 29 | 1000 30 | 1000 31 | 1000 32 | 1000 33 | 1000 34 | 1000 35 | 1000 36 | 1000 37 | 1000 38 | 1000 39 | 1000 40 | 1000 41 | 1000 42 | 1000 43 | 1000 44 | 1000 45 | 1000 46 | 1000 47 | 1000 48 | 1000 49 | 1000 50 | 1000 51 | 1000 52 | 1000 53 | 1000 54 | 1000 55 | 1000 56 | 1000 57 | 1000 58 | 1000 59 | 1000 60 | 1000 61 | 1000 62 | 1000 63 | 1000 64 | 1000 65 | 1000 66 | 1000 67 | 1000 68 | 1000 69 | 1000 70 | 1000 71 | 1000 72 | 1000 73 | 1000 74 | 1000 75 | 1000 76 | 1000 77 | 1000 78 | 1000 79 | 1000 80 | 1000 81 | 1000 82 | 1000 83 | 1000 84 | 1000 85 | 1000 86 | 1000 87 | 1000 88 | 1000 89 | 1000 90 | 1000 91 | 0 92 | 0 93 | 0 94 | 0 95 | 0 96 | 0 97 | 0 98 | 0 99 | 0 >= 100 |@@ 5000 value ------------- Distribution ------------- count 0 | 0 1 |@@@@@@@@ 1000 2 |@@@@@@@@ 1000 3 |@@@@@@@@ 1000 4 |@@@@@@@@ 1000 5 |@@@@@@@@ 1000 6 |@@@@@@@@ 1000 7 |@@@@@@@@ 1000 8 |@@@@@@@@ 1000 9 |@@@@@@@@ 1000 10 |@@@@@@@@ 1000 11 |@@@@@@@@ 1000 12 |@@@@@@@@ 1000 13 |@@@@@@@@ 1000 14 |@@@@@@@@ 1000 15 |@@@@@@@@ 1000 16 |@@@@@@@@ 1000 17 |@@@@@@@@ 1000 18 |@@@@@@@@ 1000 19 |@@@@@@@@ 1000 20 |@@@@@@@@ 1000 21 |@@@@@@@@ 1000 22 |@@@@@@@@ 1000 23 |@@@@@@@@ 1000 24 |@@@@@@@@ 1000 25 |@@@@@@@@ 1000 26 |@@@@@@@@ 1000 27 |@@@@@@@@ 1000 28 |@@@@@@@@ 1000 29 |@@@@@@@@ 1000 30 |@@@@@@@@ 1000 31 |@@@@@@@@ 1000 32 |@@@@@@@@ 1000 33 |@@@@@@@@ 1000 34 |@@@@@@@@ 1000 35 |@@@@@@@@ 1000 36 |@@@@@@@@ 1000 37 |@@@@@@@@ 1000 38 |@@@@@@@@ 1000 39 |@@@@@@@@ 1000 40 |@@@@@@@@ 1000 41 |@@@@@@@@ 1000 42 |@@@@@@@@ 1000 43 |@@@@@@@@ 1000 44 |@@@@@@@@ 1000 45 |@@@@@@@@ 1000 46 |@@@@@@@@ 1000 47 |@@@@@@@@ 1000 48 |@@@@@@@@ 1000 49 |@@@@@@@@ 1000 50 |@@@@@@@@ 1000 51 |@@@@@@@@ 1000 52 |@@@@@@@@ 1000 53 |@@@@@@@@ 1000 54 |@@@@@@@@ 1000 55 |@@@@@@@@ 1000 56 |@@@@@@@@ 1000 57 |@@@@@@@@ 1000 58 |@@@@@@@@ 1000 59 |@@@@@@@@ 1000 60 |@@@@@@@@ 1000 61 |@@@@@@@@ 1000 62 |@@@@@@@@ 1000 63 |@@@@@@@@ 1000 64 |@@@@@@@@ 1000 65 |@@@@@@@@ 1000 66 |@@@@@@@@ 1000 67 |@@@@@@@@ 1000 68 |@@@@@@@@ 1000 69 |@@@@@@@@ 1000 70 |@@@@@@@@ 1000 71 |@@@@@@@@ 1000 72 |@@@@@@@@ 1000 73 |@@@@@@@@ 1000 74 |@@@@@@@@ 1000 75 |@@@@@@@@ 1000 76 |@@@@@@@@ 1000 77 |@@@@@@@@ 1000 78 |@@@@@@@@ 1000 79 |@@@@@@@@ 1000 80 |@@@@@@@@ 1000 81 |@@@@@@@@ 1000 82 |@@@@@@@@ 1000 83 |@@@@@@@@ 1000 84 |@@@@@@@@ 1000 85 |@@@@@@@@ 1000 86 |@@@@@@@@ 1000 87 |@@@@@@@@ 1000 88 |@@@@@@@@ 1000 89 |@@@@@@@@ 1000 90 |@@@@@@@@ 1000 91 | 0 92 | 0 93 | 0 94 | 0 95 | 0 96 | 0 97 | 0 98 | 0 99 | 0 >= 100 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 5000 /* * 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. */ #pragma D option quiet int i; tick-10ms { @ = quantize(1LL << i); @ = quantize((1LL << i) + 1); @ = quantize(-(1LL << i)); @ = quantize(-(1LL << i) - 1); i++; } tick-10ms /i == 64/ { exit(0); } value ------------- Distribution ------------- count -4611686018427387904 |@ 5 -2305843009213693952 | 2 -1152921504606846976 | 2 -576460752303423488 | 2 -288230376151711744 | 2 -144115188075855872 | 2 -72057594037927936 | 2 -36028797018963968 | 2 -18014398509481984 | 2 -9007199254740992 | 2 -4503599627370496 | 2 -2251799813685248 | 2 -1125899906842624 | 2 -562949953421312 | 2 -281474976710656 | 2 -140737488355328 | 2 -70368744177664 | 2 -35184372088832 | 2 -17592186044416 | 2 -8796093022208 | 2 -4398046511104 | 2 -2199023255552 | 2 -1099511627776 | 2 -549755813888 | 2 -274877906944 | 2 -137438953472 | 2 -68719476736 | 2 -34359738368 | 2 -17179869184 | 2 -8589934592 | 2 -4294967296 | 2 -2147483648 | 2 -1073741824 | 2 -536870912 | 2 -268435456 | 2 -134217728 | 2 -67108864 | 2 -33554432 | 2 -16777216 | 2 -8388608 | 2 -4194304 | 2 -2097152 | 2 -1048576 | 2 -524288 | 2 -262144 | 2 -131072 | 2 -65536 | 2 -32768 | 2 -16384 | 2 -8192 | 2 -4096 | 2 -2048 | 2 -1024 | 2 -512 | 2 -256 | 2 -128 | 2 -64 | 2 -32 | 2 -16 | 2 -8 | 2 -4 | 2 -2 | 3 -1 | 1 0 | 0 1 | 1 2 | 3 4 | 2 8 | 2 16 | 2 32 | 2 64 | 2 128 | 2 256 | 2 512 | 2 1024 | 2 2048 | 2 4096 | 2 8192 | 2 16384 | 2 32768 | 2 65536 | 2 131072 | 2 262144 | 2 524288 | 2 1048576 | 2 2097152 | 2 4194304 | 2 8388608 | 2 16777216 | 2 33554432 | 2 67108864 | 2 134217728 | 2 268435456 | 2 536870912 | 2 1073741824 | 2 2147483648 | 2 4294967296 | 2 8589934592 | 2 17179869184 | 2 34359738368 | 2 68719476736 | 2 137438953472 | 2 274877906944 | 2 549755813888 | 2 1099511627776 | 2 2199023255552 | 2 4398046511104 | 2 8796093022208 | 2 17592186044416 | 2 35184372088832 | 2 70368744177664 | 2 140737488355328 | 2 281474976710656 | 2 562949953421312 | 2 1125899906842624 | 2 2251799813685248 | 2 4503599627370496 | 2 9007199254740992 | 2 18014398509481984 | 2 36028797018963968 | 2 72057594037927936 | 2 144115188075855872 | 2 288230376151711744 | 2 576460752303423488 | 2 1152921504606846976 | 2 2305843009213693952 | 2 4611686018427387904 | 3 /* * 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. */ /* * ASSERTION: * Positive avg() test * * SECTION: Aggregations/Aggregations * * NOTES: This is a simple verifiable positive test of the avg() function. */ #pragma D option quiet BEGIN { i = 0; } tick-10ms /i < 1000/ { @a = avg(i); i += 100; } tick-10ms /i == 1000/ { exit(0); } 450 /* * 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 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * ASSERTION: * Positive avg() test using negative values * * SECTION: Aggregations/Aggregations * * NOTES: This is a simple verifiable positive test of the avg() function. */ #pragma D option quiet BEGIN { @ = avg(0); @ = avg(-900); exit(0); } -450 /* * 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. */ /* * ASSERTION: * Positive test for clearing aggregations * * SECTION: Aggregations/Clearing aggregations * * */ #pragma D option quiet #pragma D option aggrate=1ms #pragma D option switchrate=50ms BEGIN { i = 0; start = timestamp; } tick-100ms /i < 20/ { @func[i%5] = sum(i * 100); i++; } tick-100ms /i == 10/ { printf("Aggregation data before clear():\n"); printa(@func); clear(@func); printf("Aggregation data after clear():\n"); printa(@func); i++; } tick-100ms /i == 20/ { printf("Final aggregation data:\n"); printa(@func); exit(0); } Aggregation data before clear(): 0 500 1 700 2 900 3 1100 4 1300 Aggregation data after clear(): 0 0 1 0 2 0 3 0 4 0 Final aggregation data: 0 1500 1 2700 2 2900 3 3100 4 3300 /* * 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. */ /* * ASSERTION: * Positive avg() test * * SECTION: Aggregations/Aggregations * * NOTES: * Verifies that printing a clear()'d aggregation with an avg() * aggregation function doesn't cause problems. * */ #pragma D option quiet tick-10ms /i++ < 5/ { @a = avg(timestamp); } tick-10ms /i == 5/ { exit(2); } END { clear(@a); exit(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. */ /* * ASSERTION: * Positive avg() test * * SECTION: Aggregations/Aggregations * * NOTES: * Verifies that printing a clear()'d aggregation with an avg() * aggregation function of 0 doesn't cause divide-by-zero problems. * */ #pragma D option quiet #pragma D option switchrate=50ms #pragma D option aggrate=1ms tick-100ms /(x++ % 5) == 0/ { @time = avg(0); } tick-100ms /x > 5 && x <= 20/ { printa(" %@d\n", @time); clear(@time); } tick-100ms /x > 20/ { exit(0); } 0 0 0 0 0 0 0 0 0 0 0 0 0 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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * ASSERTION: * Denormalized aggregations can be cleared * * SECTION: Aggregations/Normalization; * Aggregations/Clearing aggregations * */ #pragma D option quiet #pragma D option aggrate=1ms #pragma D option switchrate=50ms BEGIN { i = 0; start = timestamp; } tick-100ms /i != 10 || i != 20/ { @func[i%5] = sum(i * 100); i++; } tick-100ms /i == 10/ { printf("Denormalized data before clear:\n"); denormalize(@func); printa(@func); clear(@func); printf("Aggregation data after clear:\n"); printa(@func); i++ } tick-100ms /i == 20/ { printf("Final (denormalized) aggregation data:\n"); denormalize(@func); printa(@func); exit(0); } Denormalized data before clear: 0 500 1 700 2 900 3 1100 4 1300 Aggregation data after clear: 0 0 1 0 2 0 3 0 4 0 Final (denormalized) aggregation data: 0 1500 1 2700 2 2900 3 3100 4 3300 /* * 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. */ /* * ASSERTION: * Positive lquantize()/clear() test * * SECTION: Aggregations/Aggregations * * NOTES: * Verifies that printing a clear()'d aggregation with an lquantize() * aggregation function doesn't cause problems. * */ #pragma D option switchrate=50ms #pragma D option aggrate=1ms #pragma D option quiet tick-100ms { x++; @a["linear"] = lquantize(x, 0, 100, 1); @b["exp"] = quantize(x); } tick-100ms /(x % 5) == 0 && y++ < 5/ { printa(@a); printa(@b); clear(@a); clear(@b); } tick-100ms /(x % 5) == 0 && y == 5/ { exit(0); } linear value ------------- Distribution ------------- count 0 | 0 1 |@@@@@@@@ 1 2 |@@@@@@@@ 1 3 |@@@@@@@@ 1 4 |@@@@@@@@ 1 5 |@@@@@@@@ 1 6 | 0 exp value ------------- Distribution ------------- count 0 | 0 1 |@@@@@@@@ 1 2 |@@@@@@@@@@@@@@@@ 2 4 |@@@@@@@@@@@@@@@@ 2 8 | 0 linear value ------------- Distribution ------------- count 5 | 0 6 |@@@@@@@@ 1 7 |@@@@@@@@ 1 8 |@@@@@@@@ 1 9 |@@@@@@@@ 1 10 |@@@@@@@@ 1 11 | 0 exp value ------------- Distribution ------------- count 2 | 0 4 |@@@@@@@@@@@@@@@@ 2 8 |@@@@@@@@@@@@@@@@@@@@@@@@ 3 16 | 0 linear value ------------- Distribution ------------- count 10 | 0 11 |@@@@@@@@ 1 12 |@@@@@@@@ 1 13 |@@@@@@@@ 1 14 |@@@@@@@@ 1 15 |@@@@@@@@ 1 16 | 0 exp value ------------- Distribution ------------- count 4 | 0 8 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 5 16 | 0 linear value ------------- Distribution ------------- count 15 | 0 16 |@@@@@@@@ 1 17 |@@@@@@@@ 1 18 |@@@@@@@@ 1 19 |@@@@@@@@ 1 20 |@@@@@@@@ 1 21 | 0 exp value ------------- Distribution ------------- count 8 | 0 16 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 5 32 | 0 linear value ------------- Distribution ------------- count 20 | 0 21 |@@@@@@@@ 1 22 |@@@@@@@@ 1 23 |@@@@@@@@ 1 24 |@@@@@@@@ 1 25 |@@@@@@@@ 1 26 | 0 exp value ------------- Distribution ------------- count 8 | 0 16 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 5 32 | 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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * ASSERTION: * Normalized aggregation data can be cleared * * SECTION: Aggregations/Normalization; * Aggregations/Clearing aggregations * */ #pragma D option quiet #pragma D option aggrate=1ms #pragma D option switchrate=50ms BEGIN { i = 0; start = timestamp; } tick-100ms /i < 20/ { @func[i % 5] = sum(i * 100); i++; } tick-100ms /i == 10/ { printf("Normalized data before clear:\n"); normalize(@func, 5); printa(@func); clear(@func); printf("Aggregation data after clear:\n"); printa(@func); i++ } tick-100ms /i == 20/ { printf("Final (normalized) aggregation data:\n"); normalize(@func, 5); printa(@func); exit(0); } Normalized data before clear: 0 100 1 140 2 180 3 220 4 260 Aggregation data after clear: 0 0 1 0 2 0 3 0 4 0 Final (normalized) aggregation data: 0 300 1 540 2 580 3 620 4 660 /* * 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 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * ASSERTION: * Positive stddev() test * * SECTION: Aggregations/Aggregations * * NOTES: * Verifies that printing a clear()'d aggregation with an stddev() * aggregation function doesn't cause problems. * */ #pragma D option quiet tick-10ms /i++ < 5/ { @a = stddev(timestamp); } tick-10ms /i == 5/ { exit(2); } END { clear(@a); exit(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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * ASSERTION: * Postive count() test * * SECTION: Aggregations/Aggregations * */ #pragma D option quiet BEGIN { @a = count(); @a = count(); exit(0); } 2 /* * 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. */ /* * ASSERTION: * Positive count() test * * SECTION: Aggregations/Aggregations */ #pragma D option quiet BEGIN { i = 0; } tick-10ms /i != 10/ { i++; @counts["tick-count"] = count(); } tick-10ms /i == 10/ { exit(0); } tick-count 10 /* * 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. */ /* * ASSERTION: * Test multiple count() calls. * * SECTION: Aggregations/Aggregations * */ #pragma D option quiet BEGIN { i = 0; } tick-10ms /i != 10/ { i++; @counts1[execname] = count(); @counts2[execname, arg0] = count(); } tick-10ms /i == 10/ { exit(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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * ASSERTION: * Simple denormalization test * * SECTION: Aggregations/Normalization * */ #pragma D option quiet BEGIN { i = 0; start = timestamp; } tick-10ms /i < 20/ { @func[i % 5] = sum(i * 100); i++; } tick-10ms /i == 20/ { normalize(@func, 5); printf("denormalized:"); denormalize(@func); printa(@func); exit(0); } denormalized: 0 3000 1 3400 2 3800 3 4200 4 4600 /* * 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. */ /* * ASSERTION: * denormalize() should work even if normalize() isn't called. * * SECTION: Aggregations/Normalization * * */ #pragma D option quiet BEGIN { i = 0; start = timestamp; } tick-10ms /i < 20/ { @func[i%5] = sum(i * 100); i++; } tick-10ms /i == 20/ { printf("denormalized:"); denormalize(@func); exit(0); } denormalized: 0 3000 1 3400 2 3800 3 4200 4 4600 /* * 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. */ /* * ASSERTION: * Positive test for normalization() with printa() * * SECTION: Aggregations/Normalization * */ #pragma D option quiet #pragma D option aggrate=1ms #pragma D option switchrate=50ms BEGIN { i = 0; start = timestamp; } tick-100ms /i < 20/ { @func[i % 5] = sum(i * 100); i++; } tick-100ms /i == 20/ { printf("normalized data:\n"); normalize(@func, 5); printa("%u %@u\n", @func); exit(0); } normalized data: 0 600 1 680 2 760 3 840 4 920 /* * 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. */ /* * ASSERTION: * Positive aggregation test * * SECTION: Aggregations/Aggregations * */ #pragma D option quiet BEGIN { @a = count(); @b = max(1); @c[0] = count(); @d[0] = max(1); printa("\n@a = %@u\n", @a); printa("@b = %@u\n", @b); printa("@c = %@u\n", @c); printa("@d = %@u\n", @d); exit(0); } @a = 1 @b = 1 @c = 1 @d = 1 /* * 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. */ /* * ASSERTION: * Positive aggregation key test * * SECTION: Aggregations/Aggregations */ #pragma D option quiet BEGIN { i = 0; } tick-10ms /i != 5/ { i++; @counts[execname, pid, id, tid, arg0, vtimestamp ] = count(); } tick-10ms /i == 5/ { exit(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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #pragma D option quiet BEGIN { i = 0; j = 0; @tour["Ghent", i++, j] = sum(5 - j); j++; @tour["Berlin", i++, j] = sum(5 - j); j++; @tour["London", i++, j] = sum(5 - j); @tour["Dublin", i++, j] = sum(5 - j); j++; @tour["Shanghai", i++, j] = sum(5 - j); j++; @tour["Zurich", i++, j] = sum(5 - j); j++; @tour["Regina", i++, j] = sum(5 - j); @tour["Winnipeg", i++, j] = sum(5 - j); @tour["Edmonton", i++, j] = sum(5 - j); @tour["Calgary", i++, j] = sum(5 - j); @tour["Vancouver", i++, j] = sum(5 - j); @tour["Victoria", i++, j] = sum(5 - j); j++; @tour["Prague", i++, j] = sum(5 - j); @tour["London", i++, j] = sum(5 - j); j++; @tour["Brisbane", i++, j] = sum(5 - j); @tour["Sydney", i++, j] = sum(5 - j); @tour["Melbourne", i++, j] = sum(5 - j); j++; setopt("aggsortkey", "false"); setopt("aggsortkeypos", "0"); @tour["Amsterdam", i++, j] = sum(5 - j); printf("By value:\n"); printa("%20s %8d %8d %8@d\n", @tour); setopt("aggsortkey"); printf("\nBy key, position 0:\n"); printa("%20s %8d %8d %8@d\n", @tour); setopt("aggsortkeypos", "1"); printf("\nBy key, position 1:\n"); printa("%20s %8d %8d %8@d\n", @tour); setopt("aggsortkeypos", "2"); printf("\nBy key, position 2:\n"); printa("%20s %8d %8d %8@d\n", @tour); setopt("aggsortkey", "false"); setopt("aggsortkeypos", "0"); setopt("aggsortrev"); printf("\nReversed by value:\n"); printa("%20s %8d %8d %8@d\n", @tour); setopt("aggsortkey"); printf("\nReversed by key, position 0:\n"); printa("%20s %8d %8d %8@d\n", @tour); setopt("aggsortkeypos", "1"); printf("\nReversed by key, position 1:\n"); printa("%20s %8d %8d %8@d\n", @tour); setopt("aggsortkeypos", "2"); printf("\nReversed by key, position 2:\n"); printa("%20s %8d %8d %8@d\n", @tour); exit(0); } By value: Amsterdam 17 8 -3 Brisbane 14 7 -2 Melbourne 16 7 -2 Sydney 15 7 -2 London 13 6 -1 Prague 12 6 -1 Calgary 9 5 0 Edmonton 8 5 0 Regina 6 5 0 Vancouver 10 5 0 Victoria 11 5 0 Winnipeg 7 5 0 Zurich 5 4 1 Shanghai 4 3 2 Dublin 3 2 3 London 2 2 3 Berlin 1 1 4 Ghent 0 0 5 By key, position 0: Amsterdam 17 8 -3 Berlin 1 1 4 Brisbane 14 7 -2 Calgary 9 5 0 Dublin 3 2 3 Edmonton 8 5 0 Ghent 0 0 5 London 2 2 3 London 13 6 -1 Melbourne 16 7 -2 Prague 12 6 -1 Regina 6 5 0 Shanghai 4 3 2 Sydney 15 7 -2 Vancouver 10 5 0 Victoria 11 5 0 Winnipeg 7 5 0 Zurich 5 4 1 By key, position 1: Ghent 0 0 5 Berlin 1 1 4 London 2 2 3 Dublin 3 2 3 Shanghai 4 3 2 Zurich 5 4 1 Regina 6 5 0 Winnipeg 7 5 0 Edmonton 8 5 0 Calgary 9 5 0 Vancouver 10 5 0 Victoria 11 5 0 Prague 12 6 -1 London 13 6 -1 Brisbane 14 7 -2 Sydney 15 7 -2 Melbourne 16 7 -2 Amsterdam 17 8 -3 By key, position 2: Ghent 0 0 5 Berlin 1 1 4 Dublin 3 2 3 London 2 2 3 Shanghai 4 3 2 Zurich 5 4 1 Calgary 9 5 0 Edmonton 8 5 0 Regina 6 5 0 Vancouver 10 5 0 Victoria 11 5 0 Winnipeg 7 5 0 London 13 6 -1 Prague 12 6 -1 Brisbane 14 7 -2 Melbourne 16 7 -2 Sydney 15 7 -2 Amsterdam 17 8 -3 Reversed by value: Ghent 0 0 5 Berlin 1 1 4 London 2 2 3 Dublin 3 2 3 Shanghai 4 3 2 Zurich 5 4 1 Winnipeg 7 5 0 Victoria 11 5 0 Vancouver 10 5 0 Regina 6 5 0 Edmonton 8 5 0 Calgary 9 5 0 Prague 12 6 -1 London 13 6 -1 Sydney 15 7 -2 Melbourne 16 7 -2 Brisbane 14 7 -2 Amsterdam 17 8 -3 Reversed by key, position 0: Zurich 5 4 1 Winnipeg 7 5 0 Victoria 11 5 0 Vancouver 10 5 0 Sydney 15 7 -2 Shanghai 4 3 2 Regina 6 5 0 Prague 12 6 -1 Melbourne 16 7 -2 London 13 6 -1 London 2 2 3 Ghent 0 0 5 Edmonton 8 5 0 Dublin 3 2 3 Calgary 9 5 0 Brisbane 14 7 -2 Berlin 1 1 4 Amsterdam 17 8 -3 Reversed by key, position 1: Amsterdam 17 8 -3 Melbourne 16 7 -2 Sydney 15 7 -2 Brisbane 14 7 -2 London 13 6 -1 Prague 12 6 -1 Victoria 11 5 0 Vancouver 10 5 0 Calgary 9 5 0 Edmonton 8 5 0 Winnipeg 7 5 0 Regina 6 5 0 Zurich 5 4 1 Shanghai 4 3 2 Dublin 3 2 3 London 2 2 3 Berlin 1 1 4 Ghent 0 0 5 Reversed by key, position 2: Amsterdam 17 8 -3 Sydney 15 7 -2 Melbourne 16 7 -2 Brisbane 14 7 -2 Prague 12 6 -1 London 13 6 -1 Winnipeg 7 5 0 Victoria 11 5 0 Vancouver 10 5 0 Regina 6 5 0 Edmonton 8 5 0 Calgary 9 5 0 Zurich 5 4 1 Shanghai 4 3 2 London 2 2 3 Dublin 3 2 3 Berlin 1 1 4 Ghent 0 0 5 /* * 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. */ /* * ASSERTION: * Positive lquantize() test * * SECTION: Aggregations/Aggregations * * NOTES: This is verifiable simple positive test of the lquantize() function. * */ #pragma D option quiet BEGIN { i = 0; } tick-10ms /i < 1000/ { @a[i] = lquantize(i, -100, 1100, 100 ); i += 100; } tick-10ms /i == 1000/ { exit(0); } 0 value ------------- Distribution ------------- count -100 | 0 0 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 100 | 0 100 value ------------- Distribution ------------- count 0 | 0 100 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 200 | 0 200 value ------------- Distribution ------------- count 100 | 0 200 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 300 | 0 300 value ------------- Distribution ------------- count 200 | 0 300 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 400 | 0 400 value ------------- Distribution ------------- count 300 | 0 400 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 500 | 0 500 value ------------- Distribution ------------- count 400 | 0 500 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 600 | 0 600 value ------------- Distribution ------------- count 500 | 0 600 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 700 | 0 700 value ------------- Distribution ------------- count 600 | 0 700 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 800 | 0 800 value ------------- Distribution ------------- count 700 | 0 800 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 900 | 0 900 value ------------- Distribution ------------- count 800 | 0 900 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 1000 | 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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #pragma D option quiet tick-10ms /i++ < 10/ { @ = lquantize(i, 0, 10); @ = lquantize(i, 0, 10); @ = lquantize(i, 0, 10); @ = lquantize(i, 0, 10); @ = lquantize(i, 0, 10); } tick-10ms /i == 10/ { exit(0); } END { normalize(@, 5); printa(@); } value ------------- Distribution ------------- count 0 | 0 1 |@@@@ 1 2 |@@@@ 1 3 |@@@@ 1 4 |@@@@ 1 5 |@@@@ 1 6 |@@@@ 1 7 |@@@@ 1 8 |@@@@ 1 9 |@@@@ 1 >= 10 |@@@@ 1 /* * 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. */ #pragma D option quiet BEGIN { @["Nixon"] = lquantize(-20, -10, 10, 1, 25); @["Hoover"] = lquantize(20, -10, 10, 1, -100); @["Harding"] = lquantize(-10, -10, 10, 1, 15); @["Bush"] = lquantize(10, -10, 10, 1, 150); printa(@); exit(0); } Hoover value ------------- Distribution ------------- count 9 | 0 >= 10 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -100 Nixon value ------------- Distribution ------------- count < -10 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 25 -10 | 0 Harding value ------------- Distribution ------------- count < -10 | 0 -10 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 15 -9 | 0 Bush value ------------- Distribution ------------- count 9 | 0 >= 10 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 150 /* * 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. */ #pragma D option quiet /* * This test verifies that the height of the ASCII quantization bars is * determined using rounding and not truncated integer arithmetic. */ tick-10ms /i++ >= 27/ { exit(0); } tick-10ms /i > 8/ { @ = lquantize(2, 0, 4); } tick-10ms /i > 2 && i <= 8/ { @ = lquantize(1, 0, 4); } tick-10ms /i <= 2/ { @ = lquantize(0, 0, 4); } value ------------- Distribution ------------- count < 0 | 0 0 |@@@ 2 1 |@@@@@@@@@ 6 2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 19 3 | 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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #pragma D option quiet BEGIN { a = 7; b = 13; val = (-a * b) + a; } tick-1ms { incr = val % b; val += a; } tick-1ms /val == 0/ { val += a; } tick-1ms /incr != 0/ { i++; @one[i] = lquantize(0, 10, 20, 1, incr); @two[i] = lquantize(0, 1, 20, 5, incr); @three[i] = lquantize(0, 0, 20, 1, incr); @four[i] = lquantize(0, -10, 10, 1, incr); @five[i] = lquantize(0, -10, 0, 1, incr); @six[i] = lquantize(0, -10, -1, 1, incr); @seven[i] = lquantize(0, -10, -2, 1, incr); } tick-1ms /incr == 0/ { printf("Zero below the range:\n"); printa(@one); printf("\n"); printf("Zero just below the range:\n"); printa(@two); printf("\n"); printf("Zero at the bottom of the range:\n"); printa(@three); printf("\n"); printf("Zero within the range:\n"); printa(@four); printf("\n"); printf("Zero at the top of the range:\n"); printa(@five); printf("\n"); printf("Zero just above the range:\n"); printa(@six); printf("\n"); printf("Zero above the range:\n"); printa(@seven); printf("\n"); exit(0); } Zero below the range: 2 value ------------- Distribution ------------- count < 10 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -12 10 | 0 4 value ------------- Distribution ------------- count < 10 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -11 10 | 0 6 value ------------- Distribution ------------- count < 10 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -10 10 | 0 8 value ------------- Distribution ------------- count < 10 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -9 10 | 0 10 value ------------- Distribution ------------- count < 10 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -8 10 | 0 12 value ------------- Distribution ------------- count < 10 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -7 10 | 0 1 value ------------- Distribution ------------- count < 10 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -6 10 | 0 3 value ------------- Distribution ------------- count < 10 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -5 10 | 0 5 value ------------- Distribution ------------- count < 10 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -4 10 | 0 7 value ------------- Distribution ------------- count < 10 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -3 10 | 0 9 value ------------- Distribution ------------- count < 10 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -2 10 | 0 11 value ------------- Distribution ------------- count < 10 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -1 10 | 0 14 value ------------- Distribution ------------- count < 10 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 10 | 0 16 value ------------- Distribution ------------- count < 10 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 2 10 | 0 18 value ------------- Distribution ------------- count < 10 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 3 10 | 0 20 value ------------- Distribution ------------- count < 10 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 4 10 | 0 22 value ------------- Distribution ------------- count < 10 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 5 10 | 0 24 value ------------- Distribution ------------- count < 10 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 6 10 | 0 13 value ------------- Distribution ------------- count < 10 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 7 10 | 0 15 value ------------- Distribution ------------- count < 10 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 8 10 | 0 17 value ------------- Distribution ------------- count < 10 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 9 10 | 0 19 value ------------- Distribution ------------- count < 10 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 10 10 | 0 21 value ------------- Distribution ------------- count < 10 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 11 10 | 0 23 value ------------- Distribution ------------- count < 10 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 12 10 | 0 Zero just below the range: 2 value ------------- Distribution ------------- count < 1 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -12 1 | 0 4 value ------------- Distribution ------------- count < 1 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -11 1 | 0 6 value ------------- Distribution ------------- count < 1 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -10 1 | 0 8 value ------------- Distribution ------------- count < 1 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -9 1 | 0 10 value ------------- Distribution ------------- count < 1 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -8 1 | 0 12 value ------------- Distribution ------------- count < 1 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -7 1 | 0 1 value ------------- Distribution ------------- count < 1 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -6 1 | 0 3 value ------------- Distribution ------------- count < 1 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -5 1 | 0 5 value ------------- Distribution ------------- count < 1 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -4 1 | 0 7 value ------------- Distribution ------------- count < 1 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -3 1 | 0 9 value ------------- Distribution ------------- count < 1 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -2 1 | 0 11 value ------------- Distribution ------------- count < 1 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -1 1 | 0 14 value ------------- Distribution ------------- count < 1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 1 | 0 16 value ------------- Distribution ------------- count < 1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 2 1 | 0 18 value ------------- Distribution ------------- count < 1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 3 1 | 0 20 value ------------- Distribution ------------- count < 1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 4 1 | 0 22 value ------------- Distribution ------------- count < 1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 5 1 | 0 24 value ------------- Distribution ------------- count < 1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 6 1 | 0 13 value ------------- Distribution ------------- count < 1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 7 1 | 0 15 value ------------- Distribution ------------- count < 1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 8 1 | 0 17 value ------------- Distribution ------------- count < 1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 9 1 | 0 19 value ------------- Distribution ------------- count < 1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 10 1 | 0 21 value ------------- Distribution ------------- count < 1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 11 1 | 0 23 value ------------- Distribution ------------- count < 1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 12 1 | 0 Zero at the bottom of the range: 2 value ------------- Distribution ------------- count < 0 | 0 0 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -12 1 | 0 4 value ------------- Distribution ------------- count < 0 | 0 0 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -11 1 | 0 6 value ------------- Distribution ------------- count < 0 | 0 0 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -10 1 | 0 8 value ------------- Distribution ------------- count < 0 | 0 0 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -9 1 | 0 10 value ------------- Distribution ------------- count < 0 | 0 0 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -8 1 | 0 12 value ------------- Distribution ------------- count < 0 | 0 0 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -7 1 | 0 1 value ------------- Distribution ------------- count < 0 | 0 0 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -6 1 | 0 3 value ------------- Distribution ------------- count < 0 | 0 0 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -5 1 | 0 5 value ------------- Distribution ------------- count < 0 | 0 0 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -4 1 | 0 7 value ------------- Distribution ------------- count < 0 | 0 0 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -3 1 | 0 9 value ------------- Distribution ------------- count < 0 | 0 0 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -2 1 | 0 11 value ------------- Distribution ------------- count < 0 | 0 0 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -1 1 | 0 14 value ------------- Distribution ------------- count < 0 | 0 0 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 1 | 0 16 value ------------- Distribution ------------- count < 0 | 0 0 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 2 1 | 0 18 value ------------- Distribution ------------- count < 0 | 0 0 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 3 1 | 0 20 value ------------- Distribution ------------- count < 0 | 0 0 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 4 1 | 0 22 value ------------- Distribution ------------- count < 0 | 0 0 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 5 1 | 0 24 value ------------- Distribution ------------- count < 0 | 0 0 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 6 1 | 0 13 value ------------- Distribution ------------- count < 0 | 0 0 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 7 1 | 0 15 value ------------- Distribution ------------- count < 0 | 0 0 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 8 1 | 0 17 value ------------- Distribution ------------- count < 0 | 0 0 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 9 1 | 0 19 value ------------- Distribution ------------- count < 0 | 0 0 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 10 1 | 0 21 value ------------- Distribution ------------- count < 0 | 0 0 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 11 1 | 0 23 value ------------- Distribution ------------- count < 0 | 0 0 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 12 1 | 0 Zero within the range: 2 value ------------- Distribution ------------- count -1 | 0 0 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -12 1 | 0 4 value ------------- Distribution ------------- count -1 | 0 0 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -11 1 | 0 6 value ------------- Distribution ------------- count -1 | 0 0 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -10 1 | 0 8 value ------------- Distribution ------------- count -1 | 0 0 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -9 1 | 0 10 value ------------- Distribution ------------- count -1 | 0 0 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -8 1 | 0 12 value ------------- Distribution ------------- count -1 | 0 0 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -7 1 | 0 1 value ------------- Distribution ------------- count -1 | 0 0 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -6 1 | 0 3 value ------------- Distribution ------------- count -1 | 0 0 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -5 1 | 0 5 value ------------- Distribution ------------- count -1 | 0 0 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -4 1 | 0 7 value ------------- Distribution ------------- count -1 | 0 0 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -3 1 | 0 9 value ------------- Distribution ------------- count -1 | 0 0 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -2 1 | 0 11 value ------------- Distribution ------------- count -1 | 0 0 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -1 1 | 0 14 value ------------- Distribution ------------- count -1 | 0 0 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 1 | 0 16 value ------------- Distribution ------------- count -1 | 0 0 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 2 1 | 0 18 value ------------- Distribution ------------- count -1 | 0 0 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 3 1 | 0 20 value ------------- Distribution ------------- count -1 | 0 0 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 4 1 | 0 22 value ------------- Distribution ------------- count -1 | 0 0 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 5 1 | 0 24 value ------------- Distribution ------------- count -1 | 0 0 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 6 1 | 0 13 value ------------- Distribution ------------- count -1 | 0 0 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 7 1 | 0 15 value ------------- Distribution ------------- count -1 | 0 0 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 8 1 | 0 17 value ------------- Distribution ------------- count -1 | 0 0 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 9 1 | 0 19 value ------------- Distribution ------------- count -1 | 0 0 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 10 1 | 0 21 value ------------- Distribution ------------- count -1 | 0 0 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 11 1 | 0 23 value ------------- Distribution ------------- count -1 | 0 0 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 12 1 | 0 Zero at the top of the range: 2 value ------------- Distribution ------------- count -1 | 0 >= 0 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -12 4 value ------------- Distribution ------------- count -1 | 0 >= 0 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -11 6 value ------------- Distribution ------------- count -1 | 0 >= 0 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -10 8 value ------------- Distribution ------------- count -1 | 0 >= 0 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -9 10 value ------------- Distribution ------------- count -1 | 0 >= 0 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -8 12 value ------------- Distribution ------------- count -1 | 0 >= 0 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -7 1 value ------------- Distribution ------------- count -1 | 0 >= 0 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -6 3 value ------------- Distribution ------------- count -1 | 0 >= 0 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -5 5 value ------------- Distribution ------------- count -1 | 0 >= 0 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -4 7 value ------------- Distribution ------------- count -1 | 0 >= 0 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -3 9 value ------------- Distribution ------------- count -1 | 0 >= 0 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -2 11 value ------------- Distribution ------------- count -1 | 0 >= 0 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -1 14 value ------------- Distribution ------------- count -1 | 0 >= 0 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 16 value ------------- Distribution ------------- count -1 | 0 >= 0 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 2 18 value ------------- Distribution ------------- count -1 | 0 >= 0 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 3 20 value ------------- Distribution ------------- count -1 | 0 >= 0 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 4 22 value ------------- Distribution ------------- count -1 | 0 >= 0 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 5 24 value ------------- Distribution ------------- count -1 | 0 >= 0 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 6 13 value ------------- Distribution ------------- count -1 | 0 >= 0 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 7 15 value ------------- Distribution ------------- count -1 | 0 >= 0 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 8 17 value ------------- Distribution ------------- count -1 | 0 >= 0 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 9 19 value ------------- Distribution ------------- count -1 | 0 >= 0 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 10 21 value ------------- Distribution ------------- count -1 | 0 >= 0 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 11 23 value ------------- Distribution ------------- count -1 | 0 >= 0 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 12 Zero just above the range: 2 value ------------- Distribution ------------- count -2 | 0 >= -1 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -12 4 value ------------- Distribution ------------- count -2 | 0 >= -1 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -11 6 value ------------- Distribution ------------- count -2 | 0 >= -1 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -10 8 value ------------- Distribution ------------- count -2 | 0 >= -1 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -9 10 value ------------- Distribution ------------- count -2 | 0 >= -1 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -8 12 value ------------- Distribution ------------- count -2 | 0 >= -1 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -7 1 value ------------- Distribution ------------- count -2 | 0 >= -1 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -6 3 value ------------- Distribution ------------- count -2 | 0 >= -1 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -5 5 value ------------- Distribution ------------- count -2 | 0 >= -1 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -4 7 value ------------- Distribution ------------- count -2 | 0 >= -1 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -3 9 value ------------- Distribution ------------- count -2 | 0 >= -1 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -2 11 value ------------- Distribution ------------- count -2 | 0 >= -1 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -1 14 value ------------- Distribution ------------- count -2 | 0 >= -1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 16 value ------------- Distribution ------------- count -2 | 0 >= -1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 2 18 value ------------- Distribution ------------- count -2 | 0 >= -1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 3 20 value ------------- Distribution ------------- count -2 | 0 >= -1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 4 22 value ------------- Distribution ------------- count -2 | 0 >= -1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 5 24 value ------------- Distribution ------------- count -2 | 0 >= -1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 6 13 value ------------- Distribution ------------- count -2 | 0 >= -1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 7 15 value ------------- Distribution ------------- count -2 | 0 >= -1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 8 17 value ------------- Distribution ------------- count -2 | 0 >= -1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 9 19 value ------------- Distribution ------------- count -2 | 0 >= -1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 10 21 value ------------- Distribution ------------- count -2 | 0 >= -1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 11 23 value ------------- Distribution ------------- count -2 | 0 >= -1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 12 Zero above the range: 23 value ------------- Distribution ------------- count -3 | 0 >= -2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 12 21 value ------------- Distribution ------------- count -3 | 0 >= -2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 11 19 value ------------- Distribution ------------- count -3 | 0 >= -2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 10 17 value ------------- Distribution ------------- count -3 | 0 >= -2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 9 15 value ------------- Distribution ------------- count -3 | 0 >= -2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 8 13 value ------------- Distribution ------------- count -3 | 0 >= -2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 7 24 value ------------- Distribution ------------- count -3 | 0 >= -2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 6 22 value ------------- Distribution ------------- count -3 | 0 >= -2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 5 20 value ------------- Distribution ------------- count -3 | 0 >= -2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 4 18 value ------------- Distribution ------------- count -3 | 0 >= -2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 3 16 value ------------- Distribution ------------- count -3 | 0 >= -2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 2 14 value ------------- Distribution ------------- count -3 | 0 >= -2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 11 value ------------- Distribution ------------- count -3 | 0 >= -2 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -1 9 value ------------- Distribution ------------- count -3 | 0 >= -2 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -2 7 value ------------- Distribution ------------- count -3 | 0 >= -2 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -3 5 value ------------- Distribution ------------- count -3 | 0 >= -2 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -4 3 value ------------- Distribution ------------- count -3 | 0 >= -2 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -5 1 value ------------- Distribution ------------- count -3 | 0 >= -2 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -6 12 value ------------- Distribution ------------- count -3 | 0 >= -2 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -7 10 value ------------- Distribution ------------- count -3 | 0 >= -2 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -8 8 value ------------- Distribution ------------- count -3 | 0 >= -2 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -9 6 value ------------- Distribution ------------- count -3 | 0 >= -2 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -10 4 value ------------- Distribution ------------- count -3 | 0 >= -2 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -11 2 value ------------- Distribution ------------- count -3 | 0 >= -2 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -12 /* * 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. */ /* * ASSERTION: * Positive max() test * * SECTION: Aggregations/Aggregations * * NOTES: This is verifiable simple positive test of the max() function. * */ #pragma D option quiet BEGIN { i = 0; } tick-10ms /i < 1000/ { @a = max(i); i += 100; } tick-10ms /i == 1000/ { printa(@a); exit(0); } 900 /* * 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 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * ASSERTION: * Positive max() test using negative values * * SECTION: Aggregations/Aggregations * * NOTES: This is verifiable simple positive test of the max() function. * */ #pragma D option quiet BEGIN { @ = max(0); @ = max(-900); exit(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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * ASSERTION: * Positive min() test * * SECTION: Aggregations/Aggregations * * NOTES: This is verifiable simple positive test of the min() function. * */ #pragma D option quiet BEGIN { i = 0; } tick-10ms /i < 1000/ { @a = min(i); i += 100; } tick-10ms /i == 1000/ { exit(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 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * ASSERTION: * Positive min() test using negative values * * SECTION: Aggregations/Aggregations * * NOTES: This is verifiable simple positive test of the min() function. * */ #pragma D option quiet BEGIN { @ = min(0); @ = min(-900); exit (0); } -900 /* * 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 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * ASSERTION: * Multiple aggregates can be used within the same D script. * * SECTION: Aggregations/Aggregations * */ #pragma D option quiet BEGIN { time_1 = timestamp; i = 0; } tick-10ms /i <= 10/ { time_2 = timestamp; new_time = time_2 - time_1; @a[pid] = max(new_time); @b[pid] = min(new_time); @c[pid] = avg(new_time); @d[pid] = sum(new_time); @e[pid] = quantize(new_time); @f[pid] = stddev(new_time); @g[timestamp] = max(new_time); @h[timestamp] = quantize(new_time); @i[timestamp] = lquantize(new_time, 0, 10000, 1000); time_1 = time_2; i++; } tick-10ms /i == 10/ { exit(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 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * ASSERTION: * Test multiple aggregations and the default output order * * SECTION: Aggregations/Aggregations; * Aggregations/Output * */ #pragma D option quiet BEGIN { i = 0; } tick-10ms /i < 1000/ { @a = avg(i); @b = sum(i); @c = min(i); @d = max(i); @e = quantize(i); @f = lquantize(i, 0, 1000, 100); @g = stddev(i); i += 100; } tick-10ms /i == 1000/ { exit(0); } 450 4500 0 900 value ------------- Distribution ------------- count -1 | 0 0 |@@@@ 1 1 | 0 2 | 0 4 | 0 8 | 0 16 | 0 32 | 0 64 |@@@@ 1 128 |@@@@ 1 256 |@@@@@@@@@@@@ 3 512 |@@@@@@@@@@@@@@@@ 4 1024 | 0 value ------------- Distribution ------------- count < 0 | 0 0 |@@@@ 1 100 |@@@@ 1 200 |@@@@ 1 300 |@@@@ 1 400 |@@@@ 1 500 |@@@@ 1 600 |@@@@ 1 700 |@@@@ 1 800 |@@@@ 1 900 |@@@@ 1 >= 1000 | 0 287 /* * 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 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * ASSERTION: * Test multiple aggregations and overriding default order with * printa() statements. * * SECTION: Aggregations/Aggregations; * Aggregations/Output * * NOTES: This is a simple verifiable test. * */ #pragma D option quiet BEGIN { i = 0; } tick-10ms /i < 1000/ { @a = count(); @b = avg(i); @c = sum(i); @d = min(i); @e = max(i); @f = quantize(i); @g = lquantize(i, 0, 1000, 100); @h = stddev(i); i += 100; } tick-10ms /i == 1000/ { printa("%@d\n", @h); printa("%@d\n", @g); printa("%@d\n", @f); printa("%@d\n", @e); printa("%@d\n", @d); printa("%@d\n", @c); printa("%@d\n", @b); printa("%@d\n", @a); exit(0); } 287 value ------------- Distribution ------------- count < 0 | 0 0 |@@@@ 1 100 |@@@@ 1 200 |@@@@ 1 300 |@@@@ 1 400 |@@@@ 1 500 |@@@@ 1 600 |@@@@ 1 700 |@@@@ 1 800 |@@@@ 1 900 |@@@@ 1 >= 1000 | 0 value ------------- Distribution ------------- count -1 | 0 0 |@@@@ 1 1 | 0 2 | 0 4 | 0 8 | 0 16 | 0 32 | 0 64 |@@@@ 1 128 |@@@@ 1 256 |@@@@@@@@@@@@ 3 512 |@@@@@@@@@@@@@@@@ 4 1024 | 0 900 0 4500 450 10 /* * 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. */ /* * ASSERTION: * Multiple aggregations are supported * * SECTION: Aggregations/Normalization * */ #pragma D option quiet #pragma D option aggrate=1ms #pragma D option switchrate=50ms BEGIN { i = 0; start = timestamp; } tick-100ms /i < 20/ { @func1[i % 5] = sum(i * 100); @func2[i % 5 + 1] = sum(i * 200); i++; } tick-100ms /i == 20/ { printf("normalized data #1:\n"); normalize(@func1, 5); printa(@func1); printf("\nnormalized data #2:\n"); normalize(@func2, 5); exit(0); } normalized data #1: 0 600 1 680 2 760 3 840 4 920 normalized data #2: 1 1200 2 1360 3 1520 4 1680 5 1840 /* * 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. */ #pragma D option quiet BEGIN { @["j-church"] = lquantize(1, 0, 10, 1, 100); @["j-church"] = lquantize(1, 0, 10, 1, -99); @["j-church"] = lquantize(1, 0, 10, 1, -1); val = 123; } BEGIN { @["k-ingleside"] = lquantize(1, 0, 10, 1, -val); } BEGIN { @["l-taraval"] = lquantize(0, 0, 10, 1, -val); @["l-taraval"] = lquantize(-1, 0, 10, 1, -val); @["l-taraval"] = lquantize(1, 0, 10, 1, val); @["l-taraval"] = lquantize(1, 0, 10, 1, val); } BEGIN { @["m-oceanview"] = lquantize(1, 0, 10, 1, (1 << 63) - 1); @["m-oceanview"] = lquantize(1, 0, 10, 1); @["m-oceanview"] = lquantize(2, 0, 10, 1, (1 << 63) - 1); @["m-oceanview"] = lquantize(8, 0, 10, 1, 400000); } BEGIN { @["n-judah"] = lquantize(1, 0, 10, 1, val); @["n-judah"] = lquantize(2, 0, 10, 1, val); @["n-judah"] = lquantize(2, 0, 10, 1, val); @["n-judah"] = lquantize(2, 0, 10, 1); } BEGIN { this->i = 1; this->val = (1 << 63) - 1; @["f-market"] = lquantize(this->i, 0, 10, 1, this->val); this->i++; this->val = ((1 << 63) - 1) / this->i; @["f-market"] = lquantize(this->i, 0, 10, 1, this->val); this->i++; this->val = ((1 << 63) - 1) / this->i; @["f-market"] = lquantize(this->i, 0, 10, 1, this->val); this->i++; this->val = ((1 << 63) - 1) / this->i; @["f-market"] = lquantize(this->i, 0, 10, 1, this->val); this->i++; this->val = ((1 << 63) - 1) / this->i; @["f-market"] = lquantize(this->i, 0, 10, 1, this->val); this->i++; this->val = ((1 << 63) - 1) / this->i; @["f-market"] = lquantize(this->i, 0, 10, 1, this->val); this->i++; this->val = ((1 << 63) - 1) / this->i; @["f-market"] = lquantize(this->i, 0, 10, 1, this->val); this->i++; this->val = ((1 << 63) - 1) / this->i; } BEGIN { this->i = 1; /* * We want to test the ability to sort very large quantizations * that differ by a small amount. Ideally, they would differ only * by 1 -- but that is smaller than the precision of long doubles of * this magnitude on x86. To assure that the same test works on x86 * just as it does on SPARC, we pick a value that is just larger than * the precision at this magnitude. It should go without saying that * this robustness on new ISAs very much depends on the precision * of the long double representation. */ this->val = (1 << 63) - 7; @["s-castro"] = lquantize(this->i, 0, 10, 1, this->val); this->i++; this->val = ((1 << 63) - 1) / this->i; @["s-castro"] = lquantize(this->i, 0, 10, 1, this->val); this->i++; this->val = ((1 << 63) - 1) / this->i; @["s-castro"] = lquantize(this->i, 0, 10, 1, this->val); this->i++; this->val = ((1 << 63) - 1) / this->i; @["s-castro"] = lquantize(this->i, 0, 10, 1, this->val); this->i++; this->val = ((1 << 63) - 1) / this->i; @["s-castro"] = lquantize(this->i, 0, 10, 1, this->val); this->i++; this->val = ((1 << 63) - 1) / this->i; @["s-castro"] = lquantize(this->i, 0, 10, 1, this->val); this->i++; this->val = ((1 << 63) - 1) / this->i; @["s-castro"] = lquantize(this->i, 0, 10, 1, this->val); this->i++; this->val = ((1 << 63) - 1) / this->i; } BEGIN { exit(0); } k-ingleside value ------------- Distribution ------------- count 0 | 0 1 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -123 2 | 0 j-church value ------------- Distribution ------------- count < 0 | 0 0 | 0 1 | 0 l-taraval value ------------- Distribution ------------- count < 0 @@@@@| -123 0 @@@@@| -123 1 |@@@@@@@@@@ 246 2 | 0 n-judah value ------------- Distribution ------------- count 0 | 0 1 |@@@@@@@@@@@@@ 123 2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@ 247 3 | 0 m-oceanview value ------------- Distribution ------------- count 0 | 0 1 @@@@@@@@@@| -9223372036854775808 2 |@@@@@@@@@@ 9223372036854775807 3 | 0 4 | 0 5 | 0 6 | 0 7 | 0 8 | 400000 9 | 0 s-castro value ------------- Distribution ------------- count 0 | 0 1 |@@@@@@@@@@@@@@@ 9223372036854775801 2 |@@@@@@@@ 4611686018427387903 3 |@@@@@ 3074457345618258602 4 |@@@@ 2305843009213693951 5 |@@@ 1844674407370955161 6 |@@@ 1537228672809129301 7 |@@ 1317624576693539401 8 | 0 f-market value ------------- Distribution ------------- count 0 | 0 1 |@@@@@@@@@@@@@@@ 9223372036854775807 2 |@@@@@@@@ 4611686018427387903 3 |@@@@@ 3074457345618258602 4 |@@@@ 2305843009213693951 5 |@@@ 1844674407370955161 6 |@@@ 1537228672809129301 7 |@@ 1317624576693539401 8 | 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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #pragma D option quiet BEGIN { a = 7; b = 13; val = (-a * b) + a; } tick-1ms { incr = val % b; val += a; } tick-1ms /val == 0/ { val += a; } tick-1ms /incr != 0/ { i++; @quanty[i] = quantize(1, incr); @lquanty[i] = lquantize(1, -10, 10, 1, incr); @summy[i] = sum(incr); @maxxy[i] = max(incr); @minny[i] = min(incr); } tick-1ms /incr == 0/ { printf("Ordering of quantize() with some negative weights:\n"); printa(@quanty); printf("\n"); printf("Ordering of lquantize() with some negative weights:\n"); printa(@lquanty); printf("\n"); printf("Ordering of sum() with some negative weights:\n"); printa(@summy); printf("\n"); printf("Ordering of max() with some negative weights:\n"); printa(@maxxy); printf("\n"); printf("Ordering of min() with some negative weights:\n"); printa(@minny); printf("\n"); exit(0); } Ordering of quantize() with some negative weights: 2 value ------------- Distribution ------------- count 0 | 0 1 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -12 2 | 0 4 value ------------- Distribution ------------- count 0 | 0 1 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -11 2 | 0 6 value ------------- Distribution ------------- count 0 | 0 1 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -10 2 | 0 8 value ------------- Distribution ------------- count 0 | 0 1 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -9 2 | 0 10 value ------------- Distribution ------------- count 0 | 0 1 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -8 2 | 0 12 value ------------- Distribution ------------- count 0 | 0 1 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -7 2 | 0 1 value ------------- Distribution ------------- count 0 | 0 1 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -6 2 | 0 3 value ------------- Distribution ------------- count 0 | 0 1 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -5 2 | 0 5 value ------------- Distribution ------------- count 0 | 0 1 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -4 2 | 0 7 value ------------- Distribution ------------- count 0 | 0 1 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -3 2 | 0 9 value ------------- Distribution ------------- count 0 | 0 1 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -2 2 | 0 11 value ------------- Distribution ------------- count 0 | 0 1 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -1 2 | 0 14 value ------------- Distribution ------------- count 0 | 0 1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 2 | 0 16 value ------------- Distribution ------------- count 0 | 0 1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 2 2 | 0 18 value ------------- Distribution ------------- count 0 | 0 1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 3 2 | 0 20 value ------------- Distribution ------------- count 0 | 0 1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 4 2 | 0 22 value ------------- Distribution ------------- count 0 | 0 1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 5 2 | 0 24 value ------------- Distribution ------------- count 0 | 0 1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 6 2 | 0 13 value ------------- Distribution ------------- count 0 | 0 1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 7 2 | 0 15 value ------------- Distribution ------------- count 0 | 0 1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 8 2 | 0 17 value ------------- Distribution ------------- count 0 | 0 1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 9 2 | 0 19 value ------------- Distribution ------------- count 0 | 0 1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 10 2 | 0 21 value ------------- Distribution ------------- count 0 | 0 1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 11 2 | 0 23 value ------------- Distribution ------------- count 0 | 0 1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 12 2 | 0 Ordering of lquantize() with some negative weights: 2 value ------------- Distribution ------------- count 0 | 0 1 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -12 2 | 0 4 value ------------- Distribution ------------- count 0 | 0 1 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -11 2 | 0 6 value ------------- Distribution ------------- count 0 | 0 1 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -10 2 | 0 8 value ------------- Distribution ------------- count 0 | 0 1 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -9 2 | 0 10 value ------------- Distribution ------------- count 0 | 0 1 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -8 2 | 0 12 value ------------- Distribution ------------- count 0 | 0 1 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -7 2 | 0 1 value ------------- Distribution ------------- count 0 | 0 1 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -6 2 | 0 3 value ------------- Distribution ------------- count 0 | 0 1 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -5 2 | 0 5 value ------------- Distribution ------------- count 0 | 0 1 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -4 2 | 0 7 value ------------- Distribution ------------- count 0 | 0 1 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -3 2 | 0 9 value ------------- Distribution ------------- count 0 | 0 1 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -2 2 | 0 11 value ------------- Distribution ------------- count 0 | 0 1 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -1 2 | 0 14 value ------------- Distribution ------------- count 0 | 0 1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 2 | 0 16 value ------------- Distribution ------------- count 0 | 0 1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 2 2 | 0 18 value ------------- Distribution ------------- count 0 | 0 1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 3 2 | 0 20 value ------------- Distribution ------------- count 0 | 0 1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 4 2 | 0 22 value ------------- Distribution ------------- count 0 | 0 1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 5 2 | 0 24 value ------------- Distribution ------------- count 0 | 0 1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 6 2 | 0 13 value ------------- Distribution ------------- count 0 | 0 1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 7 2 | 0 15 value ------------- Distribution ------------- count 0 | 0 1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 8 2 | 0 17 value ------------- Distribution ------------- count 0 | 0 1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 9 2 | 0 19 value ------------- Distribution ------------- count 0 | 0 1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 10 2 | 0 21 value ------------- Distribution ------------- count 0 | 0 1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 11 2 | 0 23 value ------------- Distribution ------------- count 0 | 0 1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 12 2 | 0 Ordering of sum() with some negative weights: 2 -12 4 -11 6 -10 8 -9 10 -8 12 -7 1 -6 3 -5 5 -4 7 -3 9 -2 11 -1 14 1 16 2 18 3 20 4 22 5 24 6 13 7 15 8 17 9 19 10 21 11 23 12 Ordering of max() with some negative weights: 2 -12 4 -11 6 -10 8 -9 10 -8 12 -7 1 -6 3 -5 5 -4 7 -3 9 -2 11 -1 14 1 16 2 18 3 20 4 22 5 24 6 13 7 15 8 17 9 19 10 21 11 23 12 Ordering of min() with some negative weights: 2 -12 4 -11 6 -10 8 -9 10 -8 12 -7 1 -6 3 -5 5 -4 7 -3 9 -2 11 -1 14 1 16 2 18 3 20 4 22 5 24 6 13 7 15 8 17 9 19 10 21 11 23 12 /* * 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. */ #pragma D option quiet BEGIN { @["j-church"] = quantize(1, 100); @["j-church"] = quantize(1, -99); @["j-church"] = quantize(1, -1); val = 123; } BEGIN { @["k-ingleside"] = quantize(1, -val); } BEGIN { @["l-taraval"] = quantize(0, -val); @["l-taraval"] = quantize(-1, -val); @["l-taraval"] = quantize(1, val); @["l-taraval"] = quantize(1, val); } BEGIN { @["m-oceanview"] = quantize(1, (1 << 63) - 1); @["m-oceanview"] = quantize(1); @["m-oceanview"] = quantize(2, (1 << 63) - 1); @["m-oceanview"] = quantize(8, 400000); } BEGIN { @["n-judah"] = quantize(1, val); @["n-judah"] = quantize(2, val); @["n-judah"] = quantize(2, val); @["n-judah"] = quantize(2); } BEGIN { this->i = 1; this->val = (1 << 63) - 1; @["f-market"] = quantize(this->i, this->val); this->i <<= 1; this->val >>= 1; @["f-market"] = quantize(this->i, this->val); this->i <<= 1; this->val >>= 1; @["f-market"] = quantize(this->i, this->val); this->i <<= 1; this->val >>= 1; @["f-market"] = quantize(this->i, this->val); this->i <<= 1; this->val >>= 1; } BEGIN { this->i = 1; this->val = (1 << 63) - 4; @["s-castro"] = quantize(this->i, this->val); this->i <<= 1; this->val >>= 1; @["s-castro"] = quantize(this->i, this->val); this->i <<= 1; this->val >>= 1; @["s-castro"] = quantize(this->i, this->val); this->i <<= 1; this->val >>= 1; @["s-castro"] = quantize(this->i, this->val); this->i <<= 1; this->val >>= 1; } BEGIN { exit(0); } k-ingleside value ------------- Distribution ------------- count 0 | 0 1 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -123 2 | 0 j-church value ------------- Distribution ------------- count -1 | 0 0 | 0 1 | 0 l-taraval value ------------- Distribution ------------- count -2 | 0 -1 @@@@@| -123 0 @@@@@| -123 1 |@@@@@@@@@@ 246 2 | 0 n-judah value ------------- Distribution ------------- count 0 | 0 1 |@@@@@@@@@@@@@ 123 2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@ 247 4 | 0 m-oceanview value ------------- Distribution ------------- count 0 | 0 1 @@@@@@@@@@| -9223372036854775808 2 |@@@@@@@@@@ 9223372036854775807 4 | 0 8 | 400000 16 | 0 s-castro value ------------- Distribution ------------- count 0 | 0 1 |@@@@@@@@@@@@@@@@@@@@@ 9223372036854775804 2 |@@@@@@@@@@@ 4611686018427387902 4 |@@@@@ 2305843009213693951 8 |@@@ 1152921504606846975 16 | 0 f-market value ------------- Distribution ------------- count 0 | 0 1 |@@@@@@@@@@@@@@@@@@@@@ 9223372036854775807 2 |@@@@@@@@@@@ 4611686018427387903 4 |@@@@@ 2305843009213693951 8 |@@@ 1152921504606846975 16 | 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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #pragma D option quiet int i; tick-10ms /i < 100/ { @[i] = sum(i); i++; } tick-10ms /i == 100/ { exit(0); } END { trunc(@, -10); } 0 0 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 /* * 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. */ #pragma D option quiet int i; tick-10ms /i < 100/ { @[i] = lquantize(i, 0, 150); @[i] = lquantize(i + 1, 0, 150); @[i] = lquantize(i + 2, 0, 150); @[i] = lquantize(i + 3, 0, 150); i++; } tick-10ms /i == 100/ { exit(0); } END { trunc(@, -5); } 0 value ------------- Distribution ------------- count < 0 | 0 0 |@@@@@@@@@@ 1 1 |@@@@@@@@@@ 1 2 |@@@@@@@@@@ 1 3 |@@@@@@@@@@ 1 4 | 0 1 value ------------- Distribution ------------- count 0 | 0 1 |@@@@@@@@@@ 1 2 |@@@@@@@@@@ 1 3 |@@@@@@@@@@ 1 4 |@@@@@@@@@@ 1 5 | 0 2 value ------------- Distribution ------------- count 1 | 0 2 |@@@@@@@@@@ 1 3 |@@@@@@@@@@ 1 4 |@@@@@@@@@@ 1 5 |@@@@@@@@@@ 1 6 | 0 3 value ------------- Distribution ------------- count 2 | 0 3 |@@@@@@@@@@ 1 4 |@@@@@@@@@@ 1 5 |@@@@@@@@@@ 1 6 |@@@@@@@@@@ 1 7 | 0 4 value ------------- Distribution ------------- count 3 | 0 4 |@@@@@@@@@@ 1 5 |@@@@@@@@@@ 1 6 |@@@@@@@@@@ 1 7 |@@@@@@@@@@ 1 8 | 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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * ASSERTION: * Positive test for normalization() * * SECTION: Aggregations/Normalization * */ #pragma D option quiet #pragma D option aggrate=1ms #pragma D option switchrate=50ms BEGIN { i = 0; start = timestamp; } tick-100ms /i < 20/ { @func[i % 5] = sum(i * 100); i++; } tick-100ms /i == 20/ { printf("normalized data:\n"); normalize(@func, 5); exit(0); } normalized data: 0 600 1 680 2 760 3 840 4 920 /* * 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. */ #pragma D option quiet BEGIN { @[8] = sum(1); @[6] = sum(1); @[7] = sum(1); @[5] = sum(1); @[3] = sum(1); @[0] = sum(1); @[9] = sum(1); @tour["Ghent"] = sum(1); @tour["Berlin"] = sum(1); @tour["London"] = sum(1); @tour["Dublin"] = sum(1); @tour["Shanghai"] = sum(1); @tour["Zurich"] = sum(1); @tour["Regina"] = sum(1); @tour["Winnipeg"] = sum(1); @tour["Edmonton"] = sum(1); @tour["Calgary"] = sum(1); @ate[8, "Rice"] = sum(1); @ate[8, "Oatmeal"] = sum(1); @ate[8, "Barley"] = sum(1); @ate[8, "Carrots"] = sum(1); @ate[8, "Sweet potato"] = sum(1); @ate[8, "Asparagus"] = sum(1); @ate[8, "Squash"] = sum(1); @chars['a'] = sum(1); @chars['s'] = sum(1); @chars['d'] = sum(1); @chars['f'] = sum(1); printa("%d\n", @); printf("\n"); printa("%s\n", @tour); printf("\n"); printa("%d %s\n", @ate); printf("\n"); printa("%c\n", @chars); printf("\n"); exit(0); } 0 3 5 6 7 8 9 Berlin Calgary Dublin Edmonton Ghent London Regina Shanghai Winnipeg Zurich 8 Asparagus 8 Barley 8 Carrots 8 Oatmeal 8 Rice 8 Squash 8 Sweet potato a d f s /* * 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. */ /* * ASSERTION: * Positive quantize() test * * SECTION: Aggregations/Aggregations * * NOTES: This is verifiable simple positive test of the quantize() function. * */ #pragma D option quiet BEGIN { i = 0; } tick-10ms /i < 1000/ { @a[i] = quantize(i); i += 100; } tick-10ms /i == 1000/ { exit(0); } 0 value ------------- Distribution ------------- count -1 | 0 0 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 1 | 0 100 value ------------- Distribution ------------- count 32 | 0 64 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 128 | 0 200 value ------------- Distribution ------------- count 64 | 0 128 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 256 | 0 300 value ------------- Distribution ------------- count 128 | 0 256 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 512 | 0 400 value ------------- Distribution ------------- count 128 | 0 256 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 512 | 0 500 value ------------- Distribution ------------- count 128 | 0 256 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 512 | 0 600 value ------------- Distribution ------------- count 256 | 0 512 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 1024 | 0 700 value ------------- Distribution ------------- count 256 | 0 512 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 1024 | 0 800 value ------------- Distribution ------------- count 256 | 0 512 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 1024 | 0 900 value ------------- Distribution ------------- count 256 | 0 512 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 1024 | 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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #pragma D option quiet int64_t val, shift; tick-1ms /val == 0/ { val = -(1 << shift); shift++; } tick-1ms /shift == 32/ { exit(0); } tick-1ms /val == -1/ { val = (1 << shift); } tick-1ms { @[shift] = quantize(val, val); val >>= 1; } 1 value ------------- Distribution ------------- count 0 | 0 1 |@@@@@@@@@@@@@ 1 2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@ 2 4 | 0 2 value ------------- Distribution ------------- count -4 | 0 -2 @@@@| -2 -1 | 0 0 | 0 1 |@@ 1 2 |@@@@ 2 4 |@@@@@@@@@ 4 8 | 0 3 value ------------- Distribution ------------- count -8 | 0 -4 @@@@| -4 -2 @@| -2 -1 | 0 0 | 0 1 |@ 1 2 |@@ 2 4 |@@@@ 4 8 |@@@@@@@@ 8 16 | 0 4 value ------------- Distribution ------------- count -16 | 0 -8 @@@@| -8 -4 @@| -4 -2 @| -2 -1 | 0 0 | 0 1 | 1 2 |@ 2 4 |@@ 4 8 |@@@@ 8 16 |@@@@@@@ 16 32 | 0 5 value ------------- Distribution ------------- count -32 | 0 -16 @@@| -16 -8 @@| -8 -4 @| -4 -2 | -2 -1 | 0 0 | 0 1 | 1 2 | 2 4 |@ 4 8 |@@ 8 16 |@@@ 16 32 |@@@@@@@ 32 64 | 0 6 value ------------- Distribution ------------- count -64 | 0 -32 @@@| -32 -16 @@| -16 -8 @| -8 -4 | -4 -2 | -2 -1 | 0 0 | 0 1 | 1 2 | 2 4 | 4 8 |@ 8 16 |@@ 16 32 |@@@ 32 64 |@@@@@@@ 64 128 | 0 7 value ------------- Distribution ------------- count -128 | 0 -64 @@@| -64 -32 @@| -32 -16 @| -16 -8 | -8 -4 | -4 -2 | -2 -1 | 0 0 | 0 1 | 1 2 | 2 4 | 4 8 | 8 16 |@ 16 32 |@@ 32 64 |@@@ 64 128 |@@@@@@@ 128 256 | 0 8 value ------------- Distribution ------------- count -256 | 0 -128 @@@| -128 -64 @@| -64 -32 @| -32 -16 | -16 -8 | -8 -4 | -4 -2 | -2 -1 | 0 0 | 0 1 | 1 2 | 2 4 | 4 8 | 8 16 | 16 32 |@ 32 64 |@@ 64 128 |@@@ 128 256 |@@@@@@@ 256 512 | 0 9 value ------------- Distribution ------------- count -512 | 0 -256 @@@| -256 -128 @@| -128 -64 @| -64 -32 | -32 -16 | -16 -8 | -8 -4 | -4 -2 | -2 -1 | 0 0 | 0 1 | 1 2 | 2 4 | 4 8 | 8 16 | 16 32 | 32 64 |@ 64 128 |@@ 128 256 |@@@ 256 512 |@@@@@@@ 512 1024 | 0 10 value ------------- Distribution ------------- count -1024 | 0 -512 @@@| -512 -256 @@| -256 -128 @| -128 -64 | -64 -32 | -32 -16 | -16 -8 | -8 -4 | -4 -2 | -2 -1 | 0 0 | 0 1 | 1 2 | 2 4 | 4 8 | 8 16 | 16 32 | 32 64 | 64 128 |@ 128 256 |@@ 256 512 |@@@ 512 1024 |@@@@@@@ 1024 2048 | 0 11 value ------------- Distribution ------------- count -2048 | 0 -1024 @@@| -1024 -512 @@| -512 -256 @| -256 -128 | -128 -64 | -64 -32 | -32 -16 | -16 -8 | -8 -4 | -4 -2 | -2 -1 | 0 0 | 0 1 | 1 2 | 2 4 | 4 8 | 8 16 | 16 32 | 32 64 | 64 128 | 128 256 |@ 256 512 |@@ 512 1024 |@@@ 1024 2048 |@@@@@@@ 2048 4096 | 0 12 value ------------- Distribution ------------- count -4096 | 0 -2048 @@@| -2048 -1024 @@| -1024 -512 @| -512 -256 | -256 -128 | -128 -64 | -64 -32 | -32 -16 | -16 -8 | -8 -4 | -4 -2 | -2 -1 | 0 0 | 0 1 | 1 2 | 2 4 | 4 8 | 8 16 | 16 32 | 32 64 | 64 128 | 128 256 | 256 512 |@ 512 1024 |@@ 1024 2048 |@@@ 2048 4096 |@@@@@@@ 4096 8192 | 0 13 value ------------- Distribution ------------- count -8192 | 0 -4096 @@@| -4096 -2048 @@| -2048 -1024 @| -1024 -512 | -512 -256 | -256 -128 | -128 -64 | -64 -32 | -32 -16 | -16 -8 | -8 -4 | -4 -2 | -2 -1 | 0 0 | 0 1 | 1 2 | 2 4 | 4 8 | 8 16 | 16 32 | 32 64 | 64 128 | 128 256 | 256 512 | 512 1024 |@ 1024 2048 |@@ 2048 4096 |@@@ 4096 8192 |@@@@@@@ 8192 16384 | 0 14 value ------------- Distribution ------------- count -16384 | 0 -8192 @@@| -8192 -4096 @@| -4096 -2048 @| -2048 -1024 | -1024 -512 | -512 -256 | -256 -128 | -128 -64 | -64 -32 | -32 -16 | -16 -8 | -8 -4 | -4 -2 | -2 -1 | 0 0 | 0 1 | 1 2 | 2 4 | 4 8 | 8 16 | 16 32 | 32 64 | 64 128 | 128 256 | 256 512 | 512 1024 | 1024 2048 |@ 2048 4096 |@@ 4096 8192 |@@@ 8192 16384 |@@@@@@@ 16384 32768 | 0 15 value ------------- Distribution ------------- count -32768 | 0 -16384 @@@| -16384 -8192 @@| -8192 -4096 @| -4096 -2048 | -2048 -1024 | -1024 -512 | -512 -256 | -256 -128 | -128 -64 | -64 -32 | -32 -16 | -16 -8 | -8 -4 | -4 -2 | -2 -1 | 0 0 | 0 1 | 1 2 | 2 4 | 4 8 | 8 16 | 16 32 | 32 64 | 64 128 | 128 256 | 256 512 | 512 1024 | 1024 2048 | 2048 4096 |@ 4096 8192 |@@ 8192 16384 |@@@ 16384 32768 |@@@@@@@ 32768 65536 | 0 16 value ------------- Distribution ------------- count -65536 | 0 -32768 @@@| -32768 -16384 @@| -16384 -8192 @| -8192 -4096 | -4096 -2048 | -2048 -1024 | -1024 -512 | -512 -256 | -256 -128 | -128 -64 | -64 -32 | -32 -16 | -16 -8 | -8 -4 | -4 -2 | -2 -1 | 0 0 | 0 1 | 1 2 | 2 4 | 4 8 | 8 16 | 16 32 | 32 64 | 64 128 | 128 256 | 256 512 | 512 1024 | 1024 2048 | 2048 4096 | 4096 8192 |@ 8192 16384 |@@ 16384 32768 |@@@ 32768 65536 |@@@@@@@ 65536 131072 | 0 17 value ------------- Distribution ------------- count -131072 | 0 -65536 @@@| -65536 -32768 @@| -32768 -16384 @| -16384 -8192 | -8192 -4096 | -4096 -2048 | -2048 -1024 | -1024 -512 | -512 -256 | -256 -128 | -128 -64 | -64 -32 | -32 -16 | -16 -8 | -8 -4 | -4 -2 | -2 -1 | 0 0 | 0 1 | 1 2 | 2 4 | 4 8 | 8 16 | 16 32 | 32 64 | 64 128 | 128 256 | 256 512 | 512 1024 | 1024 2048 | 2048 4096 | 4096 8192 | 8192 16384 |@ 16384 32768 |@@ 32768 65536 |@@@ 65536 131072 |@@@@@@@ 131072 262144 | 0 18 value ------------- Distribution ------------- count -262144 | 0 -131072 @@@| -131072 -65536 @@| -65536 -32768 @| -32768 -16384 | -16384 -8192 | -8192 -4096 | -4096 -2048 | -2048 -1024 | -1024 -512 | -512 -256 | -256 -128 | -128 -64 | -64 -32 | -32 -16 | -16 -8 | -8 -4 | -4 -2 | -2 -1 | 0 0 | 0 1 | 1 2 | 2 4 | 4 8 | 8 16 | 16 32 | 32 64 | 64 128 | 128 256 | 256 512 | 512 1024 | 1024 2048 | 2048 4096 | 4096 8192 | 8192 16384 | 16384 32768 |@ 32768 65536 |@@ 65536 131072 |@@@ 131072 262144 |@@@@@@@ 262144 524288 | 0 19 value ------------- Distribution ------------- count -524288 | 0 -262144 @@@| -262144 -131072 @@| -131072 -65536 @| -65536 -32768 | -32768 -16384 | -16384 -8192 | -8192 -4096 | -4096 -2048 | -2048 -1024 | -1024 -512 | -512 -256 | -256 -128 | -128 -64 | -64 -32 | -32 -16 | -16 -8 | -8 -4 | -4 -2 | -2 -1 | 0 0 | 0 1 | 1 2 | 2 4 | 4 8 | 8 16 | 16 32 | 32 64 | 64 128 | 128 256 | 256 512 | 512 1024 | 1024 2048 | 2048 4096 | 4096 8192 | 8192 16384 | 16384 32768 | 32768 65536 |@ 65536 131072 |@@ 131072 262144 |@@@ 262144 524288 |@@@@@@@ 524288 1048576 | 0 20 value ------------- Distribution ------------- count -1048576 | 0 -524288 @@@| -524288 -262144 @@| -262144 -131072 @| -131072 -65536 | -65536 -32768 | -32768 -16384 | -16384 -8192 | -8192 -4096 | -4096 -2048 | -2048 -1024 | -1024 -512 | -512 -256 | -256 -128 | -128 -64 | -64 -32 | -32 -16 | -16 -8 | -8 -4 | -4 -2 | -2 -1 | 0 0 | 0 1 | 1 2 | 2 4 | 4 8 | 8 16 | 16 32 | 32 64 | 64 128 | 128 256 | 256 512 | 512 1024 | 1024 2048 | 2048 4096 | 4096 8192 | 8192 16384 | 16384 32768 | 32768 65536 | 65536 131072 |@ 131072 262144 |@@ 262144 524288 |@@@ 524288 1048576 |@@@@@@@ 1048576 2097152 | 0 21 value ------------- Distribution ------------- count -2097152 | 0 -1048576 @@@| -1048576 -524288 @@| -524288 -262144 @| -262144 -131072 | -131072 -65536 | -65536 -32768 | -32768 -16384 | -16384 -8192 | -8192 -4096 | -4096 -2048 | -2048 -1024 | -1024 -512 | -512 -256 | -256 -128 | -128 -64 | -64 -32 | -32 -16 | -16 -8 | -8 -4 | -4 -2 | -2 -1 | 0 0 | 0 1 | 1 2 | 2 4 | 4 8 | 8 16 | 16 32 | 32 64 | 64 128 | 128 256 | 256 512 | 512 1024 | 1024 2048 | 2048 4096 | 4096 8192 | 8192 16384 | 16384 32768 | 32768 65536 | 65536 131072 | 131072 262144 |@ 262144 524288 |@@ 524288 1048576 |@@@ 1048576 2097152 |@@@@@@@ 2097152 4194304 | 0 22 value ------------- Distribution ------------- count -4194304 | 0 -2097152 @@@| -2097152 -1048576 @@| -1048576 -524288 @| -524288 -262144 | -262144 -131072 | -131072 -65536 | -65536 -32768 | -32768 -16384 | -16384 -8192 | -8192 -4096 | -4096 -2048 | -2048 -1024 | -1024 -512 | -512 -256 | -256 -128 | -128 -64 | -64 -32 | -32 -16 | -16 -8 | -8 -4 | -4 -2 | -2 -1 | 0 0 | 0 1 | 1 2 | 2 4 | 4 8 | 8 16 | 16 32 | 32 64 | 64 128 | 128 256 | 256 512 | 512 1024 | 1024 2048 | 2048 4096 | 4096 8192 | 8192 16384 | 16384 32768 | 32768 65536 | 65536 131072 | 131072 262144 | 262144 524288 |@ 524288 1048576 |@@ 1048576 2097152 |@@@ 2097152 4194304 |@@@@@@@ 4194304 8388608 | 0 23 value ------------- Distribution ------------- count -8388608 | 0 -4194304 @@@| -4194304 -2097152 @@| -2097152 -1048576 @| -1048576 -524288 | -524288 -262144 | -262144 -131072 | -131072 -65536 | -65536 -32768 | -32768 -16384 | -16384 -8192 | -8192 -4096 | -4096 -2048 | -2048 -1024 | -1024 -512 | -512 -256 | -256 -128 | -128 -64 | -64 -32 | -32 -16 | -16 -8 | -8 -4 | -4 -2 | -2 -1 | 0 0 | 0 1 | 1 2 | 2 4 | 4 8 | 8 16 | 16 32 | 32 64 | 64 128 | 128 256 | 256 512 | 512 1024 | 1024 2048 | 2048 4096 | 4096 8192 | 8192 16384 | 16384 32768 | 32768 65536 | 65536 131072 | 131072 262144 | 262144 524288 | 524288 1048576 |@ 1048576 2097152 |@@ 2097152 4194304 |@@@ 4194304 8388608 |@@@@@@@ 8388608 16777216 | 0 24 value ------------- Distribution ------------- count -16777216 | 0 -8388608 @@@| -8388608 -4194304 @@| -4194304 -2097152 @| -2097152 -1048576 | -1048576 -524288 | -524288 -262144 | -262144 -131072 | -131072 -65536 | -65536 -32768 | -32768 -16384 | -16384 -8192 | -8192 -4096 | -4096 -2048 | -2048 -1024 | -1024 -512 | -512 -256 | -256 -128 | -128 -64 | -64 -32 | -32 -16 | -16 -8 | -8 -4 | -4 -2 | -2 -1 | 0 0 | 0 1 | 1 2 | 2 4 | 4 8 | 8 16 | 16 32 | 32 64 | 64 128 | 128 256 | 256 512 | 512 1024 | 1024 2048 | 2048 4096 | 4096 8192 | 8192 16384 | 16384 32768 | 32768 65536 | 65536 131072 | 131072 262144 | 262144 524288 | 524288 1048576 | 1048576 2097152 |@ 2097152 4194304 |@@ 4194304 8388608 |@@@ 8388608 16777216 |@@@@@@@ 16777216 33554432 | 0 25 value ------------- Distribution ------------- count -33554432 | 0 -16777216 @@@| -16777216 -8388608 @@| -8388608 -4194304 @| -4194304 -2097152 | -2097152 -1048576 | -1048576 -524288 | -524288 -262144 | -262144 -131072 | -131072 -65536 | -65536 -32768 | -32768 -16384 | -16384 -8192 | -8192 -4096 | -4096 -2048 | -2048 -1024 | -1024 -512 | -512 -256 | -256 -128 | -128 -64 | -64 -32 | -32 -16 | -16 -8 | -8 -4 | -4 -2 | -2 -1 | 0 0 | 0 1 | 1 2 | 2 4 | 4 8 | 8 16 | 16 32 | 32 64 | 64 128 | 128 256 | 256 512 | 512 1024 | 1024 2048 | 2048 4096 | 4096 8192 | 8192 16384 | 16384 32768 | 32768 65536 | 65536 131072 | 131072 262144 | 262144 524288 | 524288 1048576 | 1048576 2097152 | 2097152 4194304 |@ 4194304 8388608 |@@ 8388608 16777216 |@@@ 16777216 33554432 |@@@@@@@ 33554432 67108864 | 0 26 value ------------- Distribution ------------- count -67108864 | 0 -33554432 @@@| -33554432 -16777216 @@| -16777216 -8388608 @| -8388608 -4194304 | -4194304 -2097152 | -2097152 -1048576 | -1048576 -524288 | -524288 -262144 | -262144 -131072 | -131072 -65536 | -65536 -32768 | -32768 -16384 | -16384 -8192 | -8192 -4096 | -4096 -2048 | -2048 -1024 | -1024 -512 | -512 -256 | -256 -128 | -128 -64 | -64 -32 | -32 -16 | -16 -8 | -8 -4 | -4 -2 | -2 -1 | 0 0 | 0 1 | 1 2 | 2 4 | 4 8 | 8 16 | 16 32 | 32 64 | 64 128 | 128 256 | 256 512 | 512 1024 | 1024 2048 | 2048 4096 | 4096 8192 | 8192 16384 | 16384 32768 | 32768 65536 | 65536 131072 | 131072 262144 | 262144 524288 | 524288 1048576 | 1048576 2097152 | 2097152 4194304 | 4194304 8388608 |@ 8388608 16777216 |@@ 16777216 33554432 |@@@ 33554432 67108864 |@@@@@@@ 67108864 134217728 | 0 27 value ------------- Distribution ------------- count -134217728 | 0 -67108864 @@@| -67108864 -33554432 @@| -33554432 -16777216 @| -16777216 -8388608 | -8388608 -4194304 | -4194304 -2097152 | -2097152 -1048576 | -1048576 -524288 | -524288 -262144 | -262144 -131072 | -131072 -65536 | -65536 -32768 | -32768 -16384 | -16384 -8192 | -8192 -4096 | -4096 -2048 | -2048 -1024 | -1024 -512 | -512 -256 | -256 -128 | -128 -64 | -64 -32 | -32 -16 | -16 -8 | -8 -4 | -4 -2 | -2 -1 | 0 0 | 0 1 | 1 2 | 2 4 | 4 8 | 8 16 | 16 32 | 32 64 | 64 128 | 128 256 | 256 512 | 512 1024 | 1024 2048 | 2048 4096 | 4096 8192 | 8192 16384 | 16384 32768 | 32768 65536 | 65536 131072 | 131072 262144 | 262144 524288 | 524288 1048576 | 1048576 2097152 | 2097152 4194304 | 4194304 8388608 | 8388608 16777216 |@ 16777216 33554432 |@@ 33554432 67108864 |@@@ 67108864 134217728 |@@@@@@@ 134217728 268435456 | 0 28 value ------------- Distribution ------------- count -268435456 | 0 -134217728 @@@| -134217728 -67108864 @@| -67108864 -33554432 @| -33554432 -16777216 | -16777216 -8388608 | -8388608 -4194304 | -4194304 -2097152 | -2097152 -1048576 | -1048576 -524288 | -524288 -262144 | -262144 -131072 | -131072 -65536 | -65536 -32768 | -32768 -16384 | -16384 -8192 | -8192 -4096 | -4096 -2048 | -2048 -1024 | -1024 -512 | -512 -256 | -256 -128 | -128 -64 | -64 -32 | -32 -16 | -16 -8 | -8 -4 | -4 -2 | -2 -1 | 0 0 | 0 1 | 1 2 | 2 4 | 4 8 | 8 16 | 16 32 | 32 64 | 64 128 | 128 256 | 256 512 | 512 1024 | 1024 2048 | 2048 4096 | 4096 8192 | 8192 16384 | 16384 32768 | 32768 65536 | 65536 131072 | 131072 262144 | 262144 524288 | 524288 1048576 | 1048576 2097152 | 2097152 4194304 | 4194304 8388608 | 8388608 16777216 | 16777216 33554432 |@ 33554432 67108864 |@@ 67108864 134217728 |@@@ 134217728 268435456 |@@@@@@@ 268435456 536870912 | 0 29 value ------------- Distribution ------------- count -536870912 | 0 -268435456 @@@| -268435456 -134217728 @@| -134217728 -67108864 @| -67108864 -33554432 | -33554432 -16777216 | -16777216 -8388608 | -8388608 -4194304 | -4194304 -2097152 | -2097152 -1048576 | -1048576 -524288 | -524288 -262144 | -262144 -131072 | -131072 -65536 | -65536 -32768 | -32768 -16384 | -16384 -8192 | -8192 -4096 | -4096 -2048 | -2048 -1024 | -1024 -512 | -512 -256 | -256 -128 | -128 -64 | -64 -32 | -32 -16 | -16 -8 | -8 -4 | -4 -2 | -2 -1 | 0 0 | 0 1 | 1 2 | 2 4 | 4 8 | 8 16 | 16 32 | 32 64 | 64 128 | 128 256 | 256 512 | 512 1024 | 1024 2048 | 2048 4096 | 4096 8192 | 8192 16384 | 16384 32768 | 32768 65536 | 65536 131072 | 131072 262144 | 262144 524288 | 524288 1048576 | 1048576 2097152 | 2097152 4194304 | 4194304 8388608 | 8388608 16777216 | 16777216 33554432 | 33554432 67108864 |@ 67108864 134217728 |@@ 134217728 268435456 |@@@ 268435456 536870912 |@@@@@@@ 536870912 1073741824 | 0 30 value ------------- Distribution ------------- count -1073741824 | 0 -536870912 @@@| -536870912 -268435456 @@| -268435456 -134217728 @| -134217728 -67108864 | -67108864 -33554432 | -33554432 -16777216 | -16777216 -8388608 | -8388608 -4194304 | -4194304 -2097152 | -2097152 -1048576 | -1048576 -524288 | -524288 -262144 | -262144 -131072 | -131072 -65536 | -65536 -32768 | -32768 -16384 | -16384 -8192 | -8192 -4096 | -4096 -2048 | -2048 -1024 | -1024 -512 | -512 -256 | -256 -128 | -128 -64 | -64 -32 | -32 -16 | -16 -8 | -8 -4 | -4 -2 | -2 -1 | 0 0 | 0 1 | 1 2 | 2 4 | 4 8 | 8 16 | 16 32 | 32 64 | 64 128 | 128 256 | 256 512 | 512 1024 | 1024 2048 | 2048 4096 | 4096 8192 | 8192 16384 | 16384 32768 | 32768 65536 | 65536 131072 | 131072 262144 | 262144 524288 | 524288 1048576 | 1048576 2097152 | 2097152 4194304 | 4194304 8388608 | 8388608 16777216 | 16777216 33554432 | 33554432 67108864 | 67108864 134217728 |@ 134217728 268435456 |@@ 268435456 536870912 |@@@ 536870912 1073741824 |@@@@@@@ 1073741824 2147483648 | 0 31 value ------------- Distribution ------------- count -2147483648 | 0 -1073741824 @@@| -1073741824 -536870912 @@| -536870912 -268435456 @| -268435456 -134217728 | -134217728 -67108864 | -67108864 -33554432 | -33554432 -16777216 | -16777216 -8388608 | -8388608 -4194304 | -4194304 -2097152 | -2097152 -1048576 | -1048576 -524288 | -524288 -262144 | -262144 -131072 | -131072 -65536 | -65536 -32768 | -32768 -16384 | -16384 -8192 | -8192 -4096 | -4096 -2048 | -2048 -1024 | -1024 -512 | -512 -256 | -256 -128 | -128 -64 | -64 -32 | -32 -16 | -16 -8 | -8 -4 | -4 -2 | -2 -1 | 0 0 | 0 1 | 1 2 | 2 4 | 4 8 | 8 16 | 16 32 | 32 64 | 64 128 | 128 256 | 256 512 | 512 1024 | 1024 2048 | 2048 4096 | 4096 8192 | 8192 16384 | 16384 32768 | 32768 65536 | 65536 131072 | 131072 262144 | 262144 524288 | 524288 1048576 | 1048576 2097152 | 2097152 4194304 | 4194304 8388608 | 8388608 16777216 | 16777216 33554432 | 33554432 67108864 | 67108864 134217728 | 134217728 268435456 |@ 268435456 536870912 |@@ 536870912 1073741824 |@@@ 1073741824 2147483648 |@@@@@@@ 2147483648 4294967296 | 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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #pragma D option quiet /* * This test verifies that the height of the ASCII quantization bars is * determined using rounding and not truncated integer arithmetic. */ tick-10ms /i++ >= 27/ { exit(0); } tick-10ms /i > 8/ { @ = quantize(2); } tick-10ms /i > 2 && i <= 8/ { @ = quantize(1); } tick-10ms /i <= 2/ { @ = quantize(0); } value ------------- Distribution ------------- count -1 | 0 0 |@@@ 2 1 |@@@@@@@@@ 6 2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 19 4 | 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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #pragma D option quiet BEGIN { a = 7; b = 13; val = (-a * b) + a; } tick-1ms { incr = val % b; val += a; } tick-1ms /val == 0/ { val += a; } tick-1ms /incr != 0/ { i++; @[i] = quantize(0, incr); } tick-1ms /incr == 0/ { printa(@); exit(0); } 2 value ------------- Distribution ------------- count -1 | 0 0 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -12 1 | 0 4 value ------------- Distribution ------------- count -1 | 0 0 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -11 1 | 0 6 value ------------- Distribution ------------- count -1 | 0 0 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -10 1 | 0 8 value ------------- Distribution ------------- count -1 | 0 0 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -9 1 | 0 10 value ------------- Distribution ------------- count -1 | 0 0 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -8 1 | 0 12 value ------------- Distribution ------------- count -1 | 0 0 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -7 1 | 0 1 value ------------- Distribution ------------- count -1 | 0 0 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -6 1 | 0 3 value ------------- Distribution ------------- count -1 | 0 0 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -5 1 | 0 5 value ------------- Distribution ------------- count -1 | 0 0 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -4 1 | 0 7 value ------------- Distribution ------------- count -1 | 0 0 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -3 1 | 0 9 value ------------- Distribution ------------- count -1 | 0 0 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -2 1 | 0 11 value ------------- Distribution ------------- count -1 | 0 0 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -1 1 | 0 14 value ------------- Distribution ------------- count -1 | 0 0 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 1 | 0 16 value ------------- Distribution ------------- count -1 | 0 0 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 2 1 | 0 18 value ------------- Distribution ------------- count -1 | 0 0 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 3 1 | 0 20 value ------------- Distribution ------------- count -1 | 0 0 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 4 1 | 0 22 value ------------- Distribution ------------- count -1 | 0 0 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 5 1 | 0 24 value ------------- Distribution ------------- count -1 | 0 0 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 6 1 | 0 13 value ------------- Distribution ------------- count -1 | 0 0 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 7 1 | 0 15 value ------------- Distribution ------------- count -1 | 0 0 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 8 1 | 0 17 value ------------- Distribution ------------- count -1 | 0 0 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 9 1 | 0 19 value ------------- Distribution ------------- count -1 | 0 0 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 10 1 | 0 21 value ------------- Distribution ------------- count -1 | 0 0 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 11 1 | 0 23 value ------------- Distribution ------------- count -1 | 0 0 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 12 1 | 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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * This is a simple test to make sure that signature checking works properly * for the fake-o types. */ BEGIN { @stk[ustack()] = count(); @symmy[sym(0)] = count(); @usymmy[usym(0)] = count(); @funky[func(0)] = count(); @ufunky[ufunc(0)] = count(); @moddy[mod(0)] = count(); @umoddy[umod(0)] = count(); } BEGIN { @stk[ustack()] = count(); @symmy[sym(0)] = count(); @usymmy[usym(0)] = count(); @funky[func(0)] = count(); @ufunky[ufunc(0)] = count(); @moddy[mod(0)] = count(); @umoddy[umod(0)] = count(); exit(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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * ASSERTION: * Signed integer keys print and sort as expected. * * SECTION: Aggregations, Printing Aggregations * * NOTES: DTrace sorts integer keys as unsigned values, yet prints 32- * and 64-bit integers as signed values. Since the Java DTrace API is * expected to emulate this behavior, this test was added to ensure that * the behavior is preserved. Consistency with trace() output is also * tested. */ #pragma D option quiet #pragma D option aggsortkey BEGIN { trace((char)-2); trace("\n"); trace((char)-1); trace("\n"); trace((char)0); trace("\n"); trace((char)1); trace("\n"); trace((char)2); trace("\n"); trace("\n"); trace((short)-2); trace("\n"); trace((short)-1); trace("\n"); trace((short)0); trace("\n"); trace((short)1); trace("\n"); trace((short)2); trace("\n"); trace("\n"); trace(-2); trace("\n"); trace(-1); trace("\n"); trace(0); trace("\n"); trace(1); trace("\n"); trace(2); trace("\n"); trace("\n"); trace((long long)-2); trace("\n"); trace((long long)-1); trace("\n"); trace((long long)0); trace("\n"); trace((long long)1); trace("\n"); trace((long long)2); trace("\n"); @i8[(char)-2] = sum(-2); @i8[(char)-1] = sum(-1); @i8[(char)0] = sum(0); @i8[(char)1] = sum(1); @i8[(char)2] = sum(2); @i16[(short)-2] = sum(-2); @i16[(short)-1] = sum(-1); @i16[(short)0] = sum(0); @i16[(short)1] = sum(1); @i16[(short)2] = sum(2); @i32[-2] = sum(-2); @i32[-1] = sum(-1); @i32[0] = sum(0); @i32[1] = sum(1); @i32[2] = sum(2); @i64[(long long)-2] = sum(-2); @i64[(long long)-1] = sum(-1); @i64[(long long)0] = sum(0); @i64[(long long)1] = sum(1); @i64[(long long)2] = sum(2); exit(0); } 254 255 0 1 2 65534 65535 0 1 2 -2 -1 0 1 2 -2 -1 0 1 2 0 0 1 1 2 2 254 -2 255 -1 0 0 1 1 2 2 65534 -2 65535 -1 0 0 1 1 2 2 -2 -2 -1 -1 0 0 1 1 2 2 -2 -2 -1 -1 /* * 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. */ /* * ASSERTION: * Signed integer keys print and sort as expected using the * aggsortkeypos and aggsortrev options * * SECTION: Aggregations, Printing Aggregations * * NOTES: DTrace sorts integer keys as unsigned values, yet prints 32- * and 64-bit integers as signed values. Since the Java DTrace API is * expected to emulate this behavior, this test was added to ensure that * the behavior is preserved. */ #pragma D option quiet #pragma D option aggsortkey #pragma D option aggsortkeypos=1 #pragma D option aggsortrev BEGIN { @i8["cat", (char)-2] = sum(-2); @i8["dog", (char)-2] = sum(-22); @i8["mouse", (char)-2] = sum(-222); @i8["cat", (char)-1] = sum(-1); @i8["dog", (char)-1] = sum(-11); @i8["mouse", (char)-1] = sum(-111); @i8["cat", (char)0] = sum(0); @i8["dog", (char)0] = sum(10); @i8["mouse", (char)0] = sum(100); @i8["cat", (char)1] = sum(1); @i8["dog", (char)1] = sum(11); @i8["mouse", (char)1] = sum(111); @i8["cat", (char)2] = sum(2); @i8["dog", (char)2] = sum(22); @i8["mouse", (char)2] = sum(222); @i16["mouse", (short)-2] = sum(-2); @i16["dog", (short)-2] = sum(-22); @i16["cat", (short)-2] = sum(-222); @i16["mouse", (short)-1] = sum(-1); @i16["dog", (short)-1] = sum(-11); @i16["cat", (short)-1] = sum(-111); @i16["mouse", (short)0] = sum(0); @i16["dog", (short)0] = sum(10); @i16["cat", (short)0] = sum(100); @i16["mouse", (short)1] = sum(1); @i16["dog", (short)1] = sum(11); @i16["cat", (short)1] = sum(111); @i16["mouse", (short)2] = sum(2); @i16["dog", (short)2] = sum(22); @i16["cat", (short)2] = sum(222); @i32["mouse", -2] = sum(-2); @i32["bear", -2] = sum(-22); @i32["cat", -2] = sum(-222); @i32["mouse", -1] = sum(-1); @i32["bear", -1] = sum(-11); @i32["cat", -1] = sum(-111); @i32["mouse", 0] = sum(0); @i32["bear", 0] = sum(10); @i32["cat", 0] = sum(100); @i32["mouse", 1] = sum(1); @i32["bear", 1] = sum(11); @i32["cat", 1] = sum(111); @i32["mouse", 2] = sum(2); @i32["bear", 2] = sum(22); @i32["cat", 2] = sum(222); @i64["cat", (long long)-2] = sum(-2); @i64["bear", (long long)-2] = sum(-22); @i64["dog", (long long)-2] = sum(-222); @i64["cat", (long long)-1] = sum(-1); @i64["bear", (long long)-1] = sum(-11); @i64["dog", (long long)-1] = sum(-111); @i64["cat", (long long)0] = sum(0); @i64["bear", (long long)0] = sum(10); @i64["dog", (long long)0] = sum(100); @i64["cat", (long long)1] = sum(1); @i64["bear", (long long)1] = sum(11); @i64["dog", (long long)1] = sum(111); @i64["cat", (long long)2] = sum(2); @i64["bear", (long long)2] = sum(22); @i64["dog", (long long)2] = sum(222); exit(0); } dog -1 -111 cat -1 -1 bear -1 -11 dog -2 -222 cat -2 -2 bear -2 -22 dog 2 222 cat 2 2 bear 2 22 dog 1 111 cat 1 1 bear 1 11 dog 0 100 cat 0 0 bear 0 10 mouse -1 -1 cat -1 -111 bear -1 -11 mouse -2 -2 cat -2 -222 bear -2 -22 mouse 2 2 cat 2 222 bear 2 22 mouse 1 1 cat 1 111 bear 1 11 mouse 0 0 cat 0 100 bear 0 10 mouse 65535 -1 dog 65535 -11 cat 65535 -111 mouse 65534 -2 dog 65534 -22 cat 65534 -222 mouse 2 2 dog 2 22 cat 2 222 mouse 1 1 dog 1 11 cat 1 111 mouse 0 0 dog 0 10 cat 0 100 mouse 255 -111 dog 255 -11 cat 255 -1 mouse 254 -222 dog 254 -22 cat 254 -2 mouse 2 222 dog 2 22 cat 2 2 mouse 1 111 dog 1 11 cat 1 1 mouse 0 100 dog 0 10 cat 0 0 /* * CDDL HEADER START * * This file and its contents are supplied under the terms of the * Common Development and Distribution License ("CDDL"), version 1.0. * You may only use this file in accordance with the terms of version * 1.0 of the CDDL. * * A full copy of the text of the CDDL should have accompanied this * source. A copy of the CDDL is also available via the Internet at * http://www.illumos.org/license/CDDL. * * CDDL HEADER END */ /* * Copyright (c) 2012 by Delphix. All rights reserved. */ #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); } 1 0 10 2 0 20 3 0 30 4 0 40 /* * CDDL HEADER START * * The contents of this file are subject to the terms of the * Common Development and Distribution License (the "License"). * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. * See the License for the specific language governing permissions * and limitations under the License. * * When distributing Covered Code, include this CDDL HEADER in each * file and include the License file at usr/src/OPENSOLARIS.LICENSE. * If applicable, add the following below this CDDL HEADER, with the * fields enclosed by brackets "[]" replaced with your own identifying * information: Portions Copyright [yyyy] [name of copyright owner] * * CDDL HEADER END */ /* * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * ASSERTION: * Positive stddev() test * * SECTION: Aggregations/Aggregations * * NOTES: This is a simple verifiable positive test of the stddev() function. * printa() for one aggregation, default printing behavior for the other * so that we exercise both code paths. */ #pragma D option quiet BEGIN { @a = stddev(5000000000); @a = stddev(5000000100); @a = stddev(5000000200); @a = stddev(5000000300); @a = stddev(5000000400); @a = stddev(5000000500); @a = stddev(5000000600); @a = stddev(5000000700); @a = stddev(5000000800); @a = stddev(5000000900); @b = stddev(-5000000000); @b = stddev(-5000000100); @b = stddev(-5000000200); @b = stddev(-5000000300); @b = stddev(-5000000400); @b = stddev(-5000000500); @b = stddev(-5000000600); @b = stddev(-5000000700); @b = stddev(-5000000800); @b = stddev(-5000000900); printa("%@d\n", @a); exit(0); } 287 287 /* * This file and its contents are supplied under the terms of the * Common Development and Distribution License ("CDDL"), version 1.0. * You may only use this file in accordance with the terms of version * 1.0 of the CDDL. * * A full copy of the text of the CDDL should have accompanied this * source. A copy of the CDDL is also available via the Internet at * http://www.illumos.org/license/CDDL. */ /* * Copyright 2017 Panzura. All rights reserved. */ /* * ASSERTION: * Positive test for normalization() of stddev() * * SECTION: Aggregations/Normalization * */ #pragma D option quiet #pragma D option aggrate=1ms #pragma D option switchrate=50ms BEGIN { i = 0; } tick-100ms /i < 11/ { @ = stddev(i * 100); i++; } tick-100ms /i == 11/ { printf("normalized data:\n"); normalize(@, 10); exit(0); } normalized data: 31 /* * 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. * Copyright 2020 Joyent, Inc. */ #include #define INTFUNC(x) \ BEGIN \ /*DSTYLED*/ \ { \ subr++; \ @[(long)x] = sum(1); \ /*DSTYLED*/ \ } #define STRFUNC(x) \ BEGIN \ /*DSTYLED*/ \ { \ subr++; \ @str[x] = sum(1); \ /*DSTYLED*/ \ } #define VOIDFUNC(x) \ BEGIN \ /*DSTYLED*/ \ { \ subr++; \ /*DSTYLED*/ \ } INTFUNC(rand()) INTFUNC(mutex_owned(&`cpu_lock)) INTFUNC(mutex_owner(&`cpu_lock)) INTFUNC(mutex_type_adaptive(&`cpu_lock)) INTFUNC(mutex_type_spin(&`cpu_lock)) INTFUNC(rw_read_held(&`vfssw_lock)) INTFUNC(rw_write_held(&`vfssw_lock)) INTFUNC(rw_iswriter(&`vfssw_lock)) INTFUNC(copyin((uintptr_t)NULL, 1)) STRFUNC(copyinstr((uintptr_t)NULL, 1)) INTFUNC(speculation()) INTFUNC(progenyof($pid)) INTFUNC(strlen("fooey")) VOIDFUNC(copyout) VOIDFUNC(copyoutstr) INTFUNC(alloca(10)) VOIDFUNC(bcopy) VOIDFUNC(copyinto) INTFUNC(msgdsize(NULL)) INTFUNC(msgsize(NULL)) INTFUNC(getmajor(0)) INTFUNC(getminor(0)) STRFUNC(ddi_pathname(NULL, 0)) STRFUNC(strjoin("foo", "bar")) STRFUNC(lltostr(12373)) STRFUNC(basename("/var/crash/systemtap")) STRFUNC(dirname("/var/crash/systemtap")) STRFUNC(cleanpath("/var/crash/systemtap")) STRFUNC(strchr("The SystemTap, The.", 't')) STRFUNC(strrchr("The SystemTap, The.", 't')) STRFUNC(strstr("The SystemTap, The.", "The")) STRFUNC(strtok("The SystemTap, The.", "T")) STRFUNC(substr("The SystemTap, The.", 0)) INTFUNC(index("The SystemTap, The.", "The")) INTFUNC(rindex("The SystemTap, The.", "The")) INTFUNC(htons(0x1234)) INTFUNC(htonl(0x12345678)) INTFUNC(htonll(0x1234567890abcdefL)) INTFUNC(ntohs(0x1234)) INTFUNC(ntohl(0x12345678)) INTFUNC(ntohll(0x1234567890abcdefL)) STRFUNC(inet_ntoa((ipaddr_t *)alloca(sizeof (ipaddr_t)))) STRFUNC(inet_ntoa6((in6_addr_t *)alloca(sizeof (in6_addr_t)))) STRFUNC(inet_ntop(AF_INET, (void *)alloca(sizeof (ipaddr_t)))) STRFUNC(toupper("foo")) STRFUNC(tolower("BAR")) INTFUNC(getf(0)) INTFUNC(strtoll("0x12EE5D5", 16)) STRFUNC(json("{\"systemtap\": false}", "systemtap")) BEGIN /subr == DIF_SUBR_MAX + 1/ { exit(0); } BEGIN { printf("found %d subroutines, expected %d\n", subr, DIF_SUBR_MAX + 1); exit(1); } /* * 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. */ /* * ASSERTION: * Positive sum() test * * SECTION: Aggregations/Aggregations * * NOTES: This is verifiable simple positive test of the sum() function. */ #pragma D option quiet BEGIN { i = 0; } tick-10ms /i < 1000/ { @a = sum(i); i += 100; } tick-10ms /i == 1000/ { exit(0); } 4500 /* * 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. */ #pragma D option quiet int i; tick-10ms /i < 100/ { @[i] = sum(i); i++; } tick-10ms /i == 100/ { exit(0); } END { trunc(@, 10); } 90 90 91 91 92 92 93 93 94 94 95 95 96 96 97 97 98 98 99 99 /* * 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. */ #pragma D option quiet #pragma D option aggrate=1ms #pragma D option switchrate=50ms int i; tick-100ms /i < 10/ { @[i] = sum(10 - i); i++; } tick-100ms /i == 5/ { trunc(@); } tick-100ms /i == 10/ { exit(0); } END { printa(@); } 9 1 8 2 7 3 6 4 5 5 /* * 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. */ #pragma D option quiet int i; tick-10ms /i < 100/ { @[i] = lquantize(i, 0, 150); @[i] = lquantize(i + 1, 0, 150); @[i] = lquantize(i + 2, 0, 150); @[i] = lquantize(i + 3, 0, 150); i++; } tick-10ms /i == 100/ { exit(0); } END { trunc(@, 5); } 95 value ------------- Distribution ------------- count 94 | 0 95 |@@@@@@@@@@ 1 96 |@@@@@@@@@@ 1 97 |@@@@@@@@@@ 1 98 |@@@@@@@@@@ 1 99 | 0 96 value ------------- Distribution ------------- count 95 | 0 96 |@@@@@@@@@@ 1 97 |@@@@@@@@@@ 1 98 |@@@@@@@@@@ 1 99 |@@@@@@@@@@ 1 100 | 0 97 value ------------- Distribution ------------- count 96 | 0 97 |@@@@@@@@@@ 1 98 |@@@@@@@@@@ 1 99 |@@@@@@@@@@ 1 100 |@@@@@@@@@@ 1 101 | 0 98 value ------------- Distribution ------------- count 97 | 0 98 |@@@@@@@@@@ 1 99 |@@@@@@@@@@ 1 100 |@@@@@@@@@@ 1 101 |@@@@@@@@@@ 1 102 | 0 99 value ------------- Distribution ------------- count 98 | 0 99 |@@@@@@@@@@ 1 100 |@@@@@@@@@@ 1 101 |@@@@@@@@@@ 1 102 |@@@@@@@@@@ 1 103 | 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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * ASSERTION: * aggsortkeypos option works when sorting by values, values are * equal, and keys are compared to break the tie * * SECTION: Aggregations, Printing Aggregations * */ #pragma D option quiet #pragma D option aggsortkeypos=1 BEGIN { @[1, 3] = sum(0); @[2, 2] = sum(0); @[3, 1] = sum(0); exit(0); } 3 1 0 2 2 0 1 3 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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * ASSERTION: * Verify that divide by 0 errors are caught * * SECTION: * Types, Operators, and Expressions/Arithmetic Operators */ BEGIN { c = 123/0; exit(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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * ASSERTION: * Verify that computed divide by 0 errors are caught * * SECTION: * Types, Operators, and Expressions/Arithmetic Operators */ BEGIN { c = 123/(7-7); exit(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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * ASSERTION: * Verify that computed divide by 0 errors are caught * * SECTION: * Types, Operators, and Expressions/Arithmetic Operators */ BEGIN { c = 123/((7-7) * 999); exit(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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * ASSERTION: * Verify that mod by 0 errors are caught * * SECTION: * Types, Operators, and Expressions/Arithmetic Operators */ BEGIN { c = 123%0; exit(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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * ASSERTION: * Call invalid / impossible arithmetic operations and make sure * Test gives compilation error. * * SECTION: Types, Operators, and Expressions/Arithmetic Operators * */ #pragma D option quiet BEGIN { i = 0; i+-; printf("The value of i is %d\n", i); exit (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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * ASSERTION: * Call invalid / impossible arithmetic operations and make sure * Test gives compilation error. * * SECTION: Types, Operators, and Expressions/Arithmetic Operators * */ #pragma D option quiet BEGIN { i = 1; i /-= i; printf("The value of i is %d\n", i); exit (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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * ASSERTION: * Call invalid / impossible arithmetic operations and make sure * Test gives compilation error. * * SECTION: Types, Operators, and Expressions/Arithmetic Operators * */ #pragma D option quiet BEGIN { i = 1; i *+= i; printf("The value of i is %d\n", i); exit (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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * ASSERTION: * Call invalid / impossible arithmetic operations and make sure * Test gives compilation error. * * SECTION: Types, Operators, and Expressions/Arithmetic Operators * */ #pragma D option quiet BEGIN { i = 1; i */= i; printf("The value of i is %d\n", i); exit (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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * ASSERTION: * Simple Arithmetic expressions. * Call simple expressions and make sure test succeeds. * Match expected output in tst.basics.d.out * * SECTION: Types, Operators, and Expressions/Arithmetic Operators * */ #pragma D option quiet BEGIN { i = 0; i = 1 + 2 + 3; printf("The value of i is %d\n", i); i = i * 3; printf("The value of i is %d\n", i); i = (i * 3) + i; printf("The value of i is %d\n", i); i = (i + (i * 3) + i) * i; printf("The value of i is %d\n", i); i = i - (i + (i * 3) + i) * i / i * i; printf("The value of i is %d\n", i); i = i * (i - 3 + 5 / i * i ) / i * 6; printf("The value of i is %d\n", i); i = i ^ 5; printf("The value of i is %d\n", i); exit (0); } 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 /* * 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); } fffffffffffffff0 -16 18446744073709551600 fff0 65520 65520 fffffff0 4294967280 4294967280 fff0 65520 65520 fffffffffffffff0 -16 18446744073709551600 fffffffffffffff0 -16 18446744073709551600 fff0 65520 65520 fff0 65520 65520 /* * 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); } cafe /* * 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); } fffffffffffffff0 -16 18446744073709551600 fff0 65520 65520 fffffff0 4294967280 4294967280 fff0 65520 65520 fffffffffffffff0 -16 18446744073709551600 fffffffffffffff0 -16 18446744073709551600 fff0 65520 65520 fff0 65520 65520 # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright (c) 2012, Joyent, Inc. All rights reserved. # # # Somewhat surprisingly, DTrace very much relies on the fact that when 32-bit # is forced, pointers are not, in fact, narrowed to 32-bits. In particular, if # this is not so (that is, if pointers are narrowed to their seemingly correct # 32-bit width), helpers attached to 32-bit programs will fail to operate: # they will erroneously zero the high 32-bits of the return values of 64-bit # kernel pointers as returned by copyin(), alloca(), etc. This test asserts # this implicit behavior -- and this comment regrettably serves as this # behavior's only documentation. # doit() { /usr/sbin/dtrace $1 -n BEGIN'{trace(sizeof (long))}' \ -n 'BEGIN{*(int *)alloca(4) = 21506; exit(0)}' \ -n 'ERROR{exit(1)}' if [ "$?" -ne 0 ]; then exit $? fi } doit doit -32 /* * 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. */ /* * ASSERTION: * Tuples can not be used in non-associative arrays. * * SECTION: Pointers and Arrays/Array Declarations and Storage */ int x[5]; BEGIN { x[1, 2] = 1; } /* * 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. */ /* * ASSERTION: * Array declarations with indexs over INT_MAX return a * D_DECL_ARRBIG errtag. * * SECTION: * Pointers and Arrays/Array Declarations and Storage */ int x[88294967295]; BEGIN { exit(1); } /* * 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. */ /* * ASSERTION: * Arrays must have array dimensions * * SECTION: Pointers and Arrays/Array Declarations and Storage */ int a[]; BEGIN { exit(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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * ASSERTION: * Arrays declarations must have a positive constant as a * subscription. * * SECTION: Pointers and Arrays/Array Declarations and Storage */ int a[-7]; BEGIN { exit(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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * ASSERTION: * Invalid tuple types result in a DT_DECL_ARRTYPE error. * * SECTION: * Pointers and Arrays/Array Declarations and Storage */ int x[void, char]; BEGIN { x[trace(), 'a'] = 456; } /* * 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. */ /* * ASSERTION: * Arrays declarations must have a positive constant as a * subscription. * * SECTION: User Process Tracing/uregs Array */ BEGIN { printf("FOO = 0x%x\n", uregs[FOO]); exit(1); } /* * 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. */ /* * ASSERTION: * Simple array test * * SECTION: Pointers and Arrays/Array Declarations and Storage * */ #pragma D option quiet BEGIN { a[1] = 0; } tick-1 /a[1] == 0/ { exit(0); } tick-1 /a[1] != 0/ { printf("Expected 0, got %d\n", a[1]); exit(1); } /* * 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. */ /* * ASSERTION: * Simple array test * * SECTION: Pointers and Arrays/Array Declarations and Storage * */ #pragma D option quiet BEGIN { a[1] = 0; a[1]++; } tick-1 /a[1] == 1/ { exit(0); } tick-1 /a[1] != 1/ { printf("Expected 1, got %d\n", a[1]); exit(1); } /* * 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. */ /* * ASSERTION: * Simple array test * * SECTION: Pointers and Arrays/Array Declarations and Storage * */ #pragma D option quiet BEGIN { a[1] = 0; ++a[1]; } tick-1 /a[1] == 1/ { exit(0); } tick-1 /a[1] != 1/ { printf("Expected 1, got %d\n", a[1]); } /* * 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. */ /* * ASSERTION: * Simple array test * * SECTION: Pointers and Arrays/Array Declarations and Storage * */ #pragma D option quiet BEGIN { a["test"] = 0; } tick-1 /a["test"] == 0/ { exit(0); } tick-1 /a["test"] != 0/ { printf("Expected 0, got %d\n", a["test"]); exit(1); } /* * 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. */ /* * ASSERTION: * Simple array test * * SECTION: Pointers and Arrays/Array Declarations and Storage * */ #pragma D option quiet BEGIN { a["test"] = 0; b = ++a["test"]; } tick-1 /b == 1/ { exit(0); } tick-1 /b != 1/ { printf("Expected b = 1, got %d\n", b); exit(1); } /* * 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. */ /* * ASSERTION: * Simple array test * * SECTION: Pointers and Arrays/Array Declarations and Storage * */ #pragma D option quiet BEGIN { a["test", "test"] = 0; b = ++a["test", "test"]; } tick-1 /b == 1/ { exit(0); } tick-1 /b != 1/ { printf("Expected b = 1, got %d\n", b); exit(1); } /* * 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. */ /* * ASSERTION: * Positive test to make sure that we can invoke common * ureg[] aliases. * * SECTION: User Process Tracing/uregs Array * * NOTES: This test does no verification - the value of the output * is not deterministic. */ #pragma D option quiet BEGIN { printf("R_PC = 0x%x\n", uregs[R_PC]); printf("R_SP = 0x%x\n", uregs[R_SP]); printf("R_R0 = 0x%x\n", uregs[R_R0]); printf("R_R1 = 0x%x\n", uregs[R_R1]); exit(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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * ASSERTION: * Test assigning a variable two different incompatible types. This should * result in a compile-time error. * * SECTION: Variables/Associative Arrays * */ BEGIN { x[123] = `kmem_flags; x[456] = *`rootvp; } /* * 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. */ /* * ASSERTION: * Test assigning a variable two different incompatible types. This should * result in a compile-time error. * * SECTION: Variables/Associative Arrays * */ BEGIN { self->x[123] = `kmem_flags; self->x[456] = *`rootvp; } /* * 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. */ /* * ASSERTION: * * Declare 'this int' variable and assign inappropriate data type. * * SECTION: Variables/Associative Arrays * * */ #pragma D option quiet this int x; BEGIN { this->x = "dummy"; exit(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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * ASSERTION: * Test an associative array reference that is invalid because of a type * signature mismatch -- this should produce a syntax error at compile time. * * SECTION: Variables/Associative Arrays * */ BEGIN { x[123, "foo"] = timestamp; } END { x[123, 456] = timestamp; } /* * 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. */ /* * ASSERTION: * Test an associative array reference that is invalid because of too few * arguments -- this should produce a syntax error at compile time. * * SECTION: Variables/Associative Arrays * */ BEGIN { x[123, 456] = timestamp; } END { x[123] = timestamp; } /* * 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. */ /* * ASSERTION: * Test an associative array reference that is invalid because of too many * arguments -- this should produce a syntax error at compile time. * * SECTION: Variables/Associative Arrays * */ BEGIN { x[123, 456] = timestamp; } END { x[123, 456, 789] = timestamp; } /* * 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. */ /* * ASSERTION: * * Assign one to 10 elements; make sure fails to compile. * * SECTION: Variables/Associative Arrays * */ BEGIN { x[10]=[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; } END { } /* * 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. */ /* * ASSERTION: * Generates an associative array reference that should overflow the tuple * register stack. We should detect and report this at compile time. * * SECTION: Variables/Associative Arrays * */ BEGIN { a[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10] = 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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * ASSERTION: * * Copy value from associative arrays to local variables. * * SECTION: Variables/Associative Arrays * * */ #pragma D option quiet this int x; BEGIN { a["abc", 123] = 123; } tick-10ms { this->x = a["abc", 123]++; printf("The value of x is %d\n", this->x); } tick-10ms { this->x = a["abc", 123]++; printf("The value of x is %d\n", this->x); } tick-10ms { this->x = a["abc", 123]++; printf("The value of x is %d\n", this->x); exit(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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * ASSERTION: * * To test Clause Local Variables ' this' across different profiles. * * SECTION: Variables/Associative Arrays * * */ #pragma D option quiet this int x; this char c; tick-10ms { this->x = 123; this->c = 'D'; printf("The value of x is %d\n", this->x); } tick-10ms { this->x = 235; printf("The value of x is %d\n", this->x); } tick-10ms { this->x = 456; printf("The value of x is %d\n", this->x); exit(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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * ASSERTION: * * Clause local variables are not initialized to zero. * * SECTION: Variables/Associative Arrays * * */ #pragma D option quiet this int x; BEGIN { printf("the value of x is %d\n", this->x); exit(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. */ /* * Test to ensure that invalid stores to a global associative array * are caught correctly. */ #pragma D option quiet int last_cmds[int][4]; BEGIN { errors = 0; forward = 0; backward = 0; } tick-1s /!forward/ { forward = 1; last_cmds[1][4] = 0xdeadbeef; } tick-1s /!backward/ { backward = 1; last_cmds[1][-5] = 0xdeadbeef; } tick-1s /errors > 1/ { exit(0); } tick-1s /n++ > 5/ { exit(1); } ERROR /arg4 == DTRACEFLT_BADADDR/ { errors++; } /* * 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. */ /* * ASSERTION: * Test the different kinds of associative scalar references. * * SECTION: Variables/Associative Arrays * * NOTES: * In particular, we test accessing a DTrace associative array * defined with scalar type (first ref that forces creation as both global * and TLS), and DTrace associative array scalar subsequent references * (both global and TLS). * */ #pragma D option quiet BEGIN { i = 0; } tick-10ms /i != 5/ { x[123, "foo"] = 123; self->x[456, "bar"] = 456; i++; } tick-10ms /i != 5/ { printf("x[] = %d\n", x[123, "foo"]); printf("self->x[] = %d\n", self->x[456, "bar"]); } tick-10ms /i == 5/ { exit(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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * This test confirms the orthogonality of associative arrays and thread-local * variables by intentionally deriving a matching key signature (based on * t_did). */ uint64_t b[uint64_t]; BEGIN { self->a = 0xbad; } BEGIN /b[curthread->t_did] == 0/ { exit(0); } BEGIN { printf("value should be 0; value is %x!", b[curthread->t_did]); exit(1); } /* * 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. */ /* * ASSERTION: * * To test Clause Local Variables ' this'. * * SECTION: Variables/Associative Arrays * * */ #pragma D option quiet this int x; this char c; BEGIN { this->x = 123; this->c = 'D'; exit(0); } The value of i is 123 /* * 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. */ /* * ASSERTION: * Arguments to BEGIN provider not allowed. * * SECTION: dtrace Provider * */ #pragma D option quiet BEGIN::read:entry { printf("Begin fired first\n"); exit(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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * ASSERTION: * concat of providers not allowed with BEGIN * * SECTION: dtrace Provider * */ #pragma D option quiet BEGIN:tick-1 { printf("Begin fired first\n"); exit(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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * ASSERTION: * Order of provider flow, Begin, tick profile, and END. * * SECTION: dtrace Provider * */ #pragma D option quiet END { printf("End fired after exit\n"); } BEGIN { printf("Begin fired first\n"); } tick-1ms { printf("tick fired second\n"); printf("Call exit\n"); exit(0); } Begin fired first tick fired second Call exit End fired after exit /* * 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. */ /* * ASSERTION: * Multiple BEGIN providers * * SECTION: dtrace Provider * */ #pragma D option quiet BEGIN { printf("Begin fired first\n"); } BEGIN { printf("Begin fired second\n"); } BEGIN { printf("Begin fired third\n"); } BEGIN { printf("Begin fired fourth\n"); } BEGIN { printf("Begin fired fifth\n"); exit(0); } Begin fired first Begin fired second Begin fired third Begin fired fourth Begin fired fifth /* * 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. */ /* * ASSERTION: Cannot take the address of a bit-field member using the & * operator. * * SECTION: Structs and Unions/Bit-Fields */ #pragma D option quiet struct bitRecord{ int a : 1; int b : 3; int c : 12; } var; BEGIN { printf("address of a: %d\naddress of b: %d\naddress of c: %dn", &var.a, &var.b, &var.c); exit(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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * ASSERTION: Bit-field width must be positive. * * SECTION: Structs and Unions/Bit-Fields */ #pragma D option quiet struct bitRecord{ int a : 1; int b : -3; int c : 12; } var; BEGIN { exit(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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * ASSERTION: Bit-fields must be positive and non-zero. * * SECTION: Structs and Unions/Bit-Fields */ #pragma D option quiet struct bitRecord{ int a : 1; int b : 0; int c : 12; } var; BEGIN { exit(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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * ASSERTION: Bit-field width must be of a number of bits not larger than * that of the corresponding base type. * * SECTION: Structs and Unions/Bit-Fields */ #pragma D option quiet struct bitRecord1{ char a : 10; } var1; struct bitRecord2{ short a : 33; } var2; struct bitRecord3{ long long a : 65; } var3; BEGIN { exit(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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * ASSERTION: Bit-field width cannot be greater than 64 bits in D. * * SECTION: Structs and Unions/Bit-Fields */ #pragma D option quiet struct bitRecord{ int a : 1; int b : 65; int c : 12; } var; BEGIN { exit(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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * ASSERTION: * Non-integer types used for bitfields will result in a D_DECL_BFTYPE * error. * * SECTION: Structs and Unions/Bit-Fields */ #pragma D option quiet struct bits { float : 1; } xyz; BEGIN { exit(1); } /* * 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. */ /* * ASSERTION: Cannot apply offsetof operator to a bit-field member. * * SECTION: Structs and Unions/Bit-Fields * */ #pragma D option quiet struct bitRecord{ int a : 17; int b : 3; int c : 12; } var; BEGIN { printf("offsetof(struct bitRecord, a): %d\n", offsetof(struct bitRecord, a)); printf("offsetof(struct bitRecord, b): %d\n", offsetof(struct bitRecord, b)); printf("offsetof(struct bitRecord, c): %d\n", offsetof(struct bitRecord, c)); exit(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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * ASSERTION: Cannot apply sizeof operator to a bit-field member. * * SECTION: Structs and Unions/Bit-Fields */ #pragma D option quiet struct bitRecord{ int a : 1; int b : 3; int c : 12; } var; BEGIN { printf("sizeof (a): %d\nsizeof (b): %d\nsizeof (c): %n", sizeof (var.a), sizeof (var.b), sizeof (var.c)); exit(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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * ASSERTION: Bit-field will be automatically promoted to the next largest * integer type for use in any expression and then the value assigned will * warp around the maximum number assignable to the data type. * * SECTION: Structs and Unions/Bit-Fields */ #pragma D option quiet struct bitRecord{ int a : 1; int b : 15; int c : 31; } var; BEGIN { var.a = 256; var.b = 65536; var.c = 4294967296; printf("bitRecord.a: %d\nbitRecord.b: %d\nbitRecord.c: %d\n", var.a, var.b, var.c); exit(0); } END /(0 != var.a) || (0 != var.b) || (0 != var.c)/ { exit(1); } /* * 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. */ /* * ASSERTION: C and D compilers try to pack bits as efficiently as possible. * * SECTION: Structs and Unions/Bit-Fields */ #pragma D option quiet struct bitRecord1 { int a : 1; } var1; struct bitRecord2 { int a : 1; int b : 3; } var2; struct bitRecord3 { int a : 1; int b : 3; int c : 3; } var3; struct bitRecord4 { int a : 1; int b : 3; int c : 3; int d : 3; } var4; struct bitRecord5 { int c : 12; int a : 10; int b : 3; } var5; struct bitRecord6 { int a : 20; int b : 3; int c : 12; } var6; struct bitRecord7 { long c : 32; long long d: 9; int e: 1; } var7; struct bitRecord8 { char a : 2; short b : 12; long c : 32; } var8; struct bitRecord12 { int a : 30; int b : 30; int c : 32; } var12; BEGIN { printf("sizeof (bitRecord1): %d\n", sizeof (var1)); printf("sizeof (bitRecord2): %d\n", sizeof (var2)); printf("sizeof (bitRecord3): %d\n", sizeof (var3)); printf("sizeof (bitRecord4): %d\n", sizeof (var4)); printf("sizeof (bitRecord5): %d\n", sizeof (var5)); printf("sizeof (bitRecord6): %d\n", sizeof (var6)); printf("sizeof (bitRecord7): %d\n", sizeof (var7)); printf("sizeof (bitRecord8): %d\n", sizeof (var8)); printf("sizeof (bitRecord12): %d\n", sizeof (var12)); exit(0); } END /(1 != sizeof (var1)) || (2 != sizeof (var2)) || (3 != sizeof (var3)) || (4 != sizeof (var4)) || (5 != sizeof (var5)) || (6 != sizeof (var6)) || (7 != sizeof (var7)) || (8 != sizeof (var8)) || (12 != sizeof (var12))/ { exit(1); } /* * This file and its contents are supplied under the terms of the * Common Development and Distribution License ("CDDL"), version 1.0. * You may only use this file in accordance with the terms of version * 1.0 of the CDDL. * * A full copy of the text of the CDDL should have accompanied this * source. A copy of the CDDL is also available via the Internet at * http://www.illumos.org/license/CDDL. */ /* * Copyright 2022 Oxide Computer Company */ /* * This is designed to allow us to execute print() and various dereferencing * operations with bitfields. It reads the values from argc and passes them to * functions that we can then take apart. Crtitically this uses bitfields * constructed via CTF and not the D compiler. */ #include #include #include #include #include typedef struct bit0 { uint32_t a:3; uint32_t b:2; uint32_t c:1; uint32_t d:1; uint32_t e:1; uint32_t f:1; uint32_t g:3; uint32_t h:3; uint32_t i:5; uint32_t j:4; uint32_t k:6; uint32_t l:1; uint32_t m:1; } bit0_t; typedef struct bit1 { uint16_t a:1; uint16_t b:8; uint16_t c:3; uint16_t d:2; uint16_t e:1; uint16_t f:1; } bit1_t; void mumble(FILE *f, bit0_t *zero, bit1_t *one) { (void) fprintf(f, "%u\n%u\n", zero->k, one->d); } int main(int argc, char *argv[]) { unsigned long l; uint16_t u16; uint32_t u32; FILE *f; if (argc != 3) { errx(EXIT_FAILURE, "Need two ints"); } f = fopen("/dev/null", "rw+"); if (f == NULL) { err(EXIT_FAILURE, "failed to open /dev/null"); } errno = 0; l = strtoul(argv[1], NULL, 0); if (errno != 0 || l == 0 || l > UINT16_MAX) { errx(EXIT_FAILURE, "invalid u16 value: %s", argv[1]); } u16 = (uint16_t)l; l = strtoul(argv[2], NULL, 0); if (errno != 0 || l == 0 || l > UINT32_MAX) { errx(EXIT_FAILURE, "invalid u32 value: %s", argv[1]); } u32 = (uint32_t)l; mumble(f, (bit0_t *)&u32, (bit1_t *)&u16); return (0); } #!/usr/bin/ksh # # # This file and its contents are supplied under the terms of the # Common Development and Distribution License ("CDDL"), version 1.0. # You may only use this file in accordance with the terms of version # 1.0 of the CDDL. # # A full copy of the text of the CDDL should have accompanied this # source. A copy of the CDDL is also available via the Internet at # http://www.illumos.org/license/CDDL. # # # Copyright 2022 Oxide Computer Company # # # This test acts as a series of regression tests in DTrace around # printing bitfields that are byte sized at non-byte aligned offsets and # around printing fields that are less than a byte in size, but due to their # offset, cross a byte boundary (e.g. a 5-bit bitfield that starts at # bit 6). # # The DTrace implementation has two different general paths for this: # # o The D compiler compiling a dereference into DIF code to be executed # in probe context to extract a bitfield value. # o The print() action which grabs the larger chunk of memory and then # processes it all in userland. # if [ $# != 1 ]; then echo expected one argument: '<'dtrace-path'>' exit 2 fi dtrace=$1 exe="tst.bitfields.exe" elfdump "./$exe" | grep -q '.SUNW_ctf' if (( $? != 0 )); then echo "CTF does not exist in $exe, that's a bug" >&2 exit 1 fi $dtrace -qs /dev/stdin -c "./$exe 0xe417 0x9391d7db" <b); printf("\n0x%x 0x%x 0x%x 0x%x 0x%x 0x%x\n", args[2]->a, args[2]->b, args[2]->c, args[2]->d, args[2]->e, args[2]->f); trace(args[1]->i); printf("\n0x%x 0x%x 0x%x 0x%x\n", args[1]->g, args[1]->h, args[1]->i, args[1]->j); } EOF exit $rc bit0_t { unsigned int:3 a :3 = 0x3 unsigned int:2 b :2 = 0x3 unsigned int:1 c :1 = 0 unsigned int:1 d :1 = 0x1 unsigned int:1 e :1 = 0x1 unsigned int:1 f :1 = 0x1 unsigned int:3 g :3 = 0x3 unsigned int:3 h :3 = 0x5 unsigned int:5 i :5 = 0x3 unsigned int:4 j :4 = 0x9 unsigned int:6 k :6 = 0x13 unsigned int:1 l :1 = 0 unsigned int:1 m :1 = 0x1 } bit1_t { unsigned short:1 a :1 = 0x1 unsigned short:8 b :8 = 0xb unsigned short:3 c :3 = 0x2 unsigned short:2 d :2 = 0x2 unsigned short:1 e :1 = 0x1 unsigned short:1 f :1 = 0x1 } 11 0x1 0xb 0x2 0x2 0x1 0x1 3 0x3 0x5 0x3 0x9 /* * 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. */ /* * ASSERTION: * Checks that buffer space for an END enabling is always reserved in a * fill buffer. This will fail because the size of the END enabling * (64 bytes) exceeds the size of the buffer (32 bytes). * * SECTION: Buffers and Buffering/fill Policy; * Buffers and Buffering/Buffer Sizes; * Options and Tunables/bufpolicy; * Options and Tunables/bufsize; * Options and Tunables/strsize */ #pragma D option bufpolicy=fill #pragma D option bufsize=32 #pragma D option strsize=64 BEGIN { exit(0); } END { trace(execname); } /* * 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. */ /* * ASSERTION: * Checks that setting "bufresize" to "manual" will cause buffer * allocation to fail for large principal buffer sizes. * * SECTION: Buffers and Buffering/Buffer Resizing Policy; * Options and Tunables/bufsize; * Options and Tunables/bufresize * */ #pragma D option bufresize=manual #pragma D option bufsize=100t BEGIN { exit(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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * ASSERTION: * Checks that setting "bufresize" to "manual" will cause buffer * allocation to fail for large aggregation buffer sizes. * * SECTION: Buffers and Buffering/Buffer Resizing Policy; * Options and Tunables/bufresize; * Options and Tunables/aggsize * */ #pragma D option bufresize=manual #pragma D option aggsize=100t BEGIN { @a[probeprov] = count(); exit(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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * ASSERTION: * Checks that setting "bufresize" to "manual" will cause buffer * allocation to fail for large speculative buffer sizes. * * SECTION: Buffers and Buffering/Buffer Resizing Policy; * Options and Tunables/bufresize; * Options and Tunables/specsize * */ #pragma D option bufresize=manual #pragma D option specsize=100t BEGIN { spec = speculation(); } BEGIN { speculate(spec); trace(epid); } BEGIN { commit(spec); } BEGIN { exit(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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * ASSERTION: * Test with a bufsize of 0 - should return an error. * * SECTION: * Buffers and Buffering/Buffer Sizes; * Options and Tunables/bufsize */ #pragma D option bufsize=0 BEGIN { exit(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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * ASSERTION: * Positive test for ring buffer policy. * * SECTION: Buffers and Buffering/ring Policy; * Buffers and Buffering/Buffer Sizes; * Options and Tunables/bufsize; * Options and Tunables/bufpolicy */ #pragma D option bufpolicy=ring #pragma D option bufsize=4k profile:::profile-1009hz { printf("%x %x\n", (int)0xaaaa, (int)0xbbbb); } profile:::profile-1237hz { printf("%x %x %x %x %x %x\n", (int)0xcccc, (int)0xdddd, (int)0xeeee, (int)0xffff, (int)0xabab, (int)0xacac); printf("%x %x\n", (uint64_t)0xaabbaabbaabbaabb, (int)0xadad); } profile:::profile-1789hz { printf("%x %x %x %x %x\n", (int)0xaeae, (int)0xafaf, (unsigned char)0xaa, (int)0xbcbc, (int)0xbdbd); } profile-1543hz {} profile-1361hz {} tick-1sec /i++ >= 10/ { exit(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 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # #ident "%Z%%M% %I% %E% SMI" script() { $dtrace -s /dev/stdin -x bufpolicy=$1 $1 <on = vtimestamp; } sched:::off-cpu /self->on/ { total += vtimestamp - self->on; } tick-1sec /i++ == 10/ { exit(0); } END /((total * 100) / (timestamp - start)) > thresh/ { printf("'%s' buffering policy took %d%% of CPU; ", \$\$1, ((total * 100) / (timestamp - start))); printf("expected no more than %d%%!\n", thresh); exit(1); } EOF } if [ $# != 1 ]; then echo expected one argument: '<'dtrace-path'>' exit 2 fi dtrace=$1 for policy in "fill ring switch"; do script $policy status=$? if [ "$status" -ne 0 ]; then exit $status fi done exit 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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * ASSERTION: * Positive test for dynamic variable size. * * SECTION: Buffers and Buffering/switch Policy; * Buffers and Buffering/Buffer Sizes; * Options and Tunables/bufsize; * Options and Tunables/bufpolicy; * Options and Tunables/switchrate */ #pragma D option dynvarsize=100 #pragma D option quiet int n; tick-10ms /n++ < 100/ { a[n] = 1; } tick-10ms /n == 100/ { exit(2); } END /a[99]/ { exit(1); } END /!a[99]/ { exit(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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * 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; * 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 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=128 #pragma D option statusrate=10ms #pragma D option quiet int i; tick-10ms { printf("%d\n", i++); } tick-10ms { printf("%d\n", i++); } tick-10ms { printf("%d\n", i++); } tick-10ms { printf("%d\n", i++); } tick-10ms { printf("%d\n", i++); } tick-10ms { printf("%d\n", i++); } tick-10ms { printf("%d\n", i++); } tick-10ms { printf("%d\n", i++); } tick-10ms { printf("%d\n", i++); } tick-10ms { printf("%d\n", i++); } tick-10ms { printf("%d\n", i++); } tick-10ms { printf("%d\n", i++); } tick-10ms /i >= 100/ { exit(1); } 0 1 2 3 4 5 6 7 /* * 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. */ /* * ASSERTION: * Checks that setting "bufresize" to "auto" will cause buffer * allocation to succeed, even for large principal buffer sizes. * * SECTION: Buffers and Buffering/Buffer Resizing Policy; * Options and Tunables/bufsize; * Options and Tunables/bufresize */ #pragma D option bufresize=auto #pragma D option bufsize=100t BEGIN { exit(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. */ /* * ASSERTION: * Checks that setting "bufresize" to "auto" will cause buffer * allocation to succeed, even for large aggregation buffer sizes. * * SECTION: Buffers and Buffering/Buffer Resizing Policy; * Options and Tunables/aggsize; * Options and Tunables/bufresize */ #pragma D option bufresize=auto #pragma D option aggsize=100t BEGIN { @a[probeprov] = count(); exit(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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * ASSERTION: * Checks that setting "bufresize" to "auto" will cause buffer * allocation to succeed, even for large speculative buffer sizes. * * SECTION: Buffers and Buffering/Buffer Resizing Policy; * Options and Tunables/specsize; * Options and Tunables/bufresize * * NOTES: * On some small memory machines, this test may consume so much memory * that it induces memory allocation failure in the dtrace library. This * will manifest itself as an error like one of the following: * * dtrace: processing aborted: Memory allocation failure * dtrace: could not enable tracing: Memory allocation failure * * These actually indicate that the test performed as expected; failures * of the above nature should therefore be ignored. * */ #pragma D option bufresize=auto #pragma D option specsize=100t BEGIN { spec = speculation(); } BEGIN { speculate(spec); trace(epid); } BEGIN { commit(spec); } BEGIN { exit(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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * ASSERTION: * Positive test for ring buffer policy. * * SECTION: Buffers and Buffering/ring Policy; * Buffers and Buffering/Buffer Sizes; * Options and Tunables/bufsize; * Options and Tunables/bufpolicy; * Options and Tunables/switchrate */ /* * We assume that a trace() of an integer stores at least 8 bytes. If ring * buffering is not working properly, this trace() will induce a drop, and the * counter won't be incremented. We set the switchrate to one second just to * sure that a high switchrate doesn't mask broken ring buffers. */ #pragma D option bufpolicy=ring #pragma D option bufsize=50 #pragma D option switchrate=1sec int n; int i; tick-10msec /n < 300/ { trace(i); i++; } tick-10msec /n < 300/ { n++; } tick-10msec /n == 300/ { exit(2); } END { exit(i == 300 ? 0 : 1); } /* * 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. */ /* * ASSERTION: * Positive test for ring buffer policy. * * SECTION: Buffers and Buffering/ring Policy; * SECTION: Buffers and Buffering/Buffer Sizes; * Options and Tunables/bufsize; * Options and Tunables/bufpolicy */ #pragma D option bufpolicy=ring #pragma D option bufsize=512k #pragma D option quiet tick-1sec /n < 5/ { printf("%d\n", n++); } tick-1sec /n == 5/ { exit(0); } 0 1 2 3 4 /* * 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. */ /* * ASSERTION: * Positive test for ring buffer policy. * * SECTION: Buffers and Buffering/ring Policy; * Buffers and Buffering/Buffer Sizes; * Options and Tunables/bufsize; * Options and Tunables/bufpolicy */ /* * 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=80 #pragma D option quiet int n; BEGIN { cpuid = -1; } tick-10msec /cpuid == -1/ { cpuid = curthread->t_cpu->cpu_id; } tick-10msec /curthread->t_cpu->cpu_id == cpuid && n < 100/ { printf("%d\n", n++); } tick-10msec /n == 100/ { exit(0); } 96 97 98 99 /* * 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. */ /* * ASSERTION: * Positive test for ring buffer policy. * * SECTION: Buffers and Buffering/ring Policy; * Buffers and Buffering/Buffer Sizes; * Options and Tunables/bufsize; * Options and Tunables/bufpolicy */ #pragma D option bufpolicy=ring #pragma D option bufsize=16 tick-10ms { trace(0xbadbaddefec8d); } tick-10ms /0/ { trace((int)1); } tick-100ms /i++ > 2/ { exit(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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * ASSERTION: * Positive test for switch buffer policy. * * SECTION: Buffers and Buffering/switch Policy; * Buffers and Buffering/Buffer Sizes; * Options and Tunables/bufsize; * Options and Tunables/bufpolicy; * Options and Tunables/switchrate */ /* * We assume that a printf() of an integer stores at least 8 bytes, and no more * than 16 bytes. */ #pragma D option bufpolicy=switch #pragma D option bufsize=32 #pragma D option switchrate=500msec #pragma D option quiet int n; int i; tick-1sec /n < 10/ { printf("%d\n", i); i++; } tick-1sec /n < 10/ { n++; } tick-1sec /n == 10/ { exit(0); } 0 1 2 3 4 5 6 7 8 9 /* * 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. */ /* * ASSERTION: * print non assigned value and make sure it fails. * * SECTION: Variables/Built-in Variables */ #pragma D option quiet BEGIN { printf("The cpuusage = %d\n", curlwpsinfo->pr_cpu); exit (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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * ASSERTION: * print non assigned value and make sure it fails. * * SECTION: Variables/Built-in Variables * * */ #pragma D option quiet BEGIN { printf("The nice for cpu usage %c\n", curlwpsinfo->pr_nice); exit (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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * ASSERTION: * Print non assigned variables and make sure it fails. * * SECTION: Variables/Built-in Variables */ #pragma D option quiet BEGIN { printf("The low value is high priority field = %d\n", curlwpsinfo->pr_nice); exit (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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * ASSERTION: * print non assigned variables and make sure it fails. * * SECTION: Variables/Built-in Variables */ #pragma D option quiet BEGIN { printf("Size of process image in kbytes = %ld\n", curpsinfo->pr_size); exit (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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * ASSERTION: * print non assigned variables and make sure it fails. * * SECTION: Variables/Built-in Variables */ #pragma D option quiet BEGIN { printf("Size of process image in kbytes = %ld\n", curpsinfo->pr_rssize); exit (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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * ASSERTION: * print arg0 and make sure it succeeds. * * SECTION: Variables/Built-in Variables */ #pragma D option quiet BEGIN { printf("The argument is %u\n", arg0); exit(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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * ASSERTION: * print arg0 from a profile and make sure it succeeds * * SECTION: Variables/Built-in Variables */ #pragma D option quiet BEGIN { printf("Call probe read\n"); } syscall:::entry { printf("The argument is %u", arg0); exit(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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * ASSERTION: * print arg1 and make sure it succeeds. * * SECTION: Variables/Built-in Variables */ #pragma D option quiet BEGIN { printf("The argument is %u\n", arg1); exit(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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * ASSERTION: * print arg1 to arg8 and make sure it succeeds. * * SECTION: Variables/Built-in Variables */ #pragma D option quiet BEGIN { printf("The argument is %u %u %u %u %u %u %u %u\n", arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8); exit(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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * ASSERTION: * print arg1 to arg8 from a profile and make sure it succeeds * * SECTION: Variables/Built-in Variables */ #pragma D option quiet BEGIN { } syscall:::entry { printf("The argument is %u %u %u %u %u %u %u %u\n", arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8); exit(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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * ASSERTION: * print 'caller' and make sure it succeeds. * * SECTION: Variables/Built-in Variables */ #pragma D option quiet BEGIN { printf("The caller is %u\n", caller); exit(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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * ASSERTION: * To print caller form profile and make sure it succeeds. * * SECTION: Variables/Built-in Variables */ #pragma D option quiet BEGIN { } tick-10ms { printf("The caller is %u\n", caller); exit (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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * ASSERTION: * To print 'epid'from profile and make sure it succeeds * * SECTION: Variables/Built-in Variables */ #pragma D option quiet BEGIN { } tick-10ms { printf("epid of this probe = %d\n", epid); exit (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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * ASSERTION: * print epid and make sure it succeeds. * * SECTION: Variables/Built-in Variables */ #pragma D option quiet BEGIN { printf("epid of this probe = %d\n", epid); exit (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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * ASSERTION: * To print errno from profile and make sure it succeeds. * * SECTION: Variables/Built-in Variables */ #pragma D option quiet BEGIN { } tick-10ms { printf("epid of this probe = %d\n", epid); printf("the errno = %d\n", errno); exit (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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * ASSERTION: * To print errno and make sure it succeeds. * * SECTION: Variables/Built-in Variables */ #pragma D option quiet BEGIN { printf("epid of this probe = %d\n", epid); printf("the errno = %d\n", errno); exit (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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * ASSERTION: * To print execname and make sure it succeeds. * * SECTION: Variables/Built-in Variables */ #pragma D option quiet BEGIN /execname == "dtrace" || execname == "java"/ { trace("execname matched"); exit(0); } BEGIN { trace("execname didn't match"); exit(1); } /* * 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. */ /* * ASSERTION: * To print hpriority and make sure it succeeds * * SECTION: Variables/Built-in Variables */ #pragma D option quiet BEGIN { printf("The high priority = %d\n", curlwpsinfo->pr_pri); exit (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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * ASSERTION: * To print 'id' from profile. * * SECTION: Variables/Built-in Variables */ #pragma D option quiet BEGIN { } tick-10ms { printf("id of this probe = %d\n", id); exit (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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * ASSERTION: * To print id and make sure it succeeds. * * SECTION: Variables/Built-in Variables */ #pragma D option quiet BEGIN { printf("id of this probe = %d\n", id); exit (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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * ASSERTION: * To print variable ipl * * SECTION: Variables/Built-in Variables */ #pragma D option quiet BEGIN { } tick-10ms { printf("The interrupt priority level = %u\n", ipl); exit (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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * ASSERTION: * To print ipl and make sure it succeeds * * SECTION: Variables/Built-in Variables */ #pragma D option quiet BEGIN { printf("The interrupt priority level = %u\n", ipl); exit (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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * ASSERTION: * To print lwpsinfo_t structure values. * * SECTION: Variables/Built-in Variables */ #pragma D option quiet BEGIN { } tick-10ms { printf("The current thread's pr_flag is %d\n", curlwpsinfo->pr_flag); printf("The current threads lwpid is %d\n", curlwpsinfo->pr_lwpid); printf("The current thread's internal address is %u\n", curlwpsinfo->pr_addr); printf("The current thread's wait addr for sleeping lwp is %u\n", curlwpsinfo->pr_wchan); printf("The current lwp stat is %d\n", curlwpsinfo->pr_state); printf("The printable character for pr_state %c\n", curlwpsinfo->pr_sname); printf("The syscall number = %d\n", curlwpsinfo->pr_syscall); exit (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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * ASSERTION: * To print lwpsinfo_t variables and make sure it succeeds * * SECTION: Variables/Built-in Variables */ #pragma D option quiet BEGIN { printf("The current thread's pr_flag is %d\n", curlwpsinfo->pr_flag); printf("The current threads lwpid is %d\n", curlwpsinfo->pr_lwpid); printf("The current thread's internal address is %u\n", curlwpsinfo->pr_addr); printf("The current thread's wait addr for sleeping lwp is %u\n", curlwpsinfo->pr_wchan); printf("The current lwp stat is %d\n", curlwpsinfo->pr_state); printf("The printable character for pr_state %c\n", curlwpsinfo->pr_sname); printf("The syscall number = %d\n", curlwpsinfo->pr_syscall); exit (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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * ASSERTION: * To print 'pid' from profile. * * SECTION: Variables/Built-in Variables */ #pragma D option quiet BEGIN { } tick-10ms { printf("process id = %d \n", pid); exit (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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * ASSERTION: * To print 'pid' and make sure it succeeds. * * SECTION: Variables/Built-in Variables */ #pragma D option quiet BEGIN { printf("process id = %d \n", pid); exit (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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * ASSERTION: * To print psinfo structure values from profile. * * SECTION: Variables/Built-in Variables */ #pragma D option quiet BEGIN { } tick-10ms { printf("number of lwps in process = %d\n", curpsinfo->pr_nlwp); printf("unique process id = %d\n", curpsinfo->pr_pid); printf("process id of parent = %d\n", curpsinfo->pr_ppid); printf("pid of process group leader = %d\n", curpsinfo->pr_pgid); printf("session id = %d\n", curpsinfo->pr_sid); printf("real user id = %d\n", curpsinfo->pr_uid); printf("effective user id = %d\n", curpsinfo->pr_euid); printf("real group id = %d\n", curpsinfo->pr_gid); printf("effective group id = %d\n", curpsinfo->pr_egid); printf("address of process = %u\n", curpsinfo->pr_addr); exit (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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * ASSERTION: * To print psinfo structure values. * * SECTION: Variables/Built-in Variables */ #pragma D option quiet BEGIN { printf("number of lwps in process = %d\n", curpsinfo->pr_nlwp); printf("unique process id = %d\n", curpsinfo->pr_pid); printf("process id of parent = %d\n", curpsinfo->pr_ppid); printf("pid of process group leader = %d\n", curpsinfo->pr_pgid); printf("session id = %d\n", curpsinfo->pr_sid); printf("real user id = %d\n", curpsinfo->pr_uid); printf("effective user id = %d\n", curpsinfo->pr_euid); printf("real group id = %d\n", curpsinfo->pr_gid); printf("effective group id = %d\n", curpsinfo->pr_egid); printf("address of process = %u\n", curpsinfo->pr_addr); exit (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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * ASSERTION: * To print tid from profile * * SECTION: Variables/Built-in Variables */ #pragma D option quiet BEGIN { } tick-10ms { printf("Thread id = %d \n", tid); exit (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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * ASSERTION: * To print tid and make sure it succeeds. * * SECTION: Variables/Built-in Variables */ #pragma D option quiet BEGIN { printf("Thread id = %d \n", tid); exit (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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * ASSERTION: * To print build-in variable 'timestamp' * * SECTION: Variables/Built-in Variables */ #pragma D option quiet BEGIN { self->t = timestamp; printf("The difftime = %d\n", timestamp - self->t); exit(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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * ASSERTION: * To print build-in variable 'vtimestamp' * * SECTION: Variables/Built-in Variables */ #pragma D option quiet BEGIN { self->t = vtimestamp; printf("The difftime = %d\n", vtimestamp - self->t); exit(0); } /* * CDDL HEADER START * * This file and its contents are supplied under the terms of the * Common Development and Distribution License ("CDDL"), version 1.0. * You may only use this file in accordance with the terms of version * 1.0 of the CDDL. * * A full copy of the text of the CDDL should have accompanied this * source. A copy of the CDDL is also available via the Internet at * http://www.illumos.org/license/CDDL. * * CDDL HEADER END */ /* * Copyright (c) 2012 by Delphix. All rights reserved. */ /* * 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); } /* * 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); } /* * 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. */ /* * ASSERTION: Test a clause where an unknown identifier appears in a predicated * clause inside an aggregating function. * SECTION: Program Structure / Probe Clauses and Declarations * */ BEGIN /1/ { @a = max(x); } /* * 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. */ /* * ASSERTION: Test a clause where an unknown identifier appears in a predicated * clause inside an aggregation tuple. * SECTION: Program Structure / Probe Clauses and Declarations * */ BEGIN /1/ { @a[x] = count(); } /* * 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. */ /* * ASSERTION: Test a clause where an unknown identifier appears in a predicated * clause inside an associate array tuple. * SECTION: Program Structure / Probe Clauses and Declarations * */ BEGIN /1/ { a[x]++; } /* * 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. */ /* * ASSERTION: Test a clause where an unknown identifier appears in a clause. * SECTION: Program Structure / Probe Clauses and Declarations * */ BEGIN { exit(x); } /* * 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. */ /* * ASSERTION: Test a clause where an unknown identifier appears in a predicate * and in a clause body. * * SECTION: Program Structure / Probe Clauses and Declarations * */ BEGIN /x != 0/ { exit(x); } /* * 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. */ /* * ASSERTION: Test a clause where an unknown identifier appears in a predicate. * SECTION: Program Structure / Probe Clauses and Declarations * */ BEGIN /x != 0/ { exit(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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * ASSERTION: Test a clause that has a body but no predicate. * SECTION: Program Structure / Probe Clauses and Declarations * */ BEGIN { exit(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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * ASSERTION: Test a clause that has a body and a predicate. * SECTION: Program Structure / Probe Clauses and Declarations * */ BEGIN /$pid != 0/ { exit(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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * ASSERTION: Test a clause that has a body and a predicate where the * predicate must be cooked first because it creates a variable. * * SECTION: Program Structure / Probe Clauses and Declarations * */ BEGIN /x++ == 0/ { exit(x - 1); } /* * 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. */ /* * ASSERTION: Test a clause that has a body and a predicate where the * predicate must be cooked last because the clause creates * a variable which is referenced in the predicate. * * SECTION: Program Structure / Probe Clauses and Declarations * */ BEGIN /x == 0/ { exit(x++); } /* * 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 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * Test to check that attempting to enable a valid event with a frequency * lower than the default platform limit will fail. * * This test will fail if: * 1) The system under test does not define the 'PAPI_tot_ins' event. * 2) The 'dcpc-min-overflow' variable in dcpc.conf has been modified. */ #pragma D option quiet BEGIN { exit(0); } cpc:::PAPI_tot_ins-all-100 { } /* * 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 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * Tests that specifying an overflow value containing extraneous characters * (only digits are allowed) will fail. */ BEGIN { exit(0); } cpc:::PAPI_tot_ins-all-10000bonehead { @[probename] = count(); } /* * 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 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * Tests that attempting to enable a probe containing a non existent event * will fail. */ BEGIN { exit(0); } cpc:::PAPI_cpc_bad-all-10000 { @[probename] = count(); } #!/bin/ksh # # 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 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # # This tests that cpustat(1) should fail to start if the cpc provider # is already calling the shots. # # This script will fail if: # 1) The system under test does not define the 'PAPI_tot_ins' # generic event. script() { $dtrace -o $dtraceout -s /dev/stdin <' exit 2 fi dtrace=$1 dtraceout=/tmp/dtrace.out.$$ script 2>/dev/null & timeout=15 # # Sleep while the above script fires into life. To guard against dtrace dying # and us sleeping forever we allow 15 secs for this to happen. This should be # enough for even the slowest systems. # while [ ! -f $dtraceout ]; do sleep 1 timeout=$(($timeout-1)) if [ $timeout -eq 0 ]; then echo "dtrace failed to start. Exiting." exit 1 fi done cpustat -c PAPI_tot_ins 1 5 status=$? rm $dtraceout exit $status #!/bin/ksh -p # # 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 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # # This tests that enablings from the cpc provider will fail if cpustat(1) is # already master of the universe. # # This script will fail if: # 1) The system under test does not define the 'PAPI_tot_ins' # generic event. script() { $dtrace -s /dev/stdin <' exit 2 fi dtrace=$1 dtraceout=/tmp/dtrace.out.$$ cpustat -c PAPI_tot_ins 1 20 & pid=$! sleep 5 script 2>/dev/null status=$? kill $pid exit $status #!/bin/ksh # # 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 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # This script ensures that cputrack(8) will fail to start when the cpc # provider has active enablings. # # The script will fail if: # 1) The system under test does not define the 'PAPI_tot_ins' event. # script() { $dtrace -o $dtraceout -s /dev/stdin <' exit 2 fi dtrace=$1 dtraceout=/tmp/dtrace.out.$$ script 2>/dev/null & timeout=15 # # Sleep while the above script fires into life. To guard against dtrace dying # and us sleeping forever we allow 15 secs for this to happen. This should be # enough for even the slowest systems. # while [ ! -f $dtraceout ]; do sleep 1 timeout=$(($timeout-1)) if [ $timeout -eq 0 ]; then echo "dtrace failed to start. Exiting." exit 1 fi done cputrack -c PAPI_tot_ins sleep 10 status=$? rm $dtraceout exit $status #!/bin/ksh # # 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 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # This script ensures that cputrack(1) will terminate when the cpc provider # kicks into life. # # The script will fail if: # 1) The system under test does not define the 'PAPI_tot_ins' event. # script() { $dtrace -s /dev/stdin < 10/ { exit(0); } EOF } if [ $# != 1 ]; then echo expected one argument: '<'dtrace-path'>' exit 2 fi dtrace=$1 cputrack -c PAPI_tot_ins sleep 20 & cputrack_pid=$! sleep 5 script 2>/dev/null & wait $cputrack_pid status=$? rm $dtraceout exit $status /* * 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 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * Test to check that attempting to enable too many probes will fail. * * This test will fail if: * 1) We ever execute on a platform which is capable of programming 10 * 'PAPI_tot_ins' events simultaneously (which no current platforms are * capable of doing). * 2) The system under test does not define the 'PAPI_tot_ins' event. */ #pragma D option quiet BEGIN { exit(0); } cpc:::PAPI_tot_ins-all-10000, cpc:::PAPI_tot_ins-all-10001, cpc:::PAPI_tot_ins-all-10002, cpc:::PAPI_tot_ins-all-10003, cpc:::PAPI_tot_ins-all-10004, cpc:::PAPI_tot_ins-all-10005, cpc:::PAPI_tot_ins-all-10006, cpc:::PAPI_tot_ins-all-10007, cpc:::PAPI_tot_ins-all-10008, cpc:::PAPI_tot_ins-all-10009 { } #!/bin/ksh # # 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 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # # This script verifies that we can fire a probe on each CPU that is in # an online state. # # The script will fail if: # 1) The system under test does not define the 'PAPI_tot_ins' event. # if [ $# != 1 ]; then echo expected one argument: '<'dtrace-path'>' exit 2 fi dtrace=$1 numproc=`psrinfo | tail -1 | cut -f1` cpu=0 dtraceout=/var/tmp/dtrace.out.$$ scriptout=/var/tmp/script.out.$$ spin() { while [ 1 ]; do : done } script() { $dtrace -o $dtraceout -s /dev/stdin < 10/ { printa(@a); exit(0); } EOF } echo "" > $scriptout while [ $cpu -le $numproc ] do if [ "`psrinfo -s $cpu 2> /dev/null`" -eq 1 ]; then printf "%9d %16d\n" $cpu 1 >> $scriptout spin & allpids[$cpu]=$! pbind -b $cpu $! fi cpu=$(($cpu+1)) done echo "" >> $scriptout script diff $dtraceout $scriptout >/dev/null 2>&1 status=$? # kill off the spinner processes cpu=0 while [ $cpu -le $numproc ] do if [ "`psrinfo -s $cpu 2> /dev/null`" -eq 1 ]; then kill ${allpids[$cpu]} fi cpu=$(($cpu+1)) done rm $dtraceout rm $scriptout exit $status /* * 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 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * Test that we can successfully enable a probe using a generic event. * Currently, all platforms implement 'PAPI_tot_ins' so we'll use that. * Note that this test will fail if the system under test does not * implement that event. * * This test will fail if: * 1) The system under test does not define the 'PAPI_tot_ins' event. */ #pragma D option quiet #pragma D option bufsize=128k cpc:::PAPI_tot_ins-all-10000 { @[probename] = count(); } tick-1s /n++ > 10/ { exit(0); } #!/bin/ksh # # 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 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # # This script ensures that we can enable a probe which specifies a platform # specific event. # if [ $# != 1 ]; then print -u2 "expected one argument: " exit 2 fi dtrace=$1 get_event() { perl /dev/stdin /dev/stdout << EOF open CPUSTAT, '/usr/sbin/cpustat -h |' or die "Couldn't run cpustat: \$!\n"; while () { if (/(\s+)event\[*[0-9]-*[0-9]*\]*:/ && !/PAPI/) { @a = split(/ /, \$_); \$event = \$a[\$#a-1]; } } close CPUSTAT; print "\$event\n"; EOF } script() { $dtrace -s /dev/stdin << EOD #pragma D option quiet #pragma D option bufsize=128k cpc:::$1-all-10000 { @[probename] = count(); } tick-1s /n++ > 5/ { exit(0); } EOD } event=$(get_event) script $event status=$? exit $status /* * 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. */ /* * ASSERTION: * associative arrays may not be declared as local variables * * SECTION: Errtags/D_DECL_LOCASSC * */ #pragma D option quiet this int a[int]; BEGIN { exit(0); } ERROR { exit(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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * ASSERTION: * long and long long may only be used with integer or floating-point type * * SECTION: Errtags/D_DECL_LONGINT * */ #pragma D option quiet long struct mystruct { int i; }; BEGIN { exit(0); } ERROR { exit(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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * ASSERTION: * inappropriate storage class for function or associative array parameter * throws a D_DECL_PARMCLASS * * SECTION: Errtags/D_DECL_PARMCLASS * */ #pragma D option quiet int foo(static int); BEGIN { exit(0); } ERROR { exit(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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * Assert that a void parameter in a declaration where void is permitted * may not have a parameter formal name associated with it. */ int a(void v); BEGIN, ERROR { exit(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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * Assert that a function parameter in a declaration may not use a dynamic * DTrace type such as an associative array type. */ int a(int a[int]); BEGIN, ERROR { exit(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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * ASSERTION: * array tuples may not use variable-length argument lists * * SECTION: Errtags/ D_DECL_ARRVA * */ #pragma D option quiet int a[...]; BEGIN { exit(0); } ERROR { exit(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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * ASSERTION: * void must be sole parameter in a function declaration. * * SECTION: Errtags/D_DECL_FUNCVOID * */ #pragma D option quiet int foo(int, void); BEGIN { exit(0); } ERROR { exit(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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * ASSERTION: * signed and unsigned may only be used with integer type * * SECTION: Errtags/D_DECL_SIGNINT * */ #pragma D option quiet /*DSTYLED*/ unsigned struct mystruct { int i; }; BEGIN { exit(0); } ERROR { exit(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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * ASSERTION: * Attributes may not be used with void type. * * SECTION: Errtags/D_DECL_VOIDATTR * */ #pragma D option quiet short void ptr; BEGIN { exit(0); } ERROR { exit(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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * ASSERTION: * Test various kinds of array declarations. * * SECTION: Program Structure/Probe Clauses and Declarations * */ extern int a1[]; extern int a2[1]; extern int a3[123][456]; extern int a4[123][456][789]; extern int a5[5], a6[6][6], a7[7][7][7]; BEGIN { exit(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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * ASSERTION: * Test a variety of extern declarations that exercise the different * kinds of declarations that we can process. * * SECTION: Program Structure/Probe Clauses and Declarations * */ extern void *e1; extern char e2; extern signed char e3; extern unsigned char e4; extern short e5; extern signed short e6; extern unsigned short e7; extern int e8; extern e9; extern signed int e10; extern unsigned int e11; extern long e12; extern signed long e13; extern unsigned long e14; extern long long e15; extern signed long long e16; extern unsigned long long e17; extern float e18; extern double e19; extern long double e20; extern vnode_t e21; extern struct vnode e22; extern union sigval e23; extern enum uio_rw e24; BEGIN { exit(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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * ASSERTION: * Test various kinds of function declarations. * * SECTION: Program Structure/Probe Clauses and Declarations */ extern int getint(void); extern int *getptr(void); extern int *(*funcptr)(void); extern int **(**funcptrptr)(void); extern int noparms(); extern int oneparm(int); extern int twoparms(int, int); BEGIN { exit(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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * ASSERTION: * Test multiple extern declarations in a single list which build * up a chain of pointers to pointers to pointers ... * * SECTION: Program Structure/Probe Clauses and Declarations */ extern int e0, *e1, **e2, ***e3, ****e4, *****e5; BEGIN { exit(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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * ASSERTION: * Test functions declarations with varargs * * SECTION: Program Structure/Probe Clauses and Declarations */ #pragma D option quiet extern int varargs1(...); extern int varargs2(int, ...); BEGIN { exit(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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * ASSERTION: * Verify doc example 5-1 * * SECTION: * DocExamples/badptr */ BEGIN { x = (int *)NULL; y = *x; trace(y); } /* * 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. */ /* * ASSERTION: * Verify doc example * * SECTION: * DocExamples/other */ dtrace:::BEGIN { i = 10; } profile:::tick-1sec /i > 0/ { trace(i--); } profile:::tick-1000 /i == 0/ { trace("blastoff!"); exit(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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * ASSERTION: * Verify doc * * SECTION: * DocExamples/other */ dtrace:::BEGIN { i = 0; } profile:::tick-1sec { i = i + 1; trace(i); } dtrace:::END { trace(i); } /* * 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. */ /* * ASSERTION: * Verify doc example 17-1 * * SECTION: * DocExamples/errorpath */ BEGIN { *(char *)NULL; } ERROR { printf("Hit an error!"); } /* * 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. */ /* * ASSERTION: * Verify doc example 1-1 * * SECTION: * DocExamples/hello */ BEGIN { trace("hello, world"); exit(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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * ASSERTION: * Verify doc example 7-3 * * SECTION: * DocExamples/kstat */ #pragma D option quiet pid$1:libkstat:kstat_data_lookup:entry { self->ksname = arg1; } pid$1:libkstat:kstat_data_lookup:return /self->ksname != NULL && arg1 != NULL/ { this->str = copyinstr(self->ksname); this->ksp = (kstat_named_t *)copyin(arg1, sizeof (kstat_named_t)); printf("%s has ui64 value %u\n", this->str, this->ksp->value.ui64); } pid$1:libkstat:kstat_data_lookup:return /self->ksname != NULL && arg1 == NULL/ { self->ksname = NULL; } /* * 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. */ /* * ASSERTION: * Verify doc example 7-2 * * SECTION: * DocExamples/ksyms */ /* Must run "strings -a /dev/ksyms in another shell on the system */ #pragma D option quiet syscall::read:entry /curpsinfo->pr_psargs == "strings -a /dev/ksyms"/ { printf("read %u bytes to user address %x\n", arg2, arg1); self->watched = 1; } syscall::read:return /self->watched/ { self->watched = 0; } fbt::uiomove:entry /self->watched/ { this->iov = args[3]->uio_iov; printf("uiomove %u bytes to %p in pid %d\n", this->iov->iov_len, this->iov->iov_base, pid); } /* * 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. */ /* * ASSERTION: * Verify doc example 9-1 * * SECTION: * DocExamples/renormalize */ #pragma D option quiet BEGIN { start = timestamp; } syscall:::entry { @func[execname] = count(); } tick-10sec { normalize(@func, (timestamp - start) / 1000000000); printa(@func); } /* * 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. */ /* * ASSERTION: * Verify doc example 3-1 * * SECTION: * DocExamples/rtime */ #pragma D option quiet syscall::read:entry { self->t = timestamp; } syscall::read:return /self->t != 0/ { printf("%d/%d spent %d nsecs in read(2)\n", pid, tid, timestamp - self->t); } /* * 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. */ /* * ASSERTION: * Verify doc example * * SECTION: * DocExamples/other */ syscall::read:entry, syscall::write:entry /pid == 102429/ { } /* * 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. */ /* * ASSERTION: * Verify doc example 7-1 * * SECTION: * DocExamples/rwinfo */ #pragma D option quiet struct callinfo { uint64_t ts; uint64_t elapsed; uint64_t calls; size_t maxbytes; }; struct callinfo i[string]; syscall::read:entry, syscall::write:entry /pid == 100551/ { i[probefunc].ts = timestamp; i[probefunc].calls++; i[probefunc].maxbytes = arg2 > i[probefunc].maxbytes ? arg2 : i[probefunc].maxbytes; } syscall::read:return, syscall::write:return /i[probefunc].ts != 0 && pid == 100551/ { i[probefunc].elapsed += timestamp - i[probefunc].ts; } END { printf(" calls max bytes elapsed nsecs\n"); printf("----- ----- --------- -------------\n"); printf(" read %5d %9d %d\n", i["read"].calls, i["read"].maxbytes, i["read"].elapsed); printf(" write %5d %9d %d\n", i["write"].calls, i["write"].maxbytes, i["write"].elapsed); } /* * 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. */ /* * ASSERTION: * Verify doc example 7-1 * * SECTION: * DocExamples/rwinfo */ syscall::read:entry, syscall::write:entry /pid == 100551/ { ts[probefunc] = timestamp; } syscall::read:return, syscall::write:return /(ts[probefunc] != 0) && (pid == 100551)/ { printf("%d nsecs\n", timestamp - ts[probefunc]); } #!/usr/sbin/dtrace -Fs /* * 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. */ /* * ASSERTION: * Verify doc example 13-1 * * SECTION: * DocExamples/specopen */ syscall::open:entry, syscall::open64:entry { self->spec = speculation(); speculate(self->spec); printf("%s", stringof(copyinstr(arg0))); } fbt::: /self->spec/ { speculate(self->spec); } syscall::open:return, syscall::open64:return /self->spec/ { speculate(self->spec); trace(errno); } syscall::open:return, syscall::open64:return /self->spec && errno != 0/ { commit(self->spec); self->spec = 0; } syscall::open:return, syscall::open64:return /self->spec && errno == 0/ { discard(self->spec); self->spec = 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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * ASSERTION: * Verify doc * * SECTION: * DocExamples/truss */ dtrace:::BEGIN { var = 30; self->vaa = 24; } syscall::read:entry /pid == 102473/ { printf("var: %d, self->vaa: %d", var++, self->vaa++); } syscall::write:entry /pid == 102473/ { printf("var: %d, self->vaa: %d", var++, self->vaa++); } /* * 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. */ /* * ASSERTION: * Verify doc example 1-2 * * SECTION: * DocExamples/trussrw */ #pragma D option quiet syscall::read:entry, syscall::write:entry /pid == 100551/ { printf("%s(%d, 0x%x, %4d)", probefunc, arg0, arg1, arg2); } syscall::read:return, syscall::write:return /pid == 100551/ { printf("\t\t = %d\n", arg1); } #!/usr/sbin/dtrace -s /* * 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. */ /* * ASSERTION: * Verifying doc example 21-1 * * SECTION: * DocExamples/userfunc * */ pid$1::$2:entry { self->trace = 1; } pid$1::$2:return /self->trace/ { self->trace = 0; } pid$1:::entry, pid$1:::return /self->trace/ { } /* * 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. */ #pragma D option quiet #pragma D option strsize=1024 #pragma D option aggsize=512 BEGIN { @["Harding"] = count(); @["Hoover"] = count(); @["Nixon"] = count(); @["Bush"] = count(); } BEGIN { exit(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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ BEGIN { trace(*(int *)NULL); } ERROR { trace(*(int *)NULL); } BEGIN { exit(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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #pragma D option strsize=1024 #pragma D option dynvarsize=512 BEGIN { a["Harding"] = 1; a["Hoover"] = 1; a["Nixon"] = 1; a["Bush"] = 1; } BEGIN { exit(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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #pragma D option strsize=1024 #pragma D option bufsize=512 BEGIN { trace("Harding"); trace("Hoover"); trace("Nixon"); trace("Bush"); } BEGIN { exit(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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #pragma D option strsize=1024 #pragma D option bufsize=512 BEGIN { exit(0); } END { trace("Harding"); trace("Hoover"); trace("Nixon"); trace("Bush"); } /* * 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. */ #pragma D option nspec=1 #pragma D option specsize=32 #pragma D option strsize=512 BEGIN { spec = speculation(); speculate(spec); trace("The, SystemTap, The."); } BEGIN { commit(spec); } BEGIN { exit(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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #pragma D option nspec=1 BEGIN, BEGIN, BEGIN, BEGIN { spec = speculation(); } BEGIN { exit(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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * Copyright (c) 2012 by Delphix. All rights reserved. */ #pragma D option destructive #pragma D option jstackstrsize=1 #pragma D option quiet BEGIN { /* * Since some java versions are erroneously compiled with -xlazyload * and therefore don't activate their ustack() helper by default, we * use the DTrace helper audit library to activate it. */ system("LD_AUDIT_32=/usr/lib/dtrace/libdtrace_forceload.so %s", "java -version"); } syscall:::entry { @[jstack()] = count(); } proc:::exit /progenyof($pid) && execname == "java"/ { exit(0); } END { printa("\r", @); printf("\n"); } /* * 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. */ /* * ASSERTION: An invalid probe description throws a D_PDESC_ZERO error. * * SECTION: Errtags/D_PDESC_ZERO * */ #pragma D option quiet fbt:bippity:boppity:boo { exit(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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* Assertion: * Use the -V option to printout API version. * * SECTION: * dtrace Utility/-V Option * * NOTES: * Use /usr/sbin/dtrace -V on command line. */ /* * 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. */ /* * ASSERTION: * The -I option can be used to search path for #include files when used * in conjunction with the -C option. The specified directory is inserted into * the search path adhead of the default directory list. * * SECTION: dtrace Utility/-C Option; * dtrace Utility/-I Option * * NOTES: * Create a file and define the variable VALUE in it. Move it a * directory different from the current directory. Change the value * of appropriately in the code below. * Invoke: dtrace -C -I -s man.AddSearchPath.d * Verify VALUE. */ #pragma D option quiet #include "filename" BEGIN { printf("Value of VALUE: %d\n", VALUE); exit(0); } #!/bin/ksh -p /* * 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. */ /* * * ASSERTION: * Testing -F option with several probes. * * SECTION: dtrace Utility/-F Option * * NOTES: Manually verify using: * "/usr/sbin/dtrace -F -s man.CoalesceTrace.d" on command line. * * Verify that the for the indent characters are -> <- for non-syscall * entry/return pairs (e.g. fbt ones) and => <= for syscall ones and * | for profile ones. * */ BEGIN { i = 0; j = 0; k = 0; } syscall::read: { printf("syscall: %d\n", i++); } fbt:genunix:read: { printf("fbt: %d\n", j++); } profile:::tick-10sec { printf("profile: %d\n", k++); } /* * 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. */ /* * ASSERTION: * Using -G option with dtrace utility produces an ELF file containing a * DTrace program. If the filename used with the -s option does ends * with .d, and the -o option is not used, then the output ELF file is * in filename.o * * SECTION: dtrace Utility/-G Option * * NOTES: Use this file as * /usr/sbin/dtrace -G -s man.ELFGeneration.d * Delete the file man.ELFGeneration.d.o * */ BEGIN { printf("This test should compile.\n"); exit(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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * ASSERTION: * Using the -CH option with dtrace invocation displays the list of * pathnames of included files one per line to the stderr. * * SECTION: dtrace Utility/-C Option; * dtrace Utility/-H Option * * NOTES: Use this file as * /usr/sbin/dtrace -qCH -s man.IncludedFilePath.d * */ #include "stdio.h" BEGIN { printf("This test should compile.\n"); exit(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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * ASSERTION: * Using -l option with -f option. * * SECTION: dtrace Utility/-l Option; * dtrace Utility/-f Option * * NOTES: Manually check: * * 1) * /usr/sbin/dtrace -lf profile * RESULT: Silent output without any probes listed. * * 2) * /usr/sbin/dtrace -lf genunix * RESULT: Silent output without any probes listed. * * 3) * /usr/sbin/dtrace -lf read * RESULT: matching list of probes with function read. * * 4) * /usr/sbin/dtrace -lf genunix:read * RESULT: matching list of probes with module genunix and * function read. * * 5) * /usr/sbin/dtrace -lf sysinfo:genunix:read * RESULT: matching list of probes with provider sysinfo, module * genunix and function read. * * 6) * /usr/sbin/dtrace -lf :genunix:: * RESULT: Silent output without any probes listed. * * 7) * /usr/sbin/dtrace -lf ::read: * RESULT: Silent output without any probes listed. * * 8) * /usr/sbin/dtrace -lf profile:::profile-97 * RESULT: not a valid probe description. * * 9) * /usr/sbin/dtrace -lf read -lf write * RESULT: matching list of both read and write probes. * * 10) * /usr/sbin/dtrace -lf read -lm fight * RESULT: List of only read probes. * * 11) * /usr/sbin/dtrace -lf fight -lf write * RESULT: List of only write probes. * * 12) Has been automated. * /usr/sbin/dtrace -lf fbt:des:des3_crunch_block:return * RESULT: not a valid probe description. * * 13) * /usr/sbin/dtrace -lf read'{printf("FOUND");}' * RESULT: Silent output without any probes listed. * * 14) * /usr/sbin/dtrace -lf read '{printf("FOUND");}' * RESULT: List of only read probes. * * 15) * /usr/sbin/dtrace -lf read'/probename == "entry"/{printf("FOUND");}' * RESULT: Silent output without any probes listed. */ /* * 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. */ /* * ASSERTION: * Using -l option with -i option. * * SECTION: dtrace Utility/-l Option; * dtrace Utility/-i Option * * NOTES: Manually check: * * 1) * /usr/sbin/dtrace -l * RESULT: List of all available probes. * * 2) * /usr/sbin/dtrace -li 0 * RESULT: invalid probe identifier 0. * * 3) automated in tst.InvalidId1.d.ksh * /usr/sbin/dtrace -li -3 * RESULT: not a valid id range * * 4) * /usr/sbin/dtrace -li 0-2 * RESULT: List of probes including 1 and 2 or error. * * 5) automated in tst.InvalidId2.d.ksh * /usr/sbin/dtrace -li 4-2 * RESULT: not a valid id range * * 6) automated in tst.InvalidId3.d.ksh * /usr/sbin/dtrace -li 2-2 * RESULT: not a valid id range * * 7) * /usr/sbin/dtrace -li 1 2 3 4 * RESULT: only the first probe id is listed and other extraneous * charaters are not considered. * * 8) * /usr/sbin/dtrace -li 0 - 2 * RESULT: only the first probe id is listed and other extraneous * charaters are not considered. * * 9) * /usr/sbin/dtrace -li 1 -li 2-4 -li 4 -li 5 * RESULT: Probe descriptions listed for all ids specified. Once * for each specification on the command line. * */ /* * 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. */ /* * ASSERTION: * Using -l option with -m option. * * SECTION: dtrace Utility/-l Option; * dtrace Utility/-m Option * * NOTES: Manually check: * * 1) * /usr/sbin/dtrace -lm profile * RESULT: Silent output without any probes listed. * * 2) * /usr/sbin/dtrace -lm genunix * RESULT: matching list of probes with module name genunix. * * 3) * /usr/sbin/dtrace -lm vtrace:genunix * RESULT: matching list of probes with provider vtrace and module * genunix. * * 4) automated in tst.InvalidModule1.d.ksh * /usr/sbin/dtrace -lm :genunix:: * RESULT: not a valid probe description * * 5) automated in tst.InvalidModule2.d.ksh * /usr/sbin/dtrace -lm profile:::profile-97 * RESULT: not a valid probe description. * * 6) * /usr/sbin/dtrace -lm genunix -lm unix * RESULT: matching list of both genunix and unix probes. * * 7) * /usr/sbin/dtrace -lm genunix -lm foounix * RESULT: List of only genunix probes. * * 8) * /usr/sbin/dtrace -lm foounix -lm unix * RESULT: List of only unix probes. * * 9) automated in tst.InvalidModule3.d.ksh * /usr/sbin/dtrace -lm fbt:des:des3_crunch_block:return * RESULT: not a valid probe description. * * 10) * /usr/sbin/dtrace -lm fbt:genunix'{printf("FOUND");}' * RESULT: Silent output without any probes listed. * * 11) * /usr/sbin/dtrace -lm genunix'{printf("FOUND");}' * RESULT: Silent output without any probes listed. * * 12) * /usr/sbin/dtrace -lm unix '{printf("FOUND");}' * RESULT: List of only unix probes. * * 13) automated in tst.InvalidModule4.d.ksh * /usr/sbin/dtrace -lm * unix'/probefunc == "preempt"/{printf("FOUND");}' * RESULT: not a valid probe description. */ /* * 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. */ /* * ASSERTION: * Using -l option with -n option. * * SECTION: dtrace Utility/-l Option; * dtrace Utility/-n Option * * NOTES: Manually check: * * 1) * /usr/sbin/dtrace -ln profile * RESULT: Silent output without any probes listed. * * 2) * /usr/sbin/dtrace -ln genunix * RESULT: Silent output without any probes listed. * * 3) * /usr/sbin/dtrace -ln read * RESULT: Silent output without any probes listed. * * 4) * /usr/sbin/dtrace -ln BEGIN * RESULT: list of one probe with name BEGIN. * * 5) * /usr/sbin/dtrace -ln begin * RESULT: Silent output without any probes listed. * * 6) * /usr/sbin/dtrace -ln genunix:read * RESULT: Silent output without any probes listed. * * 7) * /usr/sbin/dtrace -ln genunix:read: * RESULT: matching list of probes with module genunix and * function read. * * 8) * /usr/sbin/dtrace -ln sysinfo:genunix:read * RESULT: Silent output without any probes listed. * * 9) * /usr/sbin/dtrace -ln sysinfo:genunix:read: * RESULT: matching list of probes with provider sysinfo, module * genunix and function read. * * 10) /usr/sbin/dtrace -ln :genunix:: * RESULT: matching list of probes with module genunix * * 11) * /usr/sbin/dtrace -ln :genunix: * RESULT: Silent output without any probes listed. * * 12) * /usr/sbin/dtrace -ln ::read: * RESULT: matching list of probes with and function read. * * 13) * /usr/sbin/dtrace -ln profile:::profile-97 * RESULT: matching list of probes with provider profile and function * profile-97 * * 14) * /usr/sbin/dtrace -ln read: -ln write: * RESULT: matching list of both read and write probes. * * 15) * /usr/sbin/dtrace -ln read: -ln fight: * RESULT: List of only read probes. * * 16) * /usr/sbin/dtrace -ln fight: -ln write: * RESULT: List of only write probes. * * 17) * /usr/sbin/dtrace -ln fbt:des:des3_crunch_block:return * RESULT: Silent output of only the header. * * 18) * /usr/sbin/dtrace -ln read:'{printf("FOUND");}' * RESULT: Silent output without any probes listed. * * 19) * /usr/sbin/dtrace -ln read:entry'{printf("FOUND");}' * RESULT: Silent output without any probes listed. * * 20) * /usr/sbin/dtrace -ln BEGIN'{Printf("FOUND");}' * RESULT: Silent output without any probes listed. * * 21) * /usr/sbin/dtrace -ln BEGIN '{printf("FOUND");}' * RESULT: List of only BEGIN probe. * * 22) * /usr/sbin/dtrace -ln * BEGIN'/probename == "entry"/{printf("FOUND");}' * RESULT: Silent output without any probes listed. */ /* * 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. */ /* * ASSERTION: * Using -l option with -P option. * * SECTION: dtrace Utility/-l Option; * dtrace Utility/-P Option * * NOTES: Manually check: * * 1) * /usr/sbin/dtrace -lP profile * RESULT: List of only profile probes. * * 2) * /usr/sbin/dtrace -lP foofile * RESULT: Silent output without any probes listed. * * 3) automated in tst.InvalidProvider2.d.ksh * /usr/sbin/dtrace -lP profile::: * RESULT: not a valid probe description * * 4) automated in tst.InvalidProvider1.d.ksh * /usr/sbin/dtrace -lP profile:::profile-97 * RESULT: not a valid probe description. * * 5) * /usr/sbin/dtrace -lP profile -lP syscall * RESULT: matching list of both profile and syscall probes. * * 6) * /usr/sbin/dtrace -lP profile -lP foofile * RESULT: List of only profile probes. * * 7) * /usr/sbin/dtrace -lP foofile -lP profile * RESULT: List of only profile probes. * * 8) authomated in tst.InvalidProvider3.d.ksh * /usr/sbin/dtrace -lP fbt:des:des3_crunch_block:return * RESULT: not a valid probe description. * * 9) * /usr/sbin/dtrace -lP profile'{printf("FOUND");}' * RESULT: Silent output without any probes listed. * * 10) * /usr/sbin/dtrace -lP profile '{printf("FOUND");}' * RESULT: List of only profile probes. * * 11) automated in tst.InvalidProvider4.d.ksh * /usr/sbin/dtrace -lP * profile'/probename == "profile-199"/{printf("FOUND");}' * RESULT: not a valid probe description. */ /* * 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. */ /* * ASSERTION: * Using -S option with dtrace utility shows the intermediate compiler code. * * SECTION: dtrace Utility/-S Option * * NOTES: Use this file as * /usr/sbin/dtrace -qSs man.ShowCompilerCode.d * */ BEGIN { printf("This test should compile %d\n", 1); exit(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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * ASSERTION: * Using -f option. * * SECTION: dtrace Utility/-f Option * * NOTES: Manually check: * * 1) automated in tst.InvalidTraceFunc1.d.ksh * /usr/sbin/dtrace -f profile * RESULT: invalid probe specifier * * 2) automated in tst.InvalidTraceFunc2.d.ksh * /usr/sbin/dtrace -f genunix * RESULT: invalid probe specifier * * 3) * /usr/sbin/dtrace -f read * RESULT: tracing of matching list of probes with function read. * * 4) automated in tst.InvalidTraceFunc3.d.ksh * /usr/sbin/dtrace -f read: * RESULT: invalid probe specifier * * 5) * /usr/sbin/dtrace -f ::read * RESULT: tracing of matching list of probes with function read. * * 6) automated in tst.InvalidTraceFunc4.d.ksh * /usr/sbin/dtrace -f ::read: * RESULT: invalid probe specifier * * 7) * /usr/sbin/dtrace -f genunix:read * RESULT: tracing of probes with module genunix and function read. * * 8) * /usr/sbin/dtrace -f sysinfo:genunix:read * RESULT: tracing of probes with provider sysinfo, module genunix * and function read. * * 9) * /usr/sbin/dtrace -f sysinfo::read * RESULT: tracing of probes with provider sysinfo and function read. * * 10) automated in tst.InvalidTraceFunc5.d.ksh * /usr/sbin/dtrace -f :genunix:: * RESULT: invalid probe specifier * * 11) automated in tst.InvalidTraceFunc6.d.ksh * /usr/sbin/dtrace -f profile:::profile-97 * RESULT: invalid probe specifier. * * 12) * /usr/sbin/dtrace -f read -f write * RESULT: tracing of both read and write probes. * * 13) * /usr/sbin/dtrace -f read -f fight * RESULT: Count of matching read probes and invalid probe specifier * for fight * * 14) automated in tst.InvalidTraceFunc8.d.ksh * /usr/sbin/dtrace -f fight -f write * RESULT: invalid probe specifier. * * 15) automated in tst.InvalidTraceFunc7.d.ksh * /usr/sbin/dtrace -f fbt:des:des3_crunch_block:return * RESULT: invalid probe specifier. * * 16) * /usr/sbin/dtrace -f read'{printf("FOUND");}' * RESULT: tracing of probes with function read and with message FOUND * * 17) * /usr/sbin/dtrace -f ::read'{printf("FOUND");}' * RESULT: tracing of probes with function read and with message FOUND * * 18) automated in tst.InvalidTraceFunc9.d.ksh * /usr/sbin/dtrace -f read '{printf("FOUND");}' * RESULT: invalid probe specifier. * * 19) * /usr/sbin/dtrace -f read'/probename == "entry"/{printf("FOUND");}' * RESULT: tracing of probes with function read, name entry and with * message FOUND */ /* * 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. */ /* * ASSERTION: * Using -l option with -i option. * * SECTION: dtrace Utility/-l Option; * dtrace Utility/-i Option * * NOTES: Manually check: * * 1) automated in tst.InvalidTraceID1.d.ksh * /usr/sbin/dtrace -i 0 * RESULT: invalid probe specifier. * * 2) automated in tst.InvalidTraceID2.d.ksh * /usr/sbin/dtrace -i -3 * RESULT: not a valid id range * * 3) automated in tst.InvalidTraceID3.d.ksh * /usr/sbin/dtrace -i 0-2 * RESULT: not a valid id range * * 4) automated in tst.InvalidTraceID4.d.ksh * /usr/sbin/dtrace -i 4-2 * RESULT: not a valid id range * * 5) automated in tst.InvalidTraceID5.d.ksh * /usr/sbin/dtrace -i 2-2 * RESULT: not a valid id range * * 6) automated in tst.InvalidTraceID6.d.ksh * /usr/sbin/dtrace -i 1 2 3 4 * RESULT: invalid probe specifier. * * 7) automated in tst.InvalidTraceID7.d.ksh * /usr/sbin/dtrace -i 0 - 2 * RESULT: invalid probe specifier. * * 8) * /usr/sbin/dtrace -i 1 -i 2-4 -i 4 -i 5 * RESULT: Only the BEGIN probe is traced and the others are not. * */ /* * 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. */ /* * ASSERTION: * Tracing a module using the -m option. * * SECTION: dtrace Utility/-m Option * * NOTES: Manually check: * * 1) automated in tst.InvalidTraceModule1.d.ksh * /usr/sbin/dtrace -m profile * RESULT: invalid probe specifier * * 2) * /usr/sbin/dtrace -m genunix * RESULT: trace of all probes with module genunix. * * 3) * /usr/sbin/dtrace -m vtrace:genunix * RESULT: trace of probes with provider vtrace and module genunix. * * 4) automated in tst.InvalidTraceModule2.d.ksh * /usr/sbin/dtrace -m :genunix:: * RESULT: invalid probe specifier * * 5) * /usr/sbin/dtrace -m :genunix * RESULT: trace of all probes with module genunix. * * 6) automated in tst.InvalidTraceModule3.d.ksh * /usr/sbin/dtrace -m genunix:: * RESULT: invalid probe specifier * * 7) automated in tst.InvalidTraceModule4.d.ksh * /usr/sbin/dtrace -m profile:::profile-97 * RESULT: not a valid probe description. * * 8) * /usr/sbin/dtrace -m genunix -m unix * RESULT: tracing of both genunix and unix probes. * * 9) * /usr/sbin/dtrace -m genunix -m foounix * RESULT: Number of probes matching the description genunix * and an invalid probe specifier for foounix. * * 10) automated in tst.InvalidTraceModule5.d.ksh * /usr/sbin/dtrace -m foounix -m unix * RESULT: invalid probe specifier for foounix. * * 11) automated in tst.InvalidTraceModule6.d.ksh * /usr/sbin/dtrace -m fbt:des:des3_crunch_block:return * RESULT: invalid probe description. * * 12) * /usr/sbin/dtrace -m fbt:genunix'{printf("FOUND");}' * RESULT: tracing of all the probes matching provider fbt and module * genunix. * * 13) * /usr/sbin/dtrace -m genunix'{printf("FOUND");}' * RESULT: tracing of all the probes matching module genunix with * message FOUND * * 14) * /usr/sbin/dtrace -m :genunix'{printf("FOUND");}' * RESULT: tracing of all the probes matching module genunix with * message FOUND * * 15) automated in tst.InvalidTraceModule7.d.ksh * /usr/sbin/dtrace -m genunix::'{printf("FOUND");}' * RESULT: invalid probe specifier. * * 16) automated in tst.InvalidTraceModule8.d.ksh * /usr/sbin/dtrace -m genunix:'{printf("FOUND");}' * RESULT: invalid probe specifier. * * 17) * /usr/sbin/dtrace -m unix '{printf("FOUND");}' * RESULT: invalid probe specifier. * * 18) * /usr/sbin/dtrace -m * unix'/probefunc == "preempt"/{printf("FOUND");}' * RESULT: tracing of all the probes matching module genunix, * probe function preempt with message FOUND. */ /* * 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. */ /* * ASSERTION: * Using -n option. * * SECTION: dtrace Utility/-n Option * * NOTES: Manually check: * * 1) automated in tst.InvalidTraceName1.d.ksh * /usr/sbin/dtrace -n profile * RESULT: invalid probe specifier * * 2) automated in tst.InvalidTraceName2.d.ksh * /usr/sbin/dtrace -n genunix * RESULT: invalid probe specifier * * 3) automated in tst.InvalidTraceName3.d.ksh * /usr/sbin/dtrace -n read * RESULT: invalid probe specifier * * 4) * /usr/sbin/dtrace -n BEGIN * RESULT: trace of one probe with name BEGIN. * * 5) automated in tst.InvalidTraceName4.d.ksh * /usr/sbin/dtrace -n begin * RESULT: invalid probe specifier * * 6) automated in tst.InvalidTraceName5.d.ksh * /usr/sbin/dtrace -n genunix:read * RESULT: invalid probe specifier * * 7) * /usr/sbin/dtrace -n genunix:read: * RESULT: trace of probes with module genunix and function read. * * 8) automated in tst.InvalidTraceName6.d.ksh * /usr/sbin/dtrace -n sysinfo:genunix:read * RESULT: invalid probe specifier * * 9) * /usr/sbin/dtrace -n sysinfo:genunix:read: * RESULT: tracing of probes with provider sysinfo, module genunix * and function read. * * 10) * /usr/sbin/dtrace -n :genunix:: * RESULT: tracing of probes with module genunix * * 11) automated in tst.InvalidTraceName7.d.ksh * /usr/sbin/dtrace -n :genunix: * RESULT: invalid probe specifier * * 12) * /usr/sbin/dtrace -n ::read: * RESULT: tracing of probes with function read. * * 13) * /usr/sbin/dtrace -n profile:::profile-97 * RESULT: tracing of probes with provider profile and name * profile-97 * * 14) * /usr/sbin/dtrace -n read: -n write: * RESULT: tracing of both read and write probes. * * 15) * /usr/sbin/dtrace -n read: -n fight: * RESULT: Count of mathching read probes and invalid probe specifier * for fight: * * 16) automated in tst.InvalidTraceName8.d.ksh * /usr/sbin/dtrace -n fight: -n write: * RESULT: invalid probe specifier * * 17) * /usr/sbin/dtrace -n fbt:des:des3_crunch_block:return * RESULT: trace of the specified probe. * * 18) * /usr/sbin/dtrace -n read:'{printf("FOUND");}' * RESULT: Trace of all the probes with module read and a message * saying FOUND. * * 19) * /usr/sbin/dtrace -n read:entry'{printf("FOUND");}' * RESULT: Trace of all the probes with module read, name entry.Output * of a message saying FOUND. * * 20) * /usr/sbin/dtrace -n BEGIN'{printf("FOUND");}' * RESULT: Trace of the BEGIN probe with the message FOUND. * * 21) automated in tst.InvalidTraceName9.d.ksh * /usr/sbin/dtrace -n BEGIN '{printf("FOUND");}' * RESULT: invalid probe specifier * * 22) * /usr/sbin/dtrace -n BEGIN'/probename == "entry"/{printf("FOUND");}' * RESULT: Tracing of BEGIN function but no message FOUND. */ /* * 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. */ /* * ASSERTION: * Using -P option to trace all the probes provided by the particular * provider. * * SECTION: dtrace Utility/-P Option * * NOTES: Manually check: * * 1) * /usr/sbin/dtrace -P profile * RESULT: Trace of all profile probes. * * 2) automated in tst.InvalidTraceProvider1.d.ksh * /usr/sbin/dtrace -P foofile * RESULT: invalid probe specifier * * 3) automated in tst.InvalidTraceProvider2.d.ksh * /usr/sbin/dtrace -P profile::: * RESULT: invalid probe specifier * * 4) automated in tst.InvalidTraceProvider3.d.ksh * /usr/sbin/dtrace -P profile:::profile-97 * RESULT: invalid probe specifier * * 5) * /usr/sbin/dtrace -P profile -P syscall * RESULT: matching traces of both profile and syscall probes. * * 6) * /usr/sbin/dtrace -P profile -P foofile * RESULT: Count of profile probes that matched and invalid * probe specifier for foofile and no tracing. * * 7) automated in tst.InvalidTraceProvider4.d.ksh * /usr/sbin/dtrace -P fbt:des:des3_crunch_block:return * RESULT: invalid probe specifier * * 8) * /usr/sbin/dtrace -P profile'{printf("FOUND");}' * RESULT: Traces of all the matching profile probes with the * FOUND message. * * 9) automated in tst.InvalidTraceProvider5.d.ksh * /usr/sbin/dtrace -P profile '{printf("FOUND");}' * RESULT: invalid probe specifier * * 10) * /usr/sbin/dtrace -P * profile'/probename == "profile-199"/{printf("FOUND");}' * RESULT: Traces of the matching profile probe with the * FOUND message. * * */ /* * 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. */ /* * ASSERTION: * Using -v option with dtrace utility produces a program stability report * showing the minimum interface stability and dependency level for * the specified D programs. * * SECTION: dtrace Utility/-s Option; * dtrace Utility/-v Option * * NOTES: Use this file as * /usr/sbin/dtrace -vs man.VerboseStabilityReport.d * */ BEGIN { printf("This test should compile: %d\n", 2); exit(0); } #!/bin/ksh -p # # 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. # #ident "%Z%%M% %I% %E% SMI" ## # # ASSERTION: # The -I option can be used to search path for #include files when used # in conjunction with the -C option. The specified directory is inserted into # the search path adhead of the default directory list. # # SECTION: dtrace Utility/-C Option # SECTION: dtrace Utility/-I Option # ## script() { $dtrace -C -I /tmp -s /dev/stdin <' exit 2 fi tempfile=/tmp/test.h echo "#define VALUE 1520" > $tempfile dtrace=$1 script status=$? if [ "$status" -ne 0 ]; then echo $tst: dtrace failed exit $status fi /bin/rm -f $tempfile exit 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" # # ASSERTION: # The trace buffer size can include any of the size suffixes k, m, g or t # # SECTION: dtrace Utility/-b Option # if [ $# != 1 ]; then echo expected one argument: '<'dtrace-path'>' exit 2 fi dtrace=$1 $dtrace -b 1g -b 2g -e exit $? # # 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" # # ASSERTION: # The trace buffer size can include any of the size suffixes k, m, g or t # # SECTION: dtrace Utility/-b Option # if [ $# != 1 ]; then echo expected one argument: '<'dtrace-path'>' exit 2 fi dtrace=$1 $dtrace -b 1k -b 2k -e exit $? # # 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" # # ASSERTION: # The trace buffer size can include any of the size suffixes k, m, g or t # # SECTION: dtrace Utility/-b Option # if [ $# != 1 ]; then echo expected one argument: '<'dtrace-path'>' exit 2 fi dtrace=$1 $dtrace -b 1m -b 2m -e exit $? # # 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" # # ASSERTION: # The trace buffer size can include any of the size suffixes k, m, g or t # # SECTION: dtrace Utility/-b Option # if [ $# != 1 ]; then echo expected one argument: '<'dtrace-path'>' exit 2 fi dtrace=$1 $dtrace -b 1t -b 2t -e exit $? #!/bin/ksh -p # # 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. # #ident "%Z%%M% %I% %E% SMI" ## # # ASSERTION: # If the -32 option is specified, dtrace will force the D compiler to # compile a program using the 32-bit data model. # # SECTION: dtrace Utility/-32 Option # ## script() { $dtrace -32 -s /dev/stdin <' exit 2 fi dtrace=$1 script status=$? if [ "$status" -ne 0 ]; then echo $tst: dtrace failed fi exit $status #!/bin/ksh # # 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. # #ident "%Z%%M% %I% %E% SMI" ## # # ASSERTION: # If the -64 option is specified, dtrace will force the D compiler to # compile a program using the 64-bit data model. # # SECTION: dtrace Utility/-64 Option # ## script() { $dtrace -64 -s /dev/stdin <' exit 2 fi dtrace=$1 script status=$? if [ "$status" -ne 0 ]; then echo $tst: dtrace failed fi exit $status #!/bin/ksh -p # # 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. # #ident "%Z%%M% %I% %E% SMI" ## # # ASSERTION: # The -D option can be used to define a name when used in conjunction # with the -C option. # # SECTION: dtrace Utility/-C Option; # dtrace Utility/-D Option # ## script() { $dtrace -C -D VALUE=40 -s /dev/stdin <' exit 2 fi dtrace=$1 script status=$? if [ "$status" -ne 0 ]; then echo $tst: dtrace failed fi exit $status Value of VALUE: 40 #!/bin/ksh -p # # 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. # #ident "%Z%%M% %I% %E% SMI" ## # # ASSERTION: # The -w option can be used to permit destructive actions in D programs. # # SECTION: dtrace Utility/-w Option; # dtrace Utility/-f Option # ## if [ $# != 1 ]; then echo expected one argument: '<'dtrace-path'>' exit 2 fi dtrace=$1 $dtrace -qwf read'{chill(15); printf("Done chilling"); exit(0);}' status=$? if [ "$status" -ne 0 ]; then echo $tst: dtrace failed fi exit $status Done chilling #!/bin/ksh -p # # 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. # #ident "%Z%%M% %I% %E% SMI" ## # # ASSERTION: # The -w option can be used to permit destructive actions in D programs. # # SECTION: dtrace Utility/-w Option; # dtrace Utility/-i Option # ## if [ $# != 1 ]; then echo expected one argument: '<'dtrace-path'>' exit 2 fi dtrace=$1 $dtrace -qwi 1'{chill(15); printf("Done chilling"); exit(0);}' status=$? if [ "$status" -ne 0 ]; then echo $tst: dtrace failed fi exit $status Done chilling #!/bin/ksh -p # # 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. # #ident "%Z%%M% %I% %E% SMI" ## # # ASSERTION: # The -w option can be used to permit destructive actions in D programs. # # SECTION: dtrace Utility/-w Option; # dtrace Utility/-m Option # ## if [ $# != 1 ]; then echo expected one argument: '<'dtrace-path'>' exit 2 fi dtrace=$1 $dtrace -qwm unix'{chill(15); printf("Done chilling"); exit(0);}' status=$? if [ "$status" -ne 0 ]; then echo $tst: dtrace failed fi exit $status Done chilling #!/bin/ksh -p # # 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. # #ident "%Z%%M% %I% %E% SMI" ## # # ASSERTION: # The -w option can be used to permit destructive actions in D programs. # # SECTION: dtrace Utility/-w Option; # dtrace Utility/-n Option # ## if [ $# != 1 ]; then echo expected one argument: '<'dtrace-path'>' exit 2 fi dtrace=$1 $dtrace -qwn BEGIN'{chill(15); printf("Done chilling"); exit(0);}' status=$? if [ "$status" -ne 0 ]; then echo $tst: dtrace failed fi exit $status Done chilling #!/bin/ksh -p # # 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. # #ident "%Z%%M% %I% %E% SMI" ## # # ASSERTION: # The -w option can be used to permit destructive actions in D programs. # # SECTION: dtrace Utility/-w Option; # dtrace Utility/-P Option # ## if [ $# != 1 ]; then echo expected one argument: '<'dtrace-path'>' exit 2 fi dtrace=$1 $dtrace -qwP syscall'{chill(15); printf("Done chilling"); exit(0);}' status=$? if [ "$status" -ne 0 ]; then echo $tst: dtrace failed fi exit $status Done chilling #!/bin/ksh -p # # 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. # #ident "%Z%%M% %I% %E% SMI" ## # # ASSERTION: # Destructive actions will not compile or are not enabled without the # -w option in D programs. # # SECTION: dtrace Utility/-w Option # ## if [ $# != 1 ]; then echo expected one argument: '<'dtrace-path'>' exit 2 fi dtrace=$1 $dtrace -qP syscall'{chill(15); printf("Done chilling"); exit(0);}' status=$? if [ "$status" -ne 0 ]; then exit 0 fi echo $tst: dtrace failed exit $status #!/bin/ksh -p # # 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. # #ident "%Z%%M% %I% %E% SMI" ## # # ASSERTION: # Using -G option with dtrace utility produces an ELF file containing a # DTrace program. If the filename used with the -s option does not end # with .d, and the -o option is not used, then the output ELF file is # in d.out. # # SECTION: dtrace Utility/-G Option # ## script() { $dtrace -G -s /dev/stdin <' exit 2 fi dtrace=$1 script status=$? if [ "$status" -ne 0 ]; then echo $tst: dtrace failed exit $status fi if [ ! -a "d.out" ]; then echo $tst: file not generated exit 1 fi /bin/rm -f "d.out" exit 0 #!/bin/ksh -p # # 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. # #ident "%Z%%M% %I% %E% SMI" ## # # ASSERTION: # Using -G option with dtrace utility produces an ELF file containing a # DTrace program. The output file can be named as required using the # -o option in conjunction with the -G option. # # SECTION: dtrace Utility/-G Option; # dtrace Utility/-o Option # ## script() { $dtrace -G -o outputFile -s /dev/stdin <' exit 2 fi dtrace=$1 script status=$? if [ "$status" -ne 0 ]; then echo $tst: dtrace failed exit $status fi if [ ! -a "outputFile" ]; then echo $tst: file not generated exit 1 fi /bin/rm -f "outputFile" exit 0 #!/bin/ksh -p # # 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. # #ident "%Z%%M% %I% %E% SMI" ## # # ASSERTION: # When a fatal error occurs such that the program compilation fails or the # specified request cannot be satisfied, an exit status of 1 is returned. # # # SECTION: dtrace Utility/Exit Status # ## if [ $# != 1 ]; then echo expected one argument: '<'dtrace-path'>' exit 2 fi dtrace=$1 $dtrace -s wassup status=$? if [ "$status" -ne 1 ]; then echo $tst: dtrace failed exit 1 fi exit 0 #!/bin/ksh -p # # 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. # #ident "%Z%%M% %I% %E% SMI" ## # # ASSERTION: # When invalid command line options or arguments are specified an exit status # of 2 is returned. # # SECTION: dtrace Utility/Exit Status # ## if [ $# != 1 ]; then echo expected one argument: '<'dtrace-path'>' exit 2 fi dtrace=$1 $dtrace -9 status=$? if [ "$status" -ne 2 ]; then echo $tst: dtrace failed exit 1 fi exit 0 #!/bin/ksh -p # # 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. # #ident "%Z%%M% %I% %E% SMI" ## # # ASSERTION: # Testing -i option with extraneous probe identifiers. # # SECTION: dtrace Utility/-i Option # ## if [ $# != 1 ]; then echo expected one argument: '<'dtrace-path'>' exit 2 fi dtrace=$1 $dtrace -i 12 10 -i 23 if [ $? -ne 1 ]; then echo $tst: dtrace failed exit 1 fi exit 0 #!/bin/ksh -p # # 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. # #ident "%Z%%M% %I% %E% SMI" ## # # ASSERTION: # Testing -f option with an invalid function name. # # SECTION: dtrace Utility/-f Option # ## if [ $# != 1 ]; then echo expected one argument: '<'dtrace-path'>' exit 2 fi dtrace=$1 $dtrace -f BEGIN if [ $? -ne 1 ]; then echo $tst: dtrace failed exit 1 fi exit 0 #!/bin/ksh -p # # 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. # #ident "%Z%%M% %I% %E% SMI" ## # # ASSERTION: # Testing -f option with an invalid function name. # # SECTION: dtrace Utility/-f Option # ## if [ $# != 1 ]; then echo expected one argument: '<'dtrace-path'>' exit 2 fi dtrace=$1 $dtrace -f 4.56 if [ $? -ne 1 ]; then echo $tst: dtrace failed exit 1 fi exit 0 #!/bin/ksh -p # # 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. # #ident "%Z%%M% %I% %E% SMI" ## # # ASSERTION: # The -li option can be used to list the probes from their ids. An id of # negative integer is invalid # # SECTION: dtrace Utility/-l Option; # dtrace Utility/-i Option # ## if [ $# != 1 ]; then echo expected one argument: '<'dtrace-path'>' exit 2 fi dtrace=$1 $dtrace -li -3 status=$? echo $status if [ "$status" -ne 0 ]; then exit 0 fi echo $tst: dtrace failed exit $status #!/bin/ksh -p # # 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. # #ident "%Z%%M% %I% %E% SMI" ## # # ASSERTION: # The -li option can be used to list the probes from their ids. A # non-increasing range will not list any probes. # # SECTION: dtrace Utility/-l Option; # dtrace Utility/-i Option # ## if [ $# != 1 ]; then echo expected one argument: '<'dtrace-path'>' exit 2 fi dtrace=$1 $dtrace -li 4-2 status=$? echo $status if [ "$status" -ne 0 ]; then exit 0 fi echo $tst: dtrace failed exit $status #!/bin/ksh -p # # 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. # #ident "%Z%%M% %I% %E% SMI" ## # # ASSERTION: # The -li option can be used to list the probes from their ids. A # non-increasing range will not list any probes. # # SECTION: dtrace Utility/-l Option; # dtrace Utility/-i Option # ## if [ $# != 1 ]; then echo expected one argument: '<'dtrace-path'>' exit 2 fi dtrace=$1 $dtrace -li 2-2 status=$? echo $status if [ "$status" -ne 0 ]; then exit 0 fi echo $tst: dtrace failed exit $status #!/bin/ksh -p # # 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. # #ident "%Z%%M% %I% %E% SMI" ## # # ASSERTION: # The -lm option can be used to list the probes from their module names. # Invalid module names result in error. # # SECTION: dtrace Utility/-l Option; # dtrace Utility/-m Option # ## if [ $# != 1 ]; then echo expected one argument: '<'dtrace-path'>' exit 2 fi dtrace=$1 $dtrace -lm :genunix:: status=$? echo $status if [ "$status" -ne 0 ]; then exit 0 fi echo $tst: dtrace failed exit $status #!/bin/ksh -p # # 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. # #ident "%Z%%M% %I% %E% SMI" ## # # ASSERTION: # The -lm option can be used to list the probes from their module names. # Invalid module names result in error. # # SECTION: dtrace Utility/-l Option; # dtrace Utility/-m Option # ## if [ $# != 1 ]; then echo expected one argument: '<'dtrace-path'>' exit 2 fi dtrace=$1 $dtrace -lm profile:::profile-97 status=$? echo $status if [ "$status" -ne 0 ]; then exit 0 fi echo $tst: dtrace failed exit $status #!/bin/ksh -p # # 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. # #ident "%Z%%M% %I% %E% SMI" ## # # ASSERTION: # The -lm option can be used to list the probes from their module names. # Invalid module names result in error. # # SECTION: dtrace Utility/-l Option; # dtrace Utility/-m Option # ## if [ $# != 1 ]; then echo expected one argument: '<'dtrace-path'>' exit 2 fi dtrace=$1 $dtrace -lm fbt:des:des3_crunch_block:return status=$? echo $status if [ "$status" -ne 0 ]; then exit 0 fi echo $tst: dtrace failed exit $status #!/bin/ksh -p # # 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. # #ident "%Z%%M% %I% %E% SMI" ## # # ASSERTION: # The -lm option can be used to list the probes from their module names. # Invalid module names result in error. # # SECTION: dtrace Utility/-l Option; # dtrace Utility/-m Option # ## if [ $# != 1 ]; then echo expected one argument: '<'dtrace-path'>' exit 2 fi dtrace=$1 $dtrace -lm unix'/probefunc == "preempt"/{printf("FOUND");}' status=$? echo $status if [ "$status" -ne 0 ]; then exit 0 fi echo $tst: dtrace failed exit $status #!/bin/ksh -p # # 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. # #ident "%Z%%M% %I% %E% SMI" ## # # ASSERTION: # Testing -i option with invalid probe identifier. # # SECTION: dtrace Utility/-i Option # ## if [ $# != 1 ]; then echo expected one argument: '<'dtrace-path'>' exit 2 fi dtrace=$1 $dtrace -i i23 if [ $? -ne 1 ]; then echo $tst: dtrace failed exit 1 fi exit 0 #!/bin/ksh -p # # 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. # #ident "%Z%%M% %I% %E% SMI" ## # # ASSERTION: # The -lP option can be used to list the probes from their provider names. # Invalid module names result in error. # # SECTION: dtrace Utility/-l Option; # dtrace Utility/-P Option # ## if [ $# != 1 ]; then echo expected one argument: '<'dtrace-path'>' exit 2 fi dtrace=$1 $dtrace -lP profile:::profile-97 status=$? echo $status if [ "$status" -ne 0 ]; then exit 0 fi echo $tst: dtrace failed exit $status #!/bin/ksh -p # # 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. # #ident "%Z%%M% %I% %E% SMI" ## # # ASSERTION: # The -lP option can be used to list the probes from their provider names. # Invalid module names result in error. # # SECTION: dtrace Utility/-l Option; # dtrace Utility/-P Option # ## if [ $# != 1 ]; then echo expected one argument: '<'dtrace-path'>' exit 2 fi dtrace=$1 $dtrace -lP profile::: status=$? echo $status if [ "$status" -ne 0 ]; then exit 0 fi echo $tst: dtrace failed exit $status #!/bin/ksh -p # # 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. # #ident "%Z%%M% %I% %E% SMI" ## # # ASSERTION: # The -lP option can be used to list the probes from their provider names. # Invalid module names result in error. # # SECTION: dtrace Utility/-l Option; # dtrace Utility/-P Option # ## if [ $# != 1 ]; then echo expected one argument: '<'dtrace-path'>' exit 2 fi dtrace=$1 $dtrace -lP fbt:des:des3_crunch_block:return status=$? echo $status if [ "$status" -ne 0 ]; then exit 0 fi echo $tst: dtrace failed exit $status #!/bin/ksh -p # # 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. # #ident "%Z%%M% %I% %E% SMI" ## # # ASSERTION: # The -lP option can be used to list the probes from their provider names. # Invalid module names result in error. # # SECTION: dtrace Utility/-l Option; # dtrace Utility/-P Option # ## if [ $# != 1 ]; then echo expected one argument: '<'dtrace-path'>' exit 2 fi dtrace=$1 $dtrace -lP profile'/probename == "profile-199"/{printf("FOUND");}' status=$? echo $status if [ "$status" -ne 0 ]; then exit 0 fi echo $tst: dtrace failed exit $status #!/bin/ksh -p # # 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. # #ident "%Z%%M% %I% %E% SMI" ## # # ASSERTION: # Testing -f option with an invalid function name. # # SECTION: dtrace Utility/-f Option # ## if [ $# != 1 ]; then echo expected one argument: '<'dtrace-path'>' exit 2 fi dtrace=$1 $dtrace -f profile if [ $? -ne 1 ]; then echo $tst: dtrace failed exit 1 fi exit 0 #!/bin/ksh -p # # 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. # #ident "%Z%%M% %I% %E% SMI" ## # # ASSERTION: # Testing -f option with an invalid function name. # # SECTION: dtrace Utility/-f Option # ## if [ $# != 1 ]; then echo expected one argument: '<'dtrace-path'>' exit 2 fi dtrace=$1 $dtrace -f genunix if [ $? -ne 1 ]; then echo $tst: dtrace failed exit 1 fi exit 0 #!/bin/ksh -p # # 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. # #ident "%Z%%M% %I% %E% SMI" ## # # ASSERTION: # Testing -f option with an invalid function name. # # SECTION: dtrace Utility/-f Option # ## if [ $# != 1 ]; then echo expected one argument: '<'dtrace-path'>' exit 2 fi dtrace=$1 $dtrace -f read: if [ $? -ne 1 ]; then echo $tst: dtrace failed exit 1 fi exit 0 #!/bin/ksh -p # # 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. # #ident "%Z%%M% %I% %E% SMI" ## # # ASSERTION: # Testing -f option with an invalid function name. # # SECTION: dtrace Utility/-f Option # ## if [ $# != 1 ]; then echo expected one argument: '<'dtrace-path'>' exit 2 fi dtrace=$1 $dtrace -f ::read: if [ $? -ne 1 ]; then echo $tst: dtrace failed exit 1 fi exit 0 #!/bin/ksh -p # # 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. # #ident "%Z%%M% %I% %E% SMI" ## # # ASSERTION: # Testing -f option with an invalid function name. # # SECTION: dtrace Utility/-f Option # ## if [ $# != 1 ]; then echo expected one argument: '<'dtrace-path'>' exit 2 fi dtrace=$1 $dtrace -f :genunix:: if [ $? -ne 1 ]; then echo $tst: dtrace failed exit 1 fi exit 0 #!/bin/ksh -p # # 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. # #ident "%Z%%M% %I% %E% SMI" ## # # ASSERTION: # Testing -f option with an invalid function name. # # SECTION: dtrace Utility/-f Option # ## if [ $# != 1 ]; then echo expected one argument: '<'dtrace-path'>' exit 2 fi dtrace=$1 $dtrace -f profile:::profile-97 if [ $? -ne 1 ]; then echo $tst: dtrace failed exit 1 fi exit 0 #!/bin/ksh -p # # 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. # #ident "%Z%%M% %I% %E% SMI" ## # # ASSERTION: # Testing -f option with an invalid function name. # # SECTION: dtrace Utility/-f Option # ## if [ $# != 1 ]; then echo expected one argument: '<'dtrace-path'>' exit 2 fi dtrace=$1 $dtrace -f fbt:des:des3_crunch_block:return if [ $? -ne 1 ]; then echo $tst: dtrace failed exit 1 fi exit 0 #!/bin/ksh -p # # 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. # #ident "%Z%%M% %I% %E% SMI" ## # # ASSERTION: # Testing -f option with an invalid function name. # # SECTION: dtrace Utility/-f Option # ## if [ $# != 1 ]; then echo expected one argument: '<'dtrace-path'>' exit 2 fi dtrace=$1 $dtrace -f fight -f write if [ $? -ne 1 ]; then echo $tst: dtrace failed exit 1 fi exit 0 #!/bin/ksh -p # # 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. # #ident "%Z%%M% %I% %E% SMI" ## # # ASSERTION: # Testing -f option with an invalid function name. # # SECTION: dtrace Utility/-f Option # ## if [ $# != 1 ]; then echo expected one argument: '<'dtrace-path'>' exit 2 fi dtrace=$1 $dtrace -f read '{printf("FOUND");}' if [ $? -ne 1 ]; then echo $tst: dtrace failed exit 1 fi exit 0 #!/bin/ksh -p # # 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. # #ident "%Z%%M% %I% %E% SMI" ## # # ASSERTION: # The -i option can be used to enable the trace of probes from their ids. A # non-increasing range will not list any probes. # # SECTION: dtrace Utility/-i Option # ## if [ $# != 1 ]; then echo expected one argument: '<'dtrace-path'>' exit 2 fi dtrace=$1 $dtrace -i 0 status=$? echo $status if [ "$status" -ne 0 ]; then exit 0 fi echo $tst: dtrace failed exit $status #!/bin/ksh -p # # 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. # #ident "%Z%%M% %I% %E% SMI" ## # # ASSERTION: # The -i option can be used to enable the trace of probes from their ids. A # non-increasing range will not list any probes. # # SECTION: dtrace Utility/-i Option # ## if [ $# != 1 ]; then echo expected one argument: '<'dtrace-path'>' exit 2 fi dtrace=$1 $dtrace -i -3 status=$? echo $status if [ "$status" -ne 0 ]; then exit 0 fi echo $tst: dtrace failed exit $status #!/bin/ksh -p # # 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. # #ident "%Z%%M% %I% %E% SMI" ## # # ASSERTION: # The -i option can be used to enable the trace of probes from their ids. A # non-increasing range will not list any probes. # # SECTION: dtrace Utility/-i Option # ## if [ $# != 1 ]; then echo expected one argument: '<'dtrace-path'>' exit 2 fi dtrace=$1 $dtrace -i 0-2 status=$? echo $status if [ "$status" -ne 0 ]; then exit 0 fi echo $tst: dtrace failed exit $status #!/bin/ksh -p # # 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. # #ident "%Z%%M% %I% %E% SMI" ## # # ASSERTION: # The -i option can be used to enable the trace of probes from their ids. A # non-increasing range will not list any probes. # # SECTION: dtrace Utility/-i Option # ## if [ $# != 1 ]; then echo expected one argument: '<'dtrace-path'>' exit 2 fi dtrace=$1 $dtrace -i 4-2 status=$? echo $status if [ "$status" -ne 0 ]; then exit 0 fi echo $tst: dtrace failed exit $status #!/bin/ksh -p # # 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. # #ident "%Z%%M% %I% %E% SMI" ## # # ASSERTION: # The -i option can be used to enable the trace of probes from their ids. A # non-increasing range will not list any probes. # # SECTION: dtrace Utility/-i Option # ## if [ $# != 1 ]; then echo expected one argument: '<'dtrace-path'>' exit 2 fi dtrace=$1 $dtrace -i 2-2 status=$? echo $status if [ "$status" -ne 0 ]; then exit 0 fi echo $tst: dtrace failed exit $status #!/bin/ksh -p # # 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. # #ident "%Z%%M% %I% %E% SMI" ## # # ASSERTION: # The -i option can be used to enable the trace of probes from their ids. A # non-increasing range will not list any probes. # # SECTION: dtrace Utility/-i Option # ## if [ $# != 1 ]; then echo expected one argument: '<'dtrace-path'>' exit 2 fi dtrace=$1 $dtrace -i 1 2 3 4 status=$? echo $status if [ "$status" -ne 0 ]; then exit 0 fi echo $tst: dtrace failed exit $status #!/bin/ksh -p # # 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. # #ident "%Z%%M% %I% %E% SMI" ## # # ASSERTION: # The -i option can be used to enable the trace of probes from their ids. A # non-increasing range will not list any probes. # # SECTION: dtrace Utility/-i Option # ## if [ $# != 1 ]; then echo expected one argument: '<'dtrace-path'>' exit 2 fi dtrace=$1 $dtrace -i 0 - 2 status=$? echo $status if [ "$status" -ne 0 ]; then exit 0 fi echo $tst: dtrace failed exit $status #!/bin/ksh -p # # 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. # #ident "%Z%%M% %I% %E% SMI" ## # # ASSERTION: # The -m option can be used to enable the probes from their module names. # Invalid module names result in error. # # SECTION: dtrace Utility/-m Option # ## if [ $# != 1 ]; then echo expected one argument: '<'dtrace-path'>' exit 2 fi dtrace=$1 $dtrace -m profile status=$? echo $status if [ "$status" -ne 0 ]; then exit 0 fi echo $tst: dtrace failed exit $status #!/bin/ksh -p # # 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. # #ident "%Z%%M% %I% %E% SMI" ## # # ASSERTION: # The -m option can be used to enable the probes from their module names. # Invalid module names result in error. # # SECTION: dtrace Utility/-m Option # ## if [ $# != 1 ]; then echo expected one argument: '<'dtrace-path'>' exit 2 fi dtrace=$1 $dtrace -m :genunix:: status=$? echo $status if [ "$status" -ne 0 ]; then exit 0 fi echo $tst: dtrace failed exit $status #!/bin/ksh -p # # 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. # #ident "%Z%%M% %I% %E% SMI" ## # # ASSERTION: # The -m option can be used to enable the probes from their module names. # Invalid module names result in error. # # SECTION: dtrace Utility/-m Option # ## if [ $# != 1 ]; then echo expected one argument: '<'dtrace-path'>' exit 2 fi dtrace=$1 $dtrace -m genunix:: status=$? echo $status if [ "$status" -ne 0 ]; then exit 0 fi echo $tst: dtrace failed exit $status #!/bin/ksh -p # # 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. # #ident "%Z%%M% %I% %E% SMI" ## # # ASSERTION: # The -m option can be used to enable the probes from their module names. # Invalid module names result in error. # # SECTION: dtrace Utility/-m Option # ## if [ $# != 1 ]; then echo expected one argument: '<'dtrace-path'>' exit 2 fi dtrace=$1 $dtrace -m profile:::profile-97 status=$? echo $status if [ "$status" -ne 0 ]; then exit 0 fi echo $tst: dtrace failed exit $status #!/bin/ksh -p # # 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. # #ident "%Z%%M% %I% %E% SMI" ## # # ASSERTION: # The -m option can be used to enable the probes from their module names. # Invalid module names result in error. # # SECTION: dtrace Utility/-m Option # ## if [ $# != 1 ]; then echo expected one argument: '<'dtrace-path'>' exit 2 fi dtrace=$1 $dtrace -m foounix -m unix status=$? echo $status if [ "$status" -ne 0 ]; then exit 0 fi echo $tst: dtrace failed exit $status #!/bin/ksh -p # # 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. # #ident "%Z%%M% %I% %E% SMI" ## # # ASSERTION: # The -m option can be used to enable the probes from their module names. # Invalid module names result in error. # # SECTION: dtrace Utility/-m Option # ## if [ $# != 1 ]; then echo expected one argument: '<'dtrace-path'>' exit 2 fi dtrace=$1 $dtrace -m fbt:des:des3_crunch_block:return status=$? echo $status if [ "$status" -ne 0 ]; then exit 0 fi echo $tst: dtrace failed exit $status #!/bin/ksh -p # # 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. # #ident "%Z%%M% %I% %E% SMI" ## # # ASSERTION: # The -m option can be used to enable the probes from their module names. # Invalid module names result in error. # # SECTION: dtrace Utility/-m Option # ## if [ $# != 1 ]; then echo expected one argument: '<'dtrace-path'>' exit 2 fi dtrace=$1 $dtrace -m genunix::'{printf("FOUND");}' status=$? echo $status if [ "$status" -ne 0 ]; then exit 0 fi echo $tst: dtrace failed exit $status #!/bin/ksh -p # # 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. # #ident "%Z%%M% %I% %E% SMI" ## # # ASSERTION: # The -m option can be used to enable the probes from their module names. # Invalid module names result in error. # # SECTION: dtrace Utility/-m Option # ## if [ $# != 1 ]; then echo expected one argument: '<'dtrace-path'>' exit 2 fi dtrace=$1 $dtrace -m genunix:'{printf("FOUND");}' status=$? echo $status if [ "$status" -ne 0 ]; then exit 0 fi echo $tst: dtrace failed exit $status #!/bin/ksh -p # # 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. # #ident "%Z%%M% %I% %E% SMI" ## # # ASSERTION: # The -n option can be used to enable the trace of probes from their names. # # SECTION: dtrace Utility/-n Option # ## if [ $# != 1 ]; then echo expected one argument: '<'dtrace-path'>' exit 2 fi dtrace=$1 $dtrace -n profile status=$? echo $status if [ "$status" -ne 0 ]; then exit 0 fi echo $tst: dtrace failed exit $status #!/bin/ksh -p # # 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. # #ident "%Z%%M% %I% %E% SMI" ## # # ASSERTION: # The -n option can be used to enable the trace of probes from their names. # # SECTION: dtrace Utility/-n Option # ## if [ $# != 1 ]; then echo expected one argument: '<'dtrace-path'>' exit 2 fi dtrace=$1 $dtrace -n genunix status=$? echo $status if [ "$status" -ne 0 ]; then exit 0 fi echo $tst: dtrace failed exit $status #!/bin/ksh -p # # 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. # #ident "%Z%%M% %I% %E% SMI" ## # # ASSERTION: # The -n option can be used to enable the trace of probes from their names. # # SECTION: dtrace Utility/-n Option # ## if [ $# != 1 ]; then echo expected one argument: '<'dtrace-path'>' exit 2 fi dtrace=$1 $dtrace -n not_a_valid_probe status=$? echo $status if [ "$status" -ne 0 ]; then exit 0 fi echo $tst: dtrace failed exit $status #!/bin/ksh -p # # 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. # #ident "%Z%%M% %I% %E% SMI" ## # # ASSERTION: # The -n option can be used to enable the trace of probes from their names. # # SECTION: dtrace Utility/-n Option # ## if [ $# != 1 ]; then echo expected one argument: '<'dtrace-path'>' exit 2 fi dtrace=$1 $dtrace -n begin status=$? echo $status if [ "$status" -ne 0 ]; then exit 0 fi echo $tst: dtrace failed exit $status #!/bin/ksh -p # # 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. # #ident "%Z%%M% %I% %E% SMI" ## # # ASSERTION: # The -n option can be used to enable the trace of probes from their names. # # SECTION: dtrace Utility/-n Option # ## if [ $# != 1 ]; then echo expected one argument: '<'dtrace-path'>' exit 2 fi dtrace=$1 $dtrace -n genunix:read status=$? echo $status if [ "$status" -ne 0 ]; then exit 0 fi echo $tst: dtrace failed exit $status #!/bin/ksh -p # # 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. # #ident "%Z%%M% %I% %E% SMI" ## # # ASSERTION: # The -n option can be used to enable the trace of probes from their names. # # SECTION: dtrace Utility/-n Option # ## if [ $# != 1 ]; then echo expected one argument: '<'dtrace-path'>' exit 2 fi dtrace=$1 $dtrace -n sysinfo:genunix:read status=$? echo $status if [ "$status" -ne 0 ]; then exit 0 fi echo $tst: dtrace failed exit $status #!/bin/ksh -p # # 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. # #ident "%Z%%M% %I% %E% SMI" ## # # ASSERTION: # The -n option can be used to enable the trace of probes from their names. # # SECTION: dtrace Utility/-n Option # ## if [ $# != 1 ]; then echo expected one argument: '<'dtrace-path'>' exit 2 fi dtrace=$1 $dtrace -n :genunix: status=$? echo $status if [ "$status" -ne 0 ]; then exit 0 fi echo $tst: dtrace failed exit $status #!/bin/ksh -p # # 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. # #ident "%Z%%M% %I% %E% SMI" ## # # ASSERTION: # The -n option can be used to enable the trace of probes from their names. # # SECTION: dtrace Utility/-n Option # ## if [ $# != 1 ]; then echo expected one argument: '<'dtrace-path'>' exit 2 fi dtrace=$1 $dtrace -n fight: -n write: status=$? echo $status if [ "$status" -ne 0 ]; then exit 0 fi echo $tst: dtrace failed exit $status #!/bin/ksh -p # # 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. # #ident "%Z%%M% %I% %E% SMI" ## # # ASSERTION: # The -n option can be used to enable the trace of probes from their names. # # SECTION: dtrace Utility/-n Option # ## if [ $# != 1 ]; then echo expected one argument: '<'dtrace-path'>' exit 2 fi dtrace=$1 $dtrace -n BEGIN '{printf("FOUND");}' status=$? echo $status if [ "$status" -ne 0 ]; then exit 0 fi echo $tst: dtrace failed exit $status #!/bin/ksh -p # # 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. # #ident "%Z%%M% %I% %E% SMI" ## # # ASSERTION: # The -P option can be used to list the probes from their provider names. # Invalid module names result in error. # # SECTION: dtrace Utility/-P Option; # ## if [ $# != 1 ]; then echo expected one argument: '<'dtrace-path'>' exit 2 fi dtrace=$1 $dtrace -P foofile status=$? echo $status if [ "$status" -ne 0 ]; then exit 0 fi echo $tst: dtrace failed exit $status #!/bin/ksh -p # # 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. # #ident "%Z%%M% %I% %E% SMI" ## # # ASSERTION: # The -P option can be used to list the probes from their provider names. # Invalid module names result in error. # # SECTION: dtrace Utility/-P Option; # ## if [ $# != 1 ]; then echo expected one argument: '<'dtrace-path'>' exit 2 fi dtrace=$1 $dtrace -P profile::: status=$? echo $status if [ "$status" -ne 0 ]; then exit 0 fi echo $tst: dtrace failed exit $status #!/bin/ksh -p # # 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. # #ident "%Z%%M% %I% %E% SMI" ## # # ASSERTION: # The -P option can be used to list the probes from their provider names. # Invalid module names result in error. # # SECTION: dtrace Utility/-P Option; # ## if [ $# != 1 ]; then echo expected one argument: '<'dtrace-path'>' exit 2 fi dtrace=$1 $dtrace -P profile:::profile-97 status=$? echo $status if [ "$status" -ne 0 ]; then exit 0 fi echo $tst: dtrace failed exit $status #!/bin/ksh -p # # 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. # #ident "%Z%%M% %I% %E% SMI" ## # # ASSERTION: # The -P option can be used to list the probes from their provider names. # Invalid module names result in error. # # SECTION: dtrace Utility/-P Option; # ## if [ $# != 1 ]; then echo expected one argument: '<'dtrace-path'>' exit 2 fi dtrace=$1 $dtrace -P fbt:des:des3_crunch_block:return status=$? echo $status if [ "$status" -ne 0 ]; then exit 0 fi echo $tst: dtrace failed exit $status #!/bin/ksh -p # # 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. # #ident "%Z%%M% %I% %E% SMI" ## # # ASSERTION: # The -P option can be used to list the probes from their provider names. # Invalid module names result in error. # # SECTION: dtrace Utility/-P Option; # ## if [ $# != 1 ]; then echo expected one argument: '<'dtrace-path'>' exit 2 fi dtrace=$1 $dtrace -P profile '{printf("FOUND");}' status=$? echo $status if [ "$status" -ne 0 ]; then exit 0 fi echo $tst: dtrace failed exit $status #!/bin/ksh -p # # 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. # #ident "%Z%%M% %I% %E% SMI" ## # # ASSERTION: # Testing -i option with multiple valid and invalid probe identifiers. # # SECTION: dtrace Utility/-i Option # ## if [ $# != 1 ]; then echo expected one argument: '<'dtrace-path'>' exit 2 fi dtrace=$1 $dtrace -i 12 -i 10 -i 0 if [ $? -ne 1 ]; then echo $tst: dtrace failed exit 1 fi exit 0 #!/bin/ksh -p # # 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. # #ident "%Z%%M% %I% %E% SMI" ## # # ASSERTION: # The -C option is used to run the C preprocessor over D programs before # compiling them. The -H option used in conjuction with the -C option # lists the pathnames of the included files to STDERR. # # SECTION: dtrace Utility/-C Option; # dtrace Utility/-H Option # ## script() { $dtrace -CH -s /dev/stdin < BEGIN { printf("This test should compile\n"); exit(0); } EOF } if [ $# != 1 ]; then echo expected one argument: '<'dtrace-path'>' exit 2 fi dtrace=$1 script status=$? if [ "$status" -ne 0 ]; then echo $tst: dtrace failed fi exit $status #!/bin/ksh -p # # 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. # #ident "%Z%%M% %I% %E% SMI" ## # # ASSERTION: # Using the -q option suppresses the dtrace messages and prints only the # data traced by trace() and printf() to stdout. # # SECTION: dtrace Utility/-q Option # ## script() { $dtrace -q -s /dev/stdin <' exit 2 fi dtrace=$1 script status=$? if [ "$status" -ne 0 ]; then echo $tst: dtrace failed fi exit $status I am the only one. #!/bin/ksh -p # # 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. # #ident "%Z%%M% %I% %E% SMI" ## # # ASSERTION: # Using the -e option exits after compiling any requests but before # enabling probes. # # SECTION: dtrace Utility/-e Option # ## script() { $dtrace -e -s /dev/stdin <' exit 2 fi dtrace=$1 script status=$? if [ "$status" -ne 0 ]; then echo $tst: dtrace failed fi exit $status #!/bin/ksh -p # # 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. # #ident "%Z%%M% %I% %E% SMI" ## # # ASSERTION: # The -D option can be used to define a name when used in conjunction # with the -C option. The -U option can be used to undefine a name in # conjunction with the -C option. # # SECTION: dtrace Utility/-C Option; # dtrace Utility/-D Option; # dtrace Utility/-U Option # ## script() { $dtrace -C -D VALUE=40 -U VALUE -s /dev/stdin <' exit 2 fi dtrace=$1 script status=$? if [ "$status" -ne 0 ]; then exit 0 fi echo $tst: dtrace failed exit $status #!/bin/ksh -p # # 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. # #ident "%Z%%M% %I% %E% SMI" ## # # ASSERTION: # The -Z option can be used to permit descriptions that match # zero probes. # # SECTION: dtrace Utility/-Z Option; # dtrace Utility/-f Option # ## if [ $# != 1 ]; then echo expected one argument: '<'dtrace-path'>' exit 2 fi dtrace=$1 $dtrace -qZf wassup'{printf("Iamkool");}' \ -qf read'{printf("I am done"); exit(0);}' status=$? if [ "$status" -ne 0 ]; then echo $tst: dtrace failed fi exit $status I am done #!/bin/ksh -p # # 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. # #ident "%Z%%M% %I% %E% SMI" ## # # ASSERTION: # The -Z option can be used to permit descriptions that match # zero probes. # # SECTION: dtrace Utility/-Z Option; # dtrace Utility/-m Option # ## if [ $# != 1 ]; then echo expected one argument: '<'dtrace-path'>' exit 2 fi dtrace=$1 $dtrace -qZm wassup'{printf("Iamkool");}' \ -qm unix'{printf("I am done"); exit(0);}' status=$? if [ "$status" -ne 0 ]; then echo $tst: dtrace failed fi exit $status I am done #!/bin/ksh -p # # 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. # #ident "%Z%%M% %I% %E% SMI" ## # # ASSERTION: # The -Z option can be used to permit descriptions that match # zero probes. # # SECTION: dtrace Utility/-Z Option; # dtrace Utility/-n Option # ## if [ $# != 1 ]; then echo expected one argument: '<'dtrace-path'>' exit 2 fi dtrace=$1 $dtrace -qZn wassup'{printf("Iamkool");}' \ -qn BEGIN'{printf("I am done"); exit(0);}' status=$? if [ "$status" -ne 0 ]; then echo $tst: dtrace failed fi exit $status I am done #!/bin/ksh -p # # 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. # #ident "%Z%%M% %I% %E% SMI" ## # # ASSERTION: # Testing -i option with zero probe identifier. # # SECTION: dtrace Utility/-i Option # ## if [ $# != 1 ]; then echo expected one argument: '<'dtrace-path'>' exit 2 fi dtrace=$1 $dtrace -i 0 if [ $? -ne 1 ]; then echo $tst: dtrace failed exit 1 fi exit 0 #!/bin/ksh -p # # 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. # #ident "%Z%%M% %I% %E% SMI" ## # # ASSERTION: # Without the -Z option probe descriptions that do not match any known # probes will cause an error or will not be enabled. # # SECTION: dtrace Utility/-Z Option # ## if [ $# != 1 ]; then echo expected one argument: '<'dtrace-path'>' exit 2 fi dtrace=$1 $dtrace -qP wassup'{printf("Iamkool");}' \ -qP profile'{printf("I am done"); exit(0);}' status=$? if [ "$status" -ne 0 ]; then exit 0 fi echo $tst: dtrace failed exit $status #!/bin/ksh -p # # 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. # #ident "%Z%%M% %I% %E% SMI" ## # # ASSERTION: # The -Z option can be used to permit descriptions that match # zero probes. # # SECTION: dtrace Utility/-Z Option; # dtrace Utility/-P Option # ## if [ $# != 1 ]; then echo expected one argument: '<'dtrace-path'>' exit 2 fi dtrace=$1 $dtrace -qZP wassup'{printf("Iamkool");}' \ -qP profile'{printf("I am done"); exit(0);}' status=$? if [ "$status" -ne 0 ]; then echo $tst: dtrace failed fi exit $status I am done /* * 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. */ /* * ASSERTION: * Calculate timestamp between BEGIN and END. * * SECTION: dtrace Provider * */ #pragma D option quiet END { total = timestamp - start; } BEGIN { start = timestamp; exit(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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * ASSERTION: * Sequence flow of END profile. * * SECTION: dtrace Provider * */ #pragma D option quiet END { printf("End fired after exit\n"); } BEGIN { printf("Begin fired first\n"); } tick-1 { printf("tick fired second\n"); printf("Call exit\n"); exit(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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * ASSERTION: * END without BEGIN profile * * SECTION: dtrace Provider * */ #pragma D option quiet END { printf("End fired after exit\n"); } tick-1 { exit(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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * ASSERTION: * Tests multiple END profile. * * SECTION: dtrace Provider * */ #pragma D option quiet END { printf("End1 fired after exit\n"); } END { printf("End2 fired after exit\n"); } END { printf("End3 fired after exit\n"); } END { printf("End4 fired after exit\n"); } BEGIN { printf("Begin fired first\n"); } BEGIN { printf("Begin fired second\n"); } BEGIN { printf("Begin fired third\n"); } BEGIN { printf("Begin fired fourth\n"); } BEGIN { printf("Begin fired fifth\n"); exit(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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * ASSERTION: * Tests Multiple END and single BEGIN * * SECTION: dtrace Provider * */ #pragma D option quiet END { printf("End1 fired after exit\n"); } END { printf("End2 fired after exit\n"); } END { printf("End3 fired after exit\n"); } END { printf("End4 fired after exit\n"); } BEGIN { printf("Begin fired first\n"); exit(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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * ASSERTION: * Enumerations assigning same or different values to the same identifier in * different enumerations should throw a compiler error. * * SECTION: Type and Constant Definitions/Enumerations * * */ #pragma D option quiet enum colors { RED, GREEN, BLUE }; enum shades { RED, ORANGE, GREEN, WHITE }; BEGIN { exit(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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * ASSERTION: * Repeating the same identifier in the same enumeration will throw a compiler * error. * * SECTION: Type and Constant Definitions/Enumerations * * NOTES: * */ #pragma D option quiet enum colors { RED, GREEN, GREEN = 2, BLUE }; BEGIN { exit(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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * ASSERTION: * Test the identifiers in different D enumerations at same position for * equality. * * SECTION: Type and Constant Definitions/Enumerations */ #pragma D option quiet enum colors { RED, GREEN, BLUE }; enum shades { WHITE, BLACK, YELLOW }; profile:::tick-1sec /(WHITE == RED) && (YELLOW == BLUE) && (GREEN == BLACK)/ { exit(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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * ASSERTION: * Enumerations assigning the same value to different identifiers in the same * enumeration should work okay. * * SECTION: Type and Constant Definitions/Enumerations * * NOTES: * */ #pragma D option quiet enum colors { RED = 2, GREEN = 2, BLUE = 2 }; BEGIN { exit(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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * ASSERTION: * Test the D enumerations with and without initilialization of the identifiers. * Also test for values with negative integer assignments, expressions and * fractions. * * SECTION: Type and Constant Definitions/Enumerations * */ #pragma D option quiet enum colors { RED, ORANGE = 5 + 5, YELLOW = 2, GREEN, BLUE = GREEN + ORANGE, PINK = 5/4, INDIGO = -2, VIOLET }; profile:::tick-1sec /(0 == RED) && (10 == ORANGE) && (2 == YELLOW) && (3 == GREEN) && (13 == BLUE) && (1 == PINK) && (-2 == INDIGO) && (-1 == VIOLET)/ { exit(0); } /* * CDDL HEADER START * * This file and its contents are supplied under the terms of the * Common Development and Distribution License ("CDDL"), version 1.0. * You may only use this file in accordance with the terms of version * 1.0 of the CDDL. * * A full copy of the text of the CDDL should have accompanied this * source. A copy of the CDDL is also available via the Internet at * http://www.illumos.org/license/CDDL. * * CDDL HEADER END */ /* * Copyright (c) 2012 by Delphix. All rights reserved. */ #pragma D option setenv=balloon=something_bad_happens BEGIN { exit(0); } /* * CDDL HEADER START * * This file and its contents are supplied under the terms of the * Common Development and Distribution License ("CDDL"), version 1.0. * You may only use this file in accordance with the terms of version * 1.0 of the CDDL. * * A full copy of the text of the CDDL should have accompanied this * source. A copy of the CDDL is also available via the Internet at * http://www.illumos.org/license/CDDL. * * CDDL HEADER END */ /* * Copyright (c) 2012 by Delphix. All rights reserved. */ #pragma D option unsetenv=rectalexambot BEGIN { exit(0); } # # CDDL HEADER START # # This file and its contents are supplied under the terms of the # Common Development and Distribution License ("CDDL"), version 1.0. # You may only use this file in accordance with the terms of version # 1.0 of the CDDL. # # A full copy of the text of the CDDL should have accompanied this # source. A copy of the CDDL is also available via the Internet at # http://www.illumos.org/license/CDDL. # # CDDL HEADER END # # # Copyright (c) 2012 by Delphix. All rights reserved. # # # Check that the LD_NOLAZYLOAD variable is set to 1 as expected. # if [ $# != 1 ]; then echo expected one argument: '<'dtrace-path'>' exit 2 fi dtrace=$1 $dtrace -q -Z -n doogle -c 'printenv LD_NOLAZYLOAD' exit $? 1 # # 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. # # # Reset an environment variable we already know to be set. # if [ $# != 1 ]; then echo expected one argument: '<'dtrace-path'>' exit 2 fi dtrace=$1 $dtrace -q -Z -n doogle -xsetenv=LD_NOLAZYLOAD=0 -c 'printenv LD_NOLAZYLOAD' exit $? 0 # # CDDL HEADER START # # This file and its contents are supplied under the terms of the # Common Development and Distribution License ("CDDL"), version 1.0. # You may only use this file in accordance with the terms of version # 1.0 of the CDDL. # # A full copy of the text of the CDDL should have accompanied this # source. A copy of the CDDL is also available via the Internet at # http://www.illumos.org/license/CDDL. # # CDDL HEADER END # # # Copyright (c) 2012 by Delphix. All rights reserved. # # # Test setting a variable that we isn't already set. # if [ $# != 1 ]; then echo expected one argument: '<'dtrace-path'>' exit 2 fi dtrace=$1 $dtrace -q -Z -n doogle -xsetenv=CORPORATIONS=PEOPLE -c 'printenv CORPORATIONS' exit $? PEOPLE # # 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 unsetting a variable we know to be set. # if [ $# != 1 ]; then echo expected one argument: '<'dtrace-path'>' exit 2 fi dtrace=$1 $dtrace -q -Z -n doogle -xunsetenv=LD_NOLAZYLOAD -c 'printenv LD_NOLAZYLOAD' exit $? # # 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 invalid syntax to the unsetenv option. # if [ $# != 1 ]; then echo expected one argument: '<'dtrace-path'>' exit 2 fi dtrace=$1 $dtrace -q -Z -n doogle -xunsetenv=ed=screven -c 'true' 2>&1 [[ $? -eq 1 ]] && exit 0 exit 1 dtrace: failed to set -x unsetenv: Invalid value for specified option /* * 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. */ /* * ASSERTION: * To test DTRACEFLT_BADADDR error * * SECTION: dtrace Provider * */ #pragma D option quiet ERROR { printf("The arguments are %u %u %u %u %u\n", arg1, arg2, arg3, arg4, arg5); printf("The value of arg4 = %u\n", DTRACEFLT_BADADDR); exit(0); } BEGIN { *(char *)NULL; } /* * 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. */ /* * ASSERTION: * To test DTRACEFLT_DIVZERO error * * SECTION: dtrace Provider * */ #pragma D option quiet ERROR { printf("The arguments are %u %u %u %d %u\n", arg1, arg2, arg3, arg4, arg5); exit(0); } char *s; BEGIN { i = 1; j = 2; j = i/(j-2); } /* * 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. */ /* * ASSERTION: * To test DTRACEFLT_UNKNOWN error * * SECTION: dtrace Provider * */ #pragma D option quiet ERROR { printf("The arguments are %u %u %u %u %u\n", arg1, arg2, arg3, arg4, arg5); printf("The value of arg4 = %u\n", DTRACEFLT_UNKNOWN); exit(0); } BEGIN { x = (int *) 64; y = *x; trace(y); } /* * 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. */ /* * ASSERTION: * To fire ERROR probe * * SECTION: dtrace Provider * */ #pragma D option quiet ERROR { printf("Error fired\n"); exit(0); } BEGIN { *(char *)NULL; } /* * 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. */ /* * ASSERTION: * Flow of ERROR probe * * SECTION: dtrace Provider * */ #pragma D option quiet ERROR { printf("Error fired\n"); exit(0); } END { printf("End fired after exit\n"); } BEGIN { *(char *)NULL; } /* * 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. */ /* * ASSERTION: * Call exit() without arguments. * * SECTION: Actions and Subroutines/exit() */ #pragma D option quiet dtrace:::BEGIN { exit() } /* * 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. */ /* * ASSERTION: * Basic test - call with 1 * * SECTION: Actions and Subroutines/exit() */ #pragma D option quiet dtrace:::BEGIN { exit(1); } /* * 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. */ /* * ASSERTION: * Positive test * * SECTION: Actions and Subroutines/exit() */ #pragma D option quiet dtrace:::BEGIN { exit(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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * ASSERTION: Call fbt provider over non existent function and make * sure it results in compilation error. * * SECTION: FBT Provider/Probes */ #pragma D option quiet BEGIN { self->traceme = 1; } void bar(); fbt::bar:entry { printf("Entering the function\n"); } fbt::bar:return { printf("Returning the function\n"); exit(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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * ASSERTION: simple fbt arguments test. * * SECTION: FBT Provider/Probes */ #pragma D option quiet tick-1 { self->traceme = 1; } fbt::: /self->traceme/ { printf("The arguments are %u %u %u %u %u %u %u %u\n", arg0, arg1, arg3, arg4, arg5, arg6, arg7, arg8); exit (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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * ASSERTION: FBT provider function entry and exit test. * * SECTION: FBT Provider/Probe arguments */ #pragma D option quiet #pragma D option statusrate=10ms fbt::ioctl:entry { printf("Entering the ioctl function\n"); } fbt::ioctl:return { printf("Returning from ioctl function\n"); exit(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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * ASSERTION: Fbt provider return value verify test. * * SECTION: FBT Provider/Probe arguments */ #pragma D option quiet #pragma D option statusrate=10ms fbt::ioctl:return { printf("The function return value is stored in %u\n", arg1); exit(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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * ASSERTION: FBT provider arguments scan test. * * SECTION: FBT Provider/Probe arguments */ #pragma D option quiet #pragma D option statusrate=10ms fbt::ioctl:entry { printf("Entering the ioctl function\n"); printf("The few arguments are %u %u %u %u\n", arg0, arg1, arg2, arg3); } fbt::ioctl:return { printf("Returning from ioctl function\n"); printf("The few arguments are %u %u %u %u\n", arg0, arg1, arg2, arg3); exit(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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * ASSERTION: FBT provider return value offset verification test. * * SECTION: FBT Provider/Probe arguments */ #pragma D option quiet #pragma D option statusrate=10ms BEGIN { self->traceme = 1; } fbt::ioctl:entry { printf("Entering the function\n"); } fbt::ioctl:return { printf("The offset = %u\n", arg0); exit(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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * ASSERTION: FBT provider argument 0 test * * SECTION: FBT Provider/Probe arguments */ #pragma D option quiet #pragma D option statusrate=10ms fbt::ioctl:entry { printf("Entering the ioctl function\n"); printf("The few arguments are %u %u %u %u\n", arg0, arg1, arg2, arg3); exit(0); } fbt::ioctl:return { printf("Returning from ioctl function\n"); printf("The few arguments are %u %u %u %u\n", arg0, arg1, arg2, arg3); } /* * 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. */ /* * ASSERTION: simple fbt provider return test. * * SECTION: FBT Provider/Probe arguments */ #pragma D option quiet BEGIN { self->traceme = 1; } fbt:::entry { printf("Entering the function\n"); } fbt:::return { printf("Returning the function\n"); exit(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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * ASSERTION: simple fbt provider arg0 and probfunc print test. * * SECTION: FBT Provider/Probe arguments */ #pragma D option quiet #pragma D option statusrate=10ms fbt::ioctl:return /arg1 == 0/ { printf("%s %x returned 0", probefunc, arg0); exit(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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * ASSERTION: simple fbt provider tailcall test. * * SECTION: FBT Provider/Probe arguments */ #pragma D option quiet #pragma D option statusrate=10ms fbt::ioctl:entry { self->traceme = 1; } fbt:::entry /self->traceme/ { printf("called %s\n", probefunc); } fbt::ioctl:return /self->traceme/ { self->traceme = 0; exit (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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * ASSERTION: * progenyof() should accept one argument - a pid * * SECTION: Actions and Subroutines/progenyof() * */ BEGIN { progencyof(1, 2); exit(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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * ASSERTION: * +=, -= must handle invalid variables. * * SECTION: Types, Operators, and Expressions/Assignment Operators * */ int p; BEGIN { p = 1; p -= alloca(10); exit(1); } /* * 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. */ /* * ASSERTION: * chill() should handle a bad argument. * * SECTION: Actions and Subroutines/chill() * */ BEGIN { chill("badarg"); exit(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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * ASSERTION: * copyout() must handle invalid argument types. * * SECTION: Actions and Subroutines/copyout() * */ BEGIN { copyout("not_void_*", "not_uinptr_t", "not_size_t"); exit(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. */ /* * ASSERTION: * mutex_owned() should handle an invalid argument passed. * * SECTION: Actions and Subroutines/mutex_owned() * */ BEGIN { mutex_owned("badarg"); exit(1); } /* * 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. */ /* * ASSERTION: * raise() should generate an error if any arguments are sent. * * SECTION: Actions and Subroutines/raise() * */ BEGIN { raise("badarg"); exit(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 (c) 2011, Joyent, Inc. All rights reserved. */ BEGIN { trace(tolower(2152006)); exit(1); } /* * 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); } /* * 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. */ /* * ASSERTION: * alloca() should handle no arguments as an error * * SECTION: Actions and Subroutines/alloca() * */ #pragma D option quiet BEGIN { ptr = alloca(); exit(1); } /* * 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. */ /* * ASSERTION: * breakpoint() should handle arguments passed as an error. * * SECTION: Actions and Subroutines/breakpoint() * */ BEGIN { breakpoint(1, 2); exit(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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * ASSERTION: * chill() should handle no arguments. * * SECTION: Actions and Subroutines/chill() * */ BEGIN { chill(); exit(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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * ASSERTION: * chill() should handle too many arguments. * * SECTION: Actions and Subroutines/chill() * */ BEGIN { chill(1000, 1000, 1000); exit(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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * ASSERTION: * copyoutstr() must handle invalid argument types. * * SECTION: Actions and Subroutines/copyoutstr() * */ BEGIN { copyoutstr("string", "not_uintptr_t"); exit(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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * ASSERTION: * Calling copyoutstr() with less than 2 arguments will generate an error * * SECTION: Actions and Subroutines/copyoutstr() * */ BEGIN { copyoutstr("string"); exit(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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * ASSERTION: * Calling copyout() with less than 3 arguments will generate an error * * SECTION: Actions and Subroutines/copyout() * */ BEGIN { copyout(0, 20); exit(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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * ASSERTION: * copyout() should handle too many arguments passed. * * SECTION: Actions and Subroutines/copyin(); * Actions and Subroutines/copyinstr() * */ BEGIN { copyout((void *)3, (uintptr_t)1000, (size_t)1000, "toomany"); exit(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. */ /* * ASSERTION: * mutex_owned() should handle too few args passed * * SECTION: Actions and Subroutines/mutex_owned() * */ lockstat:genunix:mutex_enter:adaptive-acquire { mutex_owned(); exit(1); } /* * 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. */ /* * ASSERTION: * mutex_owned() should handle too many args passed * * SECTION: Actions and Subroutines/mutex_owned() * */ lockstat:genunix:mutex_enter:adaptive-acquire { mutex_owned((kmutex_t *)arg0, 99); exit(1); } /* * 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. */ /* * ASSERTION: * mutex_type_adaptive() should handle an invalid argument passed. * * SECTION: Actions and Subroutines/mutex_type_adaptive() * */ BEGIN { mutex_type_adaptive(trace()); exit(1); } /* * 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. */ /* * ASSERTION: * mutex_type_adaptive() should handle too few args passed * * SECTION: Actions and Subroutines/mutex_type_adaptive() * */ lockstat:genunix:mutex_enter:adaptive-acquire { mutex_type_adaptive(); exit(1); } /* * 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. */ /* * ASSERTION: * mutex_type_adaptive() should handle too many args passed * * SECTION: Actions and Subroutines/mutex_type_adaptive() * */ lockstat:genunix:mutex_enter:adaptive-acquire { mutex_type_adaptive((kmutex_t *)arg0, 99); exit(1); } /* * 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. */ /* * ASSERTION: * panic() should handle any argument passed as an error. * * SECTION: Actions and Subroutines/panic() * */ BEGIN { panic("badarg"); exit(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. */ /* * ASSERTION: * progenyof() should return an error if the argument is an * incorrect type. * * SECTION: Actions and Subroutines/progenyof() * */ BEGIN { progenyof(trace()); exit(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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * ASSERTION: * stop() should generate an error if any arguments are sent. * * SECTION: Actions and Subroutines/stop() * */ BEGIN { stop("badarg"); exit(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 (c) 2011, Joyent, Inc. All rights reserved. */ BEGIN { trace(tolower()); exit(1); } /* * 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); } /* * 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); } /* * 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); } /* * 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. */ /* * ASSERTION: * stringof() accepts a scalar, pointer, or string * * SECTION: Types, Operators, and Expressions/Precedence * */ #pragma D option quiet BEGIN { printf("%s", stringof (trace(0))); exit(1); } /* * 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. */ /* * ASSERTION: * +=, -= must handle invalid variables. * * SECTION: Types, Operators, and Expressions/Assignment Operators * */ BEGIN { p -= trace(0); exit(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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * ASSERTION: * memory allocated by alloca() is only valid within the clause * it is allocated. * * SECTION: Actions and Subroutines/alloca() * */ #pragma D option quiet BEGIN { ptr = alloca(sizeof (int)); } tick-1 { bcopy((void *)&`kmem_flags, ptr, sizeof (int)); exit(0); } ERROR { exit(1); } /* * 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. */ /* * ASSERTION: * alloca() cannot be used to "unconsume" scratch space memory by * accepting a negative offset. * * SECTION: Actions and Subroutines/alloca() * */ BEGIN { ptr = alloca(10); ptr = alloca(0xffffffffffffffff); exit(0); } ERROR { exit(1); } /* * 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. */ /* * ASSERTION: * bcopy should not allow a copy to memory that is not scratch memory. * * SECTION: Actions and Subroutines/alloca(); * Actions and Subroutines/bcopy() * */ #pragma D option quiet BEGIN { ptr = alloca(sizeof (int)); /* Attempt a copy from scratch memory to a kernel address */ bcopy(ptr, (void *)&`kmem_flags, sizeof (int)); exit(0); } ERROR { exit(1); } /* * 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. */ /* * ASSERTION: * bcopy should not copy from one memory location to another * if the memory is not properly allocated * * SECTION: Actions and Subroutines/alloca(); * Actions and Subroutines/bcopy() * */ #pragma D option quiet BEGIN { ptr = alloca(0); /* Attempt to bcopy to scratch memory that isn't allocated */ bcopy((void *)&`kmem_flags, ptr, sizeof (int)); exit(0); } ERROR { exit(1); } /* * 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. */ /* * ASSERTION: * bcopy should not copy from one memory location to another * if the memory is not properly allocated * * SECTION: Actions and Subroutines/bcopy() * */ #pragma D option quiet int *ptr; BEGIN { /* Attempt to copy to non-scratch memory */ bcopy((void *)&`kmem_flags, ptr, sizeof (int)); exit(0); } ERROR { exit(1); } /* * 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. */ /* * ASSERTION: * bcopy should not copy from one memory location to another * if the memory is not properly allocated * * SECTION: Actions and Subroutines/bcopy() * */ #pragma D option quiet BEGIN { /* Attempt to copy to a NULL address */ bcopy((void *)&`kmem_flags, (void *)NULL, sizeof (int)); exit(0); } ERROR { exit(1); } /* * 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. */ /* * ASSERTION: * bcopy should not copy from one memory location to another * if the source memory location is not valid. * * SECTION: Actions and Subroutines/alloca(); * Actions and Subroutines/bcopy() * */ #pragma D option quiet BEGIN { ptr = alloca(sizeof (int)); /* Attempt to copy from a NULL address */ bcopy((void *)NULL, ptr, sizeof (int)); exit(0); } ERROR { exit(1); } /* * 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. */ /* * ASSERTION: * bcopy should not copy from one memory location to another * if the source memory location is not valid. * * SECTION: Actions and Subroutines/alloca(); * Actions and Subroutines/bcopy() * */ #pragma D option quiet int *badptr; BEGIN { ptr = alloca(sizeof (int)); /* Attempt to copy from a invalid address */ bcopy(badptr, ptr, sizeof (int)); exit(0); } ERROR { exit(1); } /* * 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. */ #pragma D option quiet BEGIN { bcopy("bad news", alloca(1), -1); exit(0); } ERROR { exit(1); } /* * 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. */ BEGIN { chill(200); chill(((hrtime_t)1 << 63) - 1); exit(0); } ERROR { exit(1); } /* * 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" dtrace_script() { $dtrace -w -s /dev/stdin <' exit 2 fi dtrace=$1 dtrace_script & child=$! wait $child status=$? exit $status /* * 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. */ /* * ASSERTION: * copyout() should handle invalid args. * * SECTION: Actions and Subroutines/copyout() * */ #pragma D option destructive BEGIN { i = 3; copyout((void *)i, 0, 5); exit(0); } ERROR { exit(1); } /* * 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" dtrace_script() { $dtrace -w -s /dev/stdin <pr_envp, sizeof (char *), ptr); copyout(ptr, 0, sizeof (char *)); } ERROR { exit(1) } EOF } if [ $# != 1 ]; then echo expected one argument: '<'dtrace-path'>' exit 2 fi dtrace=$1 dtrace_script & child=$! wait $child status=$? exit $status /* * 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" dtrace_script() { $dtrace -w -s /dev/stdin <pr_envp, sizeof (char *), ptr); copyout(ptr, 0, sizeof (char *)); } ERROR { exit(1) } EOF } if [ $# != 1 ]; then echo expected one argument: '<'dtrace-path'>' exit 2 fi dtrace=$1 dtrace_script & child=$! wait $child status=$? exit $status /* * 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. */ #pragma D option quiet struct in6_addr *ip6a; BEGIN { ip6a = 0; printf("%s\n", inet_ntop(AF_INET6, ip6a)); exit(0); } ERROR { exit(1); } /* * 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. */ #pragma D option quiet ipaddr_t *ip4a; BEGIN { ip4a = 0; printf("%s\n", inet_ntoa(ip4a)); exit(0); } ERROR { exit(1); } /* * 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. */ #pragma D option quiet ipaddr_t *ip4a; BEGIN { ip4a = 0; printf("%s\n", inet_ntop(AF_INET, ip4a)); exit(0); } ERROR { exit(1); } /* * 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. */ #pragma D option quiet ipaddr_t *ip4a; BEGIN { this->buf4a = alloca(sizeof (ipaddr_t)); ip4a = this->buf4a; *ip4a = htonl(0xc0a80117); printf("%s\n", inet_ntop(-1, ip4a)); exit(0); } ERROR { exit(1); } # # 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. # #ident "%Z%%M% %I% %E% SMI" script() { $dtrace -wq -o $tmpfile -s /dev/stdin 2> $errfile <' exit 2 fi dtrace=$1 tmpfile=/tmp/tst.badfreopen.$$ errfile=/tmp/tst.badfreopen.$$.stderr script status=$? if [ "$status" -eq 0 ]; then i=`cat $tmpfile` if [[ $i != "123" ]]; then echo "$0: unexpected contents in $tmpfile: " \ "expected 123, found $i" status=100 fi i=`wc -l $errfile | nawk '{ print $1 }'` if [ "$i" -lt 6 ]; then echo "$0: expected at least 6 lines of stderr, found $i lines" status=101 fi else cat $errfile > /dev/fd/2 fi rm $tmpfile $errfile exit $status /* * 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. */ #pragma D option quiet /* * This test verifies that the basename() and dirname() functions are working * properly. Note that the output of this is a ksh script. When run, * it will give no output if the output is correct. */ BEGIN { dir[i++] = "/foo/bar/baz"; dir[i++] = "/foo/bar///baz/"; dir[i++] = "/foo/bar/baz/"; dir[i++] = "/foo/bar/baz//"; dir[i++] = "/foo/bar/baz/."; dir[i++] = "/foo/bar/baz/./"; dir[i++] = "/foo/bar/baz/.//"; dir[i++] = "foo/bar/baz/"; dir[i++] = "/"; dir[i++] = "./"; dir[i++] = "//"; dir[i++] = "/."; dir[i++] = "/./"; dir[i++] = "/./."; dir[i++] = "/.//"; dir[i++] = "."; dir[i++] = "f"; dir[i++] = "f/"; dir[i++] = "/////"; dir[i++] = ""; end = i; i = 0; printf("#!/usr/bin/ksh\n\n"); } tick-1ms /i < end/ { printf("if [ `basename \"%s\"` != \"%s\" ]; then\n", dir[i], basename(dir[i])); printf(" echo \"basename(\\\"%s\\\") is \\\"%s\\\"; ", dir[i], basename(dir[i])); printf("expected \\\"`basename \"%s\"`\"\\\"\n", dir[i]); printf("fi\n\n"); printf("if [ `dirname \"%s\"` != \"%s\" ]; then\n", dir[i], dirname(dir[i])); printf(" echo \"dirname(\\\"%s\\\") is \\\"%s\\\"; ", dir[i], dirname(dir[i])); printf("expected \\\"`dirname \"%s\"`\"\\\"\n", dir[i]); printf("fi\n\n"); i++; } tick-1ms /i == end/ { exit(0); } #!/usr/bin/ksh if [ `basename "/foo/bar/baz"` != "baz" ]; then echo "basename(\"/foo/bar/baz\") is \"baz\"; expected \"`basename "/foo/bar/baz"`"\" fi if [ `dirname "/foo/bar/baz"` != "/foo/bar" ]; then echo "dirname(\"/foo/bar/baz\") is \"/foo/bar\"; expected \"`dirname "/foo/bar/baz"`"\" fi if [ `basename "/foo/bar///baz/"` != "baz" ]; then echo "basename(\"/foo/bar///baz/\") is \"baz\"; expected \"`basename "/foo/bar///baz/"`"\" fi if [ `dirname "/foo/bar///baz/"` != "/foo/bar" ]; then echo "dirname(\"/foo/bar///baz/\") is \"/foo/bar\"; expected \"`dirname "/foo/bar///baz/"`"\" fi if [ `basename "/foo/bar/baz/"` != "baz" ]; then echo "basename(\"/foo/bar/baz/\") is \"baz\"; expected \"`basename "/foo/bar/baz/"`"\" fi if [ `dirname "/foo/bar/baz/"` != "/foo/bar" ]; then echo "dirname(\"/foo/bar/baz/\") is \"/foo/bar\"; expected \"`dirname "/foo/bar/baz/"`"\" fi if [ `basename "/foo/bar/baz//"` != "baz" ]; then echo "basename(\"/foo/bar/baz//\") is \"baz\"; expected \"`basename "/foo/bar/baz//"`"\" fi if [ `dirname "/foo/bar/baz//"` != "/foo/bar" ]; then echo "dirname(\"/foo/bar/baz//\") is \"/foo/bar\"; expected \"`dirname "/foo/bar/baz//"`"\" fi if [ `basename "/foo/bar/baz/."` != "." ]; then echo "basename(\"/foo/bar/baz/.\") is \".\"; expected \"`basename "/foo/bar/baz/."`"\" fi if [ `dirname "/foo/bar/baz/."` != "/foo/bar/baz" ]; then echo "dirname(\"/foo/bar/baz/.\") is \"/foo/bar/baz\"; expected \"`dirname "/foo/bar/baz/."`"\" fi if [ `basename "/foo/bar/baz/./"` != "." ]; then echo "basename(\"/foo/bar/baz/./\") is \".\"; expected \"`basename "/foo/bar/baz/./"`"\" fi if [ `dirname "/foo/bar/baz/./"` != "/foo/bar/baz" ]; then echo "dirname(\"/foo/bar/baz/./\") is \"/foo/bar/baz\"; expected \"`dirname "/foo/bar/baz/./"`"\" fi if [ `basename "/foo/bar/baz/.//"` != "." ]; then echo "basename(\"/foo/bar/baz/.//\") is \".\"; expected \"`basename "/foo/bar/baz/.//"`"\" fi if [ `dirname "/foo/bar/baz/.//"` != "/foo/bar/baz" ]; then echo "dirname(\"/foo/bar/baz/.//\") is \"/foo/bar/baz\"; expected \"`dirname "/foo/bar/baz/.//"`"\" fi if [ `basename "foo/bar/baz/"` != "baz" ]; then echo "basename(\"foo/bar/baz/\") is \"baz\"; expected \"`basename "foo/bar/baz/"`"\" fi if [ `dirname "foo/bar/baz/"` != "foo/bar" ]; then echo "dirname(\"foo/bar/baz/\") is \"foo/bar\"; expected \"`dirname "foo/bar/baz/"`"\" fi if [ `basename "/"` != "/" ]; then echo "basename(\"/\") is \"/\"; expected \"`basename "/"`"\" fi if [ `dirname "/"` != "/" ]; then echo "dirname(\"/\") is \"/\"; expected \"`dirname "/"`"\" fi if [ `basename "./"` != "." ]; then echo "basename(\"./\") is \".\"; expected \"`basename "./"`"\" fi if [ `dirname "./"` != "." ]; then echo "dirname(\"./\") is \".\"; expected \"`dirname "./"`"\" fi if [ `basename "//"` != "/" ]; then echo "basename(\"//\") is \"/\"; expected \"`basename "//"`"\" fi if [ `dirname "//"` != "/" ]; then echo "dirname(\"//\") is \"/\"; expected \"`dirname "//"`"\" fi if [ `basename "/."` != "." ]; then echo "basename(\"/.\") is \".\"; expected \"`basename "/."`"\" fi if [ `dirname "/."` != "/" ]; then echo "dirname(\"/.\") is \"/\"; expected \"`dirname "/."`"\" fi if [ `basename "/./"` != "." ]; then echo "basename(\"/./\") is \".\"; expected \"`basename "/./"`"\" fi if [ `dirname "/./"` != "/" ]; then echo "dirname(\"/./\") is \"/\"; expected \"`dirname "/./"`"\" fi if [ `basename "/./."` != "." ]; then echo "basename(\"/./.\") is \".\"; expected \"`basename "/./."`"\" fi if [ `dirname "/./."` != "/." ]; then echo "dirname(\"/./.\") is \"/.\"; expected \"`dirname "/./."`"\" fi if [ `basename "/.//"` != "." ]; then echo "basename(\"/.//\") is \".\"; expected \"`basename "/.//"`"\" fi if [ `dirname "/.//"` != "/" ]; then echo "dirname(\"/.//\") is \"/\"; expected \"`dirname "/.//"`"\" fi if [ `basename "."` != "." ]; then echo "basename(\".\") is \".\"; expected \"`basename "."`"\" fi if [ `dirname "."` != "." ]; then echo "dirname(\".\") is \".\"; expected \"`dirname "."`"\" fi if [ `basename "f"` != "f" ]; then echo "basename(\"f\") is \"f\"; expected \"`basename "f"`"\" fi if [ `dirname "f"` != "." ]; then echo "dirname(\"f\") is \".\"; expected \"`dirname "f"`"\" fi if [ `basename "f/"` != "f" ]; then echo "basename(\"f/\") is \"f\"; expected \"`basename "f/"`"\" fi if [ `dirname "f/"` != "." ]; then echo "dirname(\"f/\") is \".\"; expected \"`dirname "f/"`"\" fi if [ `basename "/////"` != "/" ]; then echo "basename(\"/////\") is \"/\"; expected \"`basename "/////"`"\" fi if [ `dirname "/////"` != "/" ]; then echo "dirname(\"/////\") is \"/\"; expected \"`dirname "/////"`"\" fi if [ `basename ""` != "." ]; then echo "basename(\"\") is \".\"; expected \"`basename ""`"\" fi if [ `dirname ""` != "." ]; then echo "dirname(\"\") is \".\"; expected \"`dirname ""`"\" fi /* * 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. */ /* * ASSERTION: * bcopy should copy from one memory location to another * * SECTION: Actions and Subroutines/alloca(); * Actions and Subroutines/bcopy() * */ #pragma D option quiet BEGIN { ptr = alloca(sizeof (int)); bcopy((void *)&`kmem_flags, ptr, sizeof (int)); intp = (int *)ptr; ret = (`kmem_flags == *intp) ? 0 : 1; } tick-1 /ret == 0/ { exit(0); } tick-1 /ret == 1/ { printf("memory address contained 0x%x, expected 0x%x\n", *intp, `kmem_flags); exit(1); } # # 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. # # ident "%Z%%M% %I% %E% SMI" # dtrace_script() { $dtrace -w -s /dev/stdin < 5/ { exit(0); } EOF } if [ $# != 1 ]; then echo expected one argument: '<'dtrace-path'>' exit 2 fi dtrace=$1 dtrace_script & child=$! wait $child status=$? exit $status /* * 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. */ #pragma D option quiet BEGIN { path[i++] = "/foo/bar/baz"; path[i++] = "/foo/bar///baz/"; path[i++] = "/foo/bar/baz/"; path[i++] = "/foo/bar/baz//"; path[i++] = "/foo/bar/baz/."; path[i++] = "/foo/bar/baz/./"; path[i++] = "/foo/bar/../../baz/.//"; path[i++] = "foo/bar/./././././baz/"; path[i++] = "/foo/bar/baz/../../../../../../"; path[i++] = "/../../../../../../"; path[i++] = "/./"; path[i++] = "/foo/bar/baz/../../bop/bang/../../bar/baz/"; path[i++] = "./"; path[i++] = "//"; path[i++] = "/."; path[i++] = "/./"; path[i++] = "/./."; path[i++] = "/.//"; path[i++] = "."; path[i++] = "/////"; path[i++] = ""; end = i; i = 0; } tick-1ms /i < end/ { printf("cleanpath(\"%s\") = \"%s\"\n", path[i], cleanpath(path[i])); i++; } tick-1ms /i == end/ { exit(0); } cleanpath("/foo/bar/baz") = "/foo/bar/baz" cleanpath("/foo/bar///baz/") = "/foo/bar/baz/" cleanpath("/foo/bar/baz/") = "/foo/bar/baz/" cleanpath("/foo/bar/baz//") = "/foo/bar/baz/" cleanpath("/foo/bar/baz/.") = "/foo/bar/baz/." cleanpath("/foo/bar/baz/./") = "/foo/bar/baz/" cleanpath("/foo/bar/../../baz/.//") = "/baz/" cleanpath("foo/bar/./././././baz/") = "foo/bar/baz/" cleanpath("/foo/bar/baz/../../../../../../") = "/" cleanpath("/../../../../../../") = "/" cleanpath("/./") = "/" cleanpath("/foo/bar/baz/../../bop/bang/../../bar/baz/") = "/foo/bar/baz/" cleanpath("./") = "./" cleanpath("//") = "/" cleanpath("/.") = "/." cleanpath("/./") = "/" cleanpath("/./.") = "/." cleanpath("/.//") = "/" cleanpath(".") = "." cleanpath("/////") = "/" cleanpath("") = "" /* * 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. */ /* * ASSERTION: * This D ditty tests the ability to perform both copyin and copyinstr. We * grab the value or pr_envp, read the first pointer from the user stack, * and then copyinstr the first environment variable and print it. * * SECTION: Actions and Subroutines/copyin(); * Actions and Subroutines/copyinstr(); * User Process Tracing/copyin() and copyinstr() */ BEGIN /curpsinfo->pr_dmodel == PR_MODEL_ILP32/ { envp = *(uint32_t *)copyin(curpsinfo->pr_envp, sizeof (uint32_t)); printf("envp[0] = \"%s\"", copyinstr(envp)); exit(0); } BEGIN /curpsinfo->pr_dmodel == PR_MODEL_LP64/ { envp = *(uint64_t *)copyin(curpsinfo->pr_envp, sizeof (uint64_t)); printf("envp[0] = \"%s\"", copyinstr(envp)); exit(0); } BEGIN { exit(1) } /* * 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. */ /* * ASSERTION: * test copyinto by copying the first string of the user's * environment. * * SECTION: Actions and Subroutines/copyinto() * */ #pragma D option quiet BEGIN /curpsinfo->pr_dmodel == PR_MODEL_ILP32/ { envp = alloca(sizeof (uint32_t)); copyinto(curpsinfo->pr_envp, sizeof (uint32_t), envp); printf("envp[0] = \"%s\"", copyinstr(*(uint32_t *)envp)); exit(0); } BEGIN /curpsinfo->pr_dmodel == PR_MODEL_LP64/ { envp = alloca(sizeof (uint64_t)); copyinto(curpsinfo->pr_envp, sizeof (uint64_t), envp); printf("envp[0] = \"%s\"", copyinstr(*(uint64_t *)envp)); exit(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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #pragma D option quiet BEGIN { this->dev = (struct dev_info *)alloca(sizeof (struct dev_info)); this->minor1 = (struct ddi_minor_data *)alloca(sizeof (struct ddi_minor_data)); this->minor2 = (struct ddi_minor_data *)alloca(sizeof (struct ddi_minor_data)); this->minor3 = (struct ddi_minor_data *)alloca(sizeof (struct ddi_minor_data)); this->minor1->d_minor.dev = 0; this->minor1->next = this->minor2; this->minor2->d_minor.dev = 0; this->minor2->next = this->minor3; this->minor3->d_minor.dev = 0; this->minor3->next = this->minor1; this->dev->devi_minor = this->minor1; trace(ddi_pathname(this->dev, 1)); } ERROR /arg4 == DTRACEFLT_ILLOP/ { exit(0); } ERROR /arg4 != DTRACEFLT_ILLOP/ { exit(1); } /* * 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. */ /* * ASSERTION: * Verify that empty clauses are OK. * * SECTION: Actions and Subroutines/Default Action */ #pragma D option quiet BEGIN { i = 1; } syscall:::entry { } tick-1 /i != 0/ { exit(0); } END { } # # 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. # #ident "%Z%%M% %I% %E% SMI" script() { $dtrace -wq -o $tmpfile -s /dev/stdin $tmpfile <' exit 2 fi dtrace=$1 tmpfile=/tmp/tst.freopen.$$ iter=20 script status=$? let i=0 if [ -f $tmpfile.$iter ]; then echo "$0: did not expect to find file: $tmpfile.$iter" cleanup exit 100 fi mv $tmpfile $tmpfile.$iter let iter=iter+1 while [ "$i" -lt "$iter" ]; do if [ ! -f $tmpfile.$i ]; then echo "$0: did not find expected file: $tmpfile.$i" cleanup exit 101 fi j=`cat $tmpfile.$i` if [ "$i" -ne "$j" ]; then echo "$0: unexpected contents in $tmpfile.$i: " \ "expected $i, found $j" cleanup exit 102 fi rm $tmpfile.$i let i=i+1 done exit $status # # 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. # #ident "%Z%%M% %I% %E% SMI" script() { $dtrace -q -o $tmpfile -s /dev/stdin <' exit 2 fi dtrace=$1 tmpfile=/tmp/tst.ftruncate.$$ script status=$? cat $tmpfile rm $tmpfile exit $status 10 11 12 13 14 15 16 17 18 19 /* * 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. */ /* * ASSERTION: Test network byte-ordering routines. */ #include BEGIN { before[0] = 0x1122LL; before[1] = 0x11223344LL; before[2] = 0x1122334455667788LL; #ifdef _LITTLE_ENDIAN after[0] = 0x2211LL; after[1] = 0x44332211LL; after[2] = 0x8877665544332211LL; #else after[0] = 0x1122LL; after[1] = 0x11223344LL; after[2] = 0x1122334455667788LL; #endif } BEGIN /after[0] != htons(before[0])/ { printf("%x rather than %x", htons(before[0]), after[0]); exit(1); } BEGIN /after[0] != ntohs(before[0])/ { printf("%x rather than %x", ntohs(before[0]), after[0]); exit(1); } BEGIN /after[1] != htonl(before[1])/ { printf("%x rather than %x", htonl(before[1]), after[1]); exit(1); } BEGIN /after[1] != ntohl(before[1])/ { printf("%x rather than %x", ntohl(before[1]), after[1]); exit(1); } BEGIN /after[2] != htonll(before[2])/ { printf("%x rather than %x", htonll(before[2]), after[2]); exit(1); } BEGIN /after[2] != ntohll(before[2])/ { printf("%x rather than %x", ntohll(before[2]), after[2]); exit(1); } BEGIN { exit(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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #pragma D option quiet struct { string str; string substr; int haspos; int position; } command[int]; int i; BEGIN { command[i].str = "foobarbaz"; command[i].substr = "barbaz"; i++; command[i].str = "foofoofoo"; command[i].substr = "foo"; i++; command[i].str = "boofoofoo"; command[i].substr = "foo"; i++; command[i].str = "foobarbaz"; command[i].substr = "barbazzy"; i++; command[i].str = "foobar"; command[i].substr = "foobar"; i++; command[i].str = "foobar"; command[i].substr = "foobarbaz"; i++; command[i].str = ""; command[i].substr = "foobar"; i++; command[i].str = "foobar"; command[i].substr = ""; i++; command[i].str = ""; command[i].substr = ""; i++; command[i].str = "foo"; command[i].substr = ""; i++; end = j = k = 0; printf("#!/usr/bin/perl\n\nBEGIN {\n"); } tick-1ms /j < i && end == 0/ { command[i + k].str = command[j].str; command[i + k].substr = command[j].substr; command[i + k].haspos = 1; command[i + k].position = -400; k++; command[i + k].str = command[j].str; command[i + k].substr = command[j].substr; command[i + k].haspos = 1; command[i + k].position = -1; k++; command[i + k].str = command[j].str; command[i + k].substr = command[j].substr; command[i + k].haspos = 1; command[i + k].position = 0; k++; command[i + k].str = command[j].str; command[i + k].substr = command[j].substr; command[i + k].haspos = 1; command[i + k].position = strlen(command[j].str) / 2; k++; command[i + k].str = command[j].str; command[i + k].substr = command[j].substr; command[i + k].haspos = 1; command[i + k].position = strlen(command[j].str); k++; command[i + k].str = command[j].str; command[i + k].substr = command[j].substr; command[i + k].haspos = 1; command[i + k].position = strlen(command[j].str) + 1; k++; command[i + k].str = command[j].str; command[i + k].substr = command[j].substr; command[i + k].haspos = 1; command[i + k].position = strlen(command[j].str) + 2; k++; command[i + k].str = command[j].str; command[i + k].substr = command[j].substr; command[i + k].haspos = 1; command[i + k].position = 400; k++; j++; } tick-1ms /j == i && end == 0/ { end = k; i = 0; } tick-1ms /end != 0 && i < end && !command[i].haspos/ { this->result = index(command[i].str, command[i].substr); printf("\tif (index(\"%s\", \"%s\") != %d) {\n", command[i].str, command[i].substr, this->result); printf("\t\tprintf(\"perl => index(\\\"%s\\\", \\\"%s\\\") = ", command[i].str, command[i].substr); printf("%%d\\n\",\n\t\t index(\"%s\", \"%s\"));\n", command[i].str, command[i].substr); printf("\t\tprintf(\" D => index(\\\"%s\\\", \\\"%s\\\") = ", command[i].str, command[i].substr); printf("%d\\n\");\n", this->result); printf("\t\t$failed++;\n"); printf("\t}\n\n"); } tick-1ms /end != 0 && i < end && !command[i].haspos/ { this->result = rindex(command[i].str, command[i].substr); printf("\tif (rindex(\"%s\", \"%s\") != %d) {\n", command[i].str, command[i].substr, this->result); printf("\t\tprintf(\"perl => rindex(\\\"%s\\\", \\\"%s\\\") = ", command[i].str, command[i].substr); printf("%%d\\n\",\n\t\t rindex(\"%s\", \"%s\"));\n", command[i].str, command[i].substr); printf("\t\tprintf(\" D => rindex(\\\"%s\\\", \\\"%s\\\") = ", command[i].str, command[i].substr); printf("%d\\n\");\n", this->result); printf("\t\t$failed++;\n"); printf("\t}\n\n"); } tick-1ms /end != 0 && i < end && command[i].haspos/ { this->result = index(command[i].str, command[i].substr, command[i].position); printf("\tif (index(\"%s\", \"%s\", %d) != %d) {\n", command[i].str, command[i].substr, command[i].position, this->result); printf("\t\tprintf(\"perl => index(\\\"%s\\\", \\\"%s\\\", %d) = ", command[i].str, command[i].substr, command[i].position); printf("%%d\\n\",\n\t\t index(\"%s\", \"%s\", %d));\n", command[i].str, command[i].substr, command[i].position); printf("\t\tprintf(\" D => index(\\\"%s\\\", \\\"%s\\\", %d) = ", command[i].str, command[i].substr, command[i].position); printf("%d\\n\");\n", this->result); printf("\t\t$failed++;\n"); printf("\t}\n\n"); } tick-1ms /end != 0 && i < end && command[i].haspos/ { this->result = rindex(command[i].str, command[i].substr, command[i].position); printf("\tif (rindex(\"%s\", \"%s\", %d) != %d) {\n", command[i].str, command[i].substr, command[i].position, this->result); printf("\t\tprintf(\"perl => rindex(\\\"%s\\\", \\\"%s\\\", %d) = ", command[i].str, command[i].substr, command[i].position); printf("%%d\\n\",\n\t\t rindex(\"%s\", \"%s\", %d));\n", command[i].str, command[i].substr, command[i].position); printf("\t\tprintf(\" D => rindex(\\\"%s\\\", \\\"%s\\\", %d) = ", command[i].str, command[i].substr, command[i].position); printf("%d\\n\");\n", this->result); printf("\t\t$failed++;\n"); printf("\t}\n\n"); } tick-1ms /end != 0 && ++i == end/ { printf("\texit($failed);\n}\n"); exit(0); } #!/usr/bin/perl BEGIN { if (index("foobarbaz", "barbaz") != 3) { printf("perl => index(\"foobarbaz\", \"barbaz\") = %d\n", index("foobarbaz", "barbaz")); printf(" D => index(\"foobarbaz\", \"barbaz\") = 3\n"); $failed++; } if (rindex("foobarbaz", "barbaz") != 3) { printf("perl => rindex(\"foobarbaz\", \"barbaz\") = %d\n", rindex("foobarbaz", "barbaz")); printf(" D => rindex(\"foobarbaz\", \"barbaz\") = 3\n"); $failed++; } if (index("foofoofoo", "foo") != 0) { printf("perl => index(\"foofoofoo\", \"foo\") = %d\n", index("foofoofoo", "foo")); printf(" D => index(\"foofoofoo\", \"foo\") = 0\n"); $failed++; } if (rindex("foofoofoo", "foo") != 6) { printf("perl => rindex(\"foofoofoo\", \"foo\") = %d\n", rindex("foofoofoo", "foo")); printf(" D => rindex(\"foofoofoo\", \"foo\") = 6\n"); $failed++; } if (index("boofoofoo", "foo") != 3) { printf("perl => index(\"boofoofoo\", \"foo\") = %d\n", index("boofoofoo", "foo")); printf(" D => index(\"boofoofoo\", \"foo\") = 3\n"); $failed++; } if (rindex("boofoofoo", "foo") != 6) { printf("perl => rindex(\"boofoofoo\", \"foo\") = %d\n", rindex("boofoofoo", "foo")); printf(" D => rindex(\"boofoofoo\", \"foo\") = 6\n"); $failed++; } if (index("foobarbaz", "barbazzy") != -1) { printf("perl => index(\"foobarbaz\", \"barbazzy\") = %d\n", index("foobarbaz", "barbazzy")); printf(" D => index(\"foobarbaz\", \"barbazzy\") = -1\n"); $failed++; } if (rindex("foobarbaz", "barbazzy") != -1) { printf("perl => rindex(\"foobarbaz\", \"barbazzy\") = %d\n", rindex("foobarbaz", "barbazzy")); printf(" D => rindex(\"foobarbaz\", \"barbazzy\") = -1\n"); $failed++; } if (index("foobar", "foobar") != 0) { printf("perl => index(\"foobar\", \"foobar\") = %d\n", index("foobar", "foobar")); printf(" D => index(\"foobar\", \"foobar\") = 0\n"); $failed++; } if (rindex("foobar", "foobar") != 0) { printf("perl => rindex(\"foobar\", \"foobar\") = %d\n", rindex("foobar", "foobar")); printf(" D => rindex(\"foobar\", \"foobar\") = 0\n"); $failed++; } if (index("foobar", "foobarbaz") != -1) { printf("perl => index(\"foobar\", \"foobarbaz\") = %d\n", index("foobar", "foobarbaz")); printf(" D => index(\"foobar\", \"foobarbaz\") = -1\n"); $failed++; } if (rindex("foobar", "foobarbaz") != -1) { printf("perl => rindex(\"foobar\", \"foobarbaz\") = %d\n", rindex("foobar", "foobarbaz")); printf(" D => rindex(\"foobar\", \"foobarbaz\") = -1\n"); $failed++; } if (index("", "foobar") != -1) { printf("perl => index(\"\", \"foobar\") = %d\n", index("", "foobar")); printf(" D => index(\"\", \"foobar\") = -1\n"); $failed++; } if (rindex("", "foobar") != -1) { printf("perl => rindex(\"\", \"foobar\") = %d\n", rindex("", "foobar")); printf(" D => rindex(\"\", \"foobar\") = -1\n"); $failed++; } if (index("foobar", "") != 0) { printf("perl => index(\"foobar\", \"\") = %d\n", index("foobar", "")); printf(" D => index(\"foobar\", \"\") = 0\n"); $failed++; } if (rindex("foobar", "") != 6) { printf("perl => rindex(\"foobar\", \"\") = %d\n", rindex("foobar", "")); printf(" D => rindex(\"foobar\", \"\") = 6\n"); $failed++; } if (index("", "") != 0) { printf("perl => index(\"\", \"\") = %d\n", index("", "")); printf(" D => index(\"\", \"\") = 0\n"); $failed++; } if (rindex("", "") != 0) { printf("perl => rindex(\"\", \"\") = %d\n", rindex("", "")); printf(" D => rindex(\"\", \"\") = 0\n"); $failed++; } if (index("foo", "") != 0) { printf("perl => index(\"foo\", \"\") = %d\n", index("foo", "")); printf(" D => index(\"foo\", \"\") = 0\n"); $failed++; } if (rindex("foo", "") != 3) { printf("perl => rindex(\"foo\", \"\") = %d\n", rindex("foo", "")); printf(" D => rindex(\"foo\", \"\") = 3\n"); $failed++; } if (index("foobarbaz", "barbaz", -400) != 3) { printf("perl => index(\"foobarbaz\", \"barbaz\", -400) = %d\n", index("foobarbaz", "barbaz", -400)); printf(" D => index(\"foobarbaz\", \"barbaz\", -400) = 3\n"); $failed++; } if (rindex("foobarbaz", "barbaz", -400) != -1) { printf("perl => rindex(\"foobarbaz\", \"barbaz\", -400) = %d\n", rindex("foobarbaz", "barbaz", -400)); printf(" D => rindex(\"foobarbaz\", \"barbaz\", -400) = -1\n"); $failed++; } if (index("foobarbaz", "barbaz", -1) != 3) { printf("perl => index(\"foobarbaz\", \"barbaz\", -1) = %d\n", index("foobarbaz", "barbaz", -1)); printf(" D => index(\"foobarbaz\", \"barbaz\", -1) = 3\n"); $failed++; } if (rindex("foobarbaz", "barbaz", -1) != -1) { printf("perl => rindex(\"foobarbaz\", \"barbaz\", -1) = %d\n", rindex("foobarbaz", "barbaz", -1)); printf(" D => rindex(\"foobarbaz\", \"barbaz\", -1) = -1\n"); $failed++; } if (index("foobarbaz", "barbaz", 0) != 3) { printf("perl => index(\"foobarbaz\", \"barbaz\", 0) = %d\n", index("foobarbaz", "barbaz", 0)); printf(" D => index(\"foobarbaz\", \"barbaz\", 0) = 3\n"); $failed++; } if (rindex("foobarbaz", "barbaz", 0) != -1) { printf("perl => rindex(\"foobarbaz\", \"barbaz\", 0) = %d\n", rindex("foobarbaz", "barbaz", 0)); printf(" D => rindex(\"foobarbaz\", \"barbaz\", 0) = -1\n"); $failed++; } if (index("foobarbaz", "barbaz", 4) != -1) { printf("perl => index(\"foobarbaz\", \"barbaz\", 4) = %d\n", index("foobarbaz", "barbaz", 4)); printf(" D => index(\"foobarbaz\", \"barbaz\", 4) = -1\n"); $failed++; } if (rindex("foobarbaz", "barbaz", 4) != 3) { printf("perl => rindex(\"foobarbaz\", \"barbaz\", 4) = %d\n", rindex("foobarbaz", "barbaz", 4)); printf(" D => rindex(\"foobarbaz\", \"barbaz\", 4) = 3\n"); $failed++; } if (index("foobarbaz", "barbaz", 9) != -1) { printf("perl => index(\"foobarbaz\", \"barbaz\", 9) = %d\n", index("foobarbaz", "barbaz", 9)); printf(" D => index(\"foobarbaz\", \"barbaz\", 9) = -1\n"); $failed++; } if (rindex("foobarbaz", "barbaz", 9) != 3) { printf("perl => rindex(\"foobarbaz\", \"barbaz\", 9) = %d\n", rindex("foobarbaz", "barbaz", 9)); printf(" D => rindex(\"foobarbaz\", \"barbaz\", 9) = 3\n"); $failed++; } if (index("foobarbaz", "barbaz", 10) != -1) { printf("perl => index(\"foobarbaz\", \"barbaz\", 10) = %d\n", index("foobarbaz", "barbaz", 10)); printf(" D => index(\"foobarbaz\", \"barbaz\", 10) = -1\n"); $failed++; } if (rindex("foobarbaz", "barbaz", 10) != 3) { printf("perl => rindex(\"foobarbaz\", \"barbaz\", 10) = %d\n", rindex("foobarbaz", "barbaz", 10)); printf(" D => rindex(\"foobarbaz\", \"barbaz\", 10) = 3\n"); $failed++; } if (index("foobarbaz", "barbaz", 11) != -1) { printf("perl => index(\"foobarbaz\", \"barbaz\", 11) = %d\n", index("foobarbaz", "barbaz", 11)); printf(" D => index(\"foobarbaz\", \"barbaz\", 11) = -1\n"); $failed++; } if (rindex("foobarbaz", "barbaz", 11) != 3) { printf("perl => rindex(\"foobarbaz\", \"barbaz\", 11) = %d\n", rindex("foobarbaz", "barbaz", 11)); printf(" D => rindex(\"foobarbaz\", \"barbaz\", 11) = 3\n"); $failed++; } if (index("foobarbaz", "barbaz", 400) != -1) { printf("perl => index(\"foobarbaz\", \"barbaz\", 400) = %d\n", index("foobarbaz", "barbaz", 400)); printf(" D => index(\"foobarbaz\", \"barbaz\", 400) = -1\n"); $failed++; } if (rindex("foobarbaz", "barbaz", 400) != 3) { printf("perl => rindex(\"foobarbaz\", \"barbaz\", 400) = %d\n", rindex("foobarbaz", "barbaz", 400)); printf(" D => rindex(\"foobarbaz\", \"barbaz\", 400) = 3\n"); $failed++; } if (index("foofoofoo", "foo", -400) != 0) { printf("perl => index(\"foofoofoo\", \"foo\", -400) = %d\n", index("foofoofoo", "foo", -400)); printf(" D => index(\"foofoofoo\", \"foo\", -400) = 0\n"); $failed++; } if (rindex("foofoofoo", "foo", -400) != -1) { printf("perl => rindex(\"foofoofoo\", \"foo\", -400) = %d\n", rindex("foofoofoo", "foo", -400)); printf(" D => rindex(\"foofoofoo\", \"foo\", -400) = -1\n"); $failed++; } if (index("foofoofoo", "foo", -1) != 0) { printf("perl => index(\"foofoofoo\", \"foo\", -1) = %d\n", index("foofoofoo", "foo", -1)); printf(" D => index(\"foofoofoo\", \"foo\", -1) = 0\n"); $failed++; } if (rindex("foofoofoo", "foo", -1) != -1) { printf("perl => rindex(\"foofoofoo\", \"foo\", -1) = %d\n", rindex("foofoofoo", "foo", -1)); printf(" D => rindex(\"foofoofoo\", \"foo\", -1) = -1\n"); $failed++; } if (index("foofoofoo", "foo", 0) != 0) { printf("perl => index(\"foofoofoo\", \"foo\", 0) = %d\n", index("foofoofoo", "foo", 0)); printf(" D => index(\"foofoofoo\", \"foo\", 0) = 0\n"); $failed++; } if (rindex("foofoofoo", "foo", 0) != 0) { printf("perl => rindex(\"foofoofoo\", \"foo\", 0) = %d\n", rindex("foofoofoo", "foo", 0)); printf(" D => rindex(\"foofoofoo\", \"foo\", 0) = 0\n"); $failed++; } if (index("foofoofoo", "foo", 4) != 6) { printf("perl => index(\"foofoofoo\", \"foo\", 4) = %d\n", index("foofoofoo", "foo", 4)); printf(" D => index(\"foofoofoo\", \"foo\", 4) = 6\n"); $failed++; } if (rindex("foofoofoo", "foo", 4) != 3) { printf("perl => rindex(\"foofoofoo\", \"foo\", 4) = %d\n", rindex("foofoofoo", "foo", 4)); printf(" D => rindex(\"foofoofoo\", \"foo\", 4) = 3\n"); $failed++; } if (index("foofoofoo", "foo", 9) != -1) { printf("perl => index(\"foofoofoo\", \"foo\", 9) = %d\n", index("foofoofoo", "foo", 9)); printf(" D => index(\"foofoofoo\", \"foo\", 9) = -1\n"); $failed++; } if (rindex("foofoofoo", "foo", 9) != 6) { printf("perl => rindex(\"foofoofoo\", \"foo\", 9) = %d\n", rindex("foofoofoo", "foo", 9)); printf(" D => rindex(\"foofoofoo\", \"foo\", 9) = 6\n"); $failed++; } if (index("foofoofoo", "foo", 10) != -1) { printf("perl => index(\"foofoofoo\", \"foo\", 10) = %d\n", index("foofoofoo", "foo", 10)); printf(" D => index(\"foofoofoo\", \"foo\", 10) = -1\n"); $failed++; } if (rindex("foofoofoo", "foo", 10) != 6) { printf("perl => rindex(\"foofoofoo\", \"foo\", 10) = %d\n", rindex("foofoofoo", "foo", 10)); printf(" D => rindex(\"foofoofoo\", \"foo\", 10) = 6\n"); $failed++; } if (index("foofoofoo", "foo", 11) != -1) { printf("perl => index(\"foofoofoo\", \"foo\", 11) = %d\n", index("foofoofoo", "foo", 11)); printf(" D => index(\"foofoofoo\", \"foo\", 11) = -1\n"); $failed++; } if (rindex("foofoofoo", "foo", 11) != 6) { printf("perl => rindex(\"foofoofoo\", \"foo\", 11) = %d\n", rindex("foofoofoo", "foo", 11)); printf(" D => rindex(\"foofoofoo\", \"foo\", 11) = 6\n"); $failed++; } if (index("foofoofoo", "foo", 400) != -1) { printf("perl => index(\"foofoofoo\", \"foo\", 400) = %d\n", index("foofoofoo", "foo", 400)); printf(" D => index(\"foofoofoo\", \"foo\", 400) = -1\n"); $failed++; } if (rindex("foofoofoo", "foo", 400) != 6) { printf("perl => rindex(\"foofoofoo\", \"foo\", 400) = %d\n", rindex("foofoofoo", "foo", 400)); printf(" D => rindex(\"foofoofoo\", \"foo\", 400) = 6\n"); $failed++; } if (index("boofoofoo", "foo", -400) != 3) { printf("perl => index(\"boofoofoo\", \"foo\", -400) = %d\n", index("boofoofoo", "foo", -400)); printf(" D => index(\"boofoofoo\", \"foo\", -400) = 3\n"); $failed++; } if (rindex("boofoofoo", "foo", -400) != -1) { printf("perl => rindex(\"boofoofoo\", \"foo\", -400) = %d\n", rindex("boofoofoo", "foo", -400)); printf(" D => rindex(\"boofoofoo\", \"foo\", -400) = -1\n"); $failed++; } if (index("boofoofoo", "foo", -1) != 3) { printf("perl => index(\"boofoofoo\", \"foo\", -1) = %d\n", index("boofoofoo", "foo", -1)); printf(" D => index(\"boofoofoo\", \"foo\", -1) = 3\n"); $failed++; } if (rindex("boofoofoo", "foo", -1) != -1) { printf("perl => rindex(\"boofoofoo\", \"foo\", -1) = %d\n", rindex("boofoofoo", "foo", -1)); printf(" D => rindex(\"boofoofoo\", \"foo\", -1) = -1\n"); $failed++; } if (index("boofoofoo", "foo", 0) != 3) { printf("perl => index(\"boofoofoo\", \"foo\", 0) = %d\n", index("boofoofoo", "foo", 0)); printf(" D => index(\"boofoofoo\", \"foo\", 0) = 3\n"); $failed++; } if (rindex("boofoofoo", "foo", 0) != -1) { printf("perl => rindex(\"boofoofoo\", \"foo\", 0) = %d\n", rindex("boofoofoo", "foo", 0)); printf(" D => rindex(\"boofoofoo\", \"foo\", 0) = -1\n"); $failed++; } if (index("boofoofoo", "foo", 4) != 6) { printf("perl => index(\"boofoofoo\", \"foo\", 4) = %d\n", index("boofoofoo", "foo", 4)); printf(" D => index(\"boofoofoo\", \"foo\", 4) = 6\n"); $failed++; } if (rindex("boofoofoo", "foo", 4) != 3) { printf("perl => rindex(\"boofoofoo\", \"foo\", 4) = %d\n", rindex("boofoofoo", "foo", 4)); printf(" D => rindex(\"boofoofoo\", \"foo\", 4) = 3\n"); $failed++; } if (index("boofoofoo", "foo", 9) != -1) { printf("perl => index(\"boofoofoo\", \"foo\", 9) = %d\n", index("boofoofoo", "foo", 9)); printf(" D => index(\"boofoofoo\", \"foo\", 9) = -1\n"); $failed++; } if (rindex("boofoofoo", "foo", 9) != 6) { printf("perl => rindex(\"boofoofoo\", \"foo\", 9) = %d\n", rindex("boofoofoo", "foo", 9)); printf(" D => rindex(\"boofoofoo\", \"foo\", 9) = 6\n"); $failed++; } if (index("boofoofoo", "foo", 10) != -1) { printf("perl => index(\"boofoofoo\", \"foo\", 10) = %d\n", index("boofoofoo", "foo", 10)); printf(" D => index(\"boofoofoo\", \"foo\", 10) = -1\n"); $failed++; } if (rindex("boofoofoo", "foo", 10) != 6) { printf("perl => rindex(\"boofoofoo\", \"foo\", 10) = %d\n", rindex("boofoofoo", "foo", 10)); printf(" D => rindex(\"boofoofoo\", \"foo\", 10) = 6\n"); $failed++; } if (index("boofoofoo", "foo", 11) != -1) { printf("perl => index(\"boofoofoo\", \"foo\", 11) = %d\n", index("boofoofoo", "foo", 11)); printf(" D => index(\"boofoofoo\", \"foo\", 11) = -1\n"); $failed++; } if (rindex("boofoofoo", "foo", 11) != 6) { printf("perl => rindex(\"boofoofoo\", \"foo\", 11) = %d\n", rindex("boofoofoo", "foo", 11)); printf(" D => rindex(\"boofoofoo\", \"foo\", 11) = 6\n"); $failed++; } if (index("boofoofoo", "foo", 400) != -1) { printf("perl => index(\"boofoofoo\", \"foo\", 400) = %d\n", index("boofoofoo", "foo", 400)); printf(" D => index(\"boofoofoo\", \"foo\", 400) = -1\n"); $failed++; } if (rindex("boofoofoo", "foo", 400) != 6) { printf("perl => rindex(\"boofoofoo\", \"foo\", 400) = %d\n", rindex("boofoofoo", "foo", 400)); printf(" D => rindex(\"boofoofoo\", \"foo\", 400) = 6\n"); $failed++; } if (index("foobarbaz", "barbazzy", -400) != -1) { printf("perl => index(\"foobarbaz\", \"barbazzy\", -400) = %d\n", index("foobarbaz", "barbazzy", -400)); printf(" D => index(\"foobarbaz\", \"barbazzy\", -400) = -1\n"); $failed++; } if (rindex("foobarbaz", "barbazzy", -400) != -1) { printf("perl => rindex(\"foobarbaz\", \"barbazzy\", -400) = %d\n", rindex("foobarbaz", "barbazzy", -400)); printf(" D => rindex(\"foobarbaz\", \"barbazzy\", -400) = -1\n"); $failed++; } if (index("foobarbaz", "barbazzy", -1) != -1) { printf("perl => index(\"foobarbaz\", \"barbazzy\", -1) = %d\n", index("foobarbaz", "barbazzy", -1)); printf(" D => index(\"foobarbaz\", \"barbazzy\", -1) = -1\n"); $failed++; } if (rindex("foobarbaz", "barbazzy", -1) != -1) { printf("perl => rindex(\"foobarbaz\", \"barbazzy\", -1) = %d\n", rindex("foobarbaz", "barbazzy", -1)); printf(" D => rindex(\"foobarbaz\", \"barbazzy\", -1) = -1\n"); $failed++; } if (index("foobarbaz", "barbazzy", 0) != -1) { printf("perl => index(\"foobarbaz\", \"barbazzy\", 0) = %d\n", index("foobarbaz", "barbazzy", 0)); printf(" D => index(\"foobarbaz\", \"barbazzy\", 0) = -1\n"); $failed++; } if (rindex("foobarbaz", "barbazzy", 0) != -1) { printf("perl => rindex(\"foobarbaz\", \"barbazzy\", 0) = %d\n", rindex("foobarbaz", "barbazzy", 0)); printf(" D => rindex(\"foobarbaz\", \"barbazzy\", 0) = -1\n"); $failed++; } if (index("foobarbaz", "barbazzy", 4) != -1) { printf("perl => index(\"foobarbaz\", \"barbazzy\", 4) = %d\n", index("foobarbaz", "barbazzy", 4)); printf(" D => index(\"foobarbaz\", \"barbazzy\", 4) = -1\n"); $failed++; } if (rindex("foobarbaz", "barbazzy", 4) != -1) { printf("perl => rindex(\"foobarbaz\", \"barbazzy\", 4) = %d\n", rindex("foobarbaz", "barbazzy", 4)); printf(" D => rindex(\"foobarbaz\", \"barbazzy\", 4) = -1\n"); $failed++; } if (index("foobarbaz", "barbazzy", 9) != -1) { printf("perl => index(\"foobarbaz\", \"barbazzy\", 9) = %d\n", index("foobarbaz", "barbazzy", 9)); printf(" D => index(\"foobarbaz\", \"barbazzy\", 9) = -1\n"); $failed++; } if (rindex("foobarbaz", "barbazzy", 9) != -1) { printf("perl => rindex(\"foobarbaz\", \"barbazzy\", 9) = %d\n", rindex("foobarbaz", "barbazzy", 9)); printf(" D => rindex(\"foobarbaz\", \"barbazzy\", 9) = -1\n"); $failed++; } if (index("foobarbaz", "barbazzy", 10) != -1) { printf("perl => index(\"foobarbaz\", \"barbazzy\", 10) = %d\n", index("foobarbaz", "barbazzy", 10)); printf(" D => index(\"foobarbaz\", \"barbazzy\", 10) = -1\n"); $failed++; } if (rindex("foobarbaz", "barbazzy", 10) != -1) { printf("perl => rindex(\"foobarbaz\", \"barbazzy\", 10) = %d\n", rindex("foobarbaz", "barbazzy", 10)); printf(" D => rindex(\"foobarbaz\", \"barbazzy\", 10) = -1\n"); $failed++; } if (index("foobarbaz", "barbazzy", 11) != -1) { printf("perl => index(\"foobarbaz\", \"barbazzy\", 11) = %d\n", index("foobarbaz", "barbazzy", 11)); printf(" D => index(\"foobarbaz\", \"barbazzy\", 11) = -1\n"); $failed++; } if (rindex("foobarbaz", "barbazzy", 11) != -1) { printf("perl => rindex(\"foobarbaz\", \"barbazzy\", 11) = %d\n", rindex("foobarbaz", "barbazzy", 11)); printf(" D => rindex(\"foobarbaz\", \"barbazzy\", 11) = -1\n"); $failed++; } if (index("foobarbaz", "barbazzy", 400) != -1) { printf("perl => index(\"foobarbaz\", \"barbazzy\", 400) = %d\n", index("foobarbaz", "barbazzy", 400)); printf(" D => index(\"foobarbaz\", \"barbazzy\", 400) = -1\n"); $failed++; } if (rindex("foobarbaz", "barbazzy", 400) != -1) { printf("perl => rindex(\"foobarbaz\", \"barbazzy\", 400) = %d\n", rindex("foobarbaz", "barbazzy", 400)); printf(" D => rindex(\"foobarbaz\", \"barbazzy\", 400) = -1\n"); $failed++; } if (index("foobar", "foobar", -400) != 0) { printf("perl => index(\"foobar\", \"foobar\", -400) = %d\n", index("foobar", "foobar", -400)); printf(" D => index(\"foobar\", \"foobar\", -400) = 0\n"); $failed++; } if (rindex("foobar", "foobar", -400) != -1) { printf("perl => rindex(\"foobar\", \"foobar\", -400) = %d\n", rindex("foobar", "foobar", -400)); printf(" D => rindex(\"foobar\", \"foobar\", -400) = -1\n"); $failed++; } if (index("foobar", "foobar", -1) != 0) { printf("perl => index(\"foobar\", \"foobar\", -1) = %d\n", index("foobar", "foobar", -1)); printf(" D => index(\"foobar\", \"foobar\", -1) = 0\n"); $failed++; } if (rindex("foobar", "foobar", -1) != -1) { printf("perl => rindex(\"foobar\", \"foobar\", -1) = %d\n", rindex("foobar", "foobar", -1)); printf(" D => rindex(\"foobar\", \"foobar\", -1) = -1\n"); $failed++; } if (index("foobar", "foobar", 0) != 0) { printf("perl => index(\"foobar\", \"foobar\", 0) = %d\n", index("foobar", "foobar", 0)); printf(" D => index(\"foobar\", \"foobar\", 0) = 0\n"); $failed++; } if (rindex("foobar", "foobar", 0) != 0) { printf("perl => rindex(\"foobar\", \"foobar\", 0) = %d\n", rindex("foobar", "foobar", 0)); printf(" D => rindex(\"foobar\", \"foobar\", 0) = 0\n"); $failed++; } if (index("foobar", "foobar", 3) != -1) { printf("perl => index(\"foobar\", \"foobar\", 3) = %d\n", index("foobar", "foobar", 3)); printf(" D => index(\"foobar\", \"foobar\", 3) = -1\n"); $failed++; } if (rindex("foobar", "foobar", 3) != 0) { printf("perl => rindex(\"foobar\", \"foobar\", 3) = %d\n", rindex("foobar", "foobar", 3)); printf(" D => rindex(\"foobar\", \"foobar\", 3) = 0\n"); $failed++; } if (index("foobar", "foobar", 6) != -1) { printf("perl => index(\"foobar\", \"foobar\", 6) = %d\n", index("foobar", "foobar", 6)); printf(" D => index(\"foobar\", \"foobar\", 6) = -1\n"); $failed++; } if (rindex("foobar", "foobar", 6) != 0) { printf("perl => rindex(\"foobar\", \"foobar\", 6) = %d\n", rindex("foobar", "foobar", 6)); printf(" D => rindex(\"foobar\", \"foobar\", 6) = 0\n"); $failed++; } if (index("foobar", "foobar", 7) != -1) { printf("perl => index(\"foobar\", \"foobar\", 7) = %d\n", index("foobar", "foobar", 7)); printf(" D => index(\"foobar\", \"foobar\", 7) = -1\n"); $failed++; } if (rindex("foobar", "foobar", 7) != 0) { printf("perl => rindex(\"foobar\", \"foobar\", 7) = %d\n", rindex("foobar", "foobar", 7)); printf(" D => rindex(\"foobar\", \"foobar\", 7) = 0\n"); $failed++; } if (index("foobar", "foobar", 8) != -1) { printf("perl => index(\"foobar\", \"foobar\", 8) = %d\n", index("foobar", "foobar", 8)); printf(" D => index(\"foobar\", \"foobar\", 8) = -1\n"); $failed++; } if (rindex("foobar", "foobar", 8) != 0) { printf("perl => rindex(\"foobar\", \"foobar\", 8) = %d\n", rindex("foobar", "foobar", 8)); printf(" D => rindex(\"foobar\", \"foobar\", 8) = 0\n"); $failed++; } if (index("foobar", "foobar", 400) != -1) { printf("perl => index(\"foobar\", \"foobar\", 400) = %d\n", index("foobar", "foobar", 400)); printf(" D => index(\"foobar\", \"foobar\", 400) = -1\n"); $failed++; } if (rindex("foobar", "foobar", 400) != 0) { printf("perl => rindex(\"foobar\", \"foobar\", 400) = %d\n", rindex("foobar", "foobar", 400)); printf(" D => rindex(\"foobar\", \"foobar\", 400) = 0\n"); $failed++; } if (index("foobar", "foobarbaz", -400) != -1) { printf("perl => index(\"foobar\", \"foobarbaz\", -400) = %d\n", index("foobar", "foobarbaz", -400)); printf(" D => index(\"foobar\", \"foobarbaz\", -400) = -1\n"); $failed++; } if (rindex("foobar", "foobarbaz", -400) != -1) { printf("perl => rindex(\"foobar\", \"foobarbaz\", -400) = %d\n", rindex("foobar", "foobarbaz", -400)); printf(" D => rindex(\"foobar\", \"foobarbaz\", -400) = -1\n"); $failed++; } if (index("foobar", "foobarbaz", -1) != -1) { printf("perl => index(\"foobar\", \"foobarbaz\", -1) = %d\n", index("foobar", "foobarbaz", -1)); printf(" D => index(\"foobar\", \"foobarbaz\", -1) = -1\n"); $failed++; } if (rindex("foobar", "foobarbaz", -1) != -1) { printf("perl => rindex(\"foobar\", \"foobarbaz\", -1) = %d\n", rindex("foobar", "foobarbaz", -1)); printf(" D => rindex(\"foobar\", \"foobarbaz\", -1) = -1\n"); $failed++; } if (index("foobar", "foobarbaz", 0) != -1) { printf("perl => index(\"foobar\", \"foobarbaz\", 0) = %d\n", index("foobar", "foobarbaz", 0)); printf(" D => index(\"foobar\", \"foobarbaz\", 0) = -1\n"); $failed++; } if (rindex("foobar", "foobarbaz", 0) != -1) { printf("perl => rindex(\"foobar\", \"foobarbaz\", 0) = %d\n", rindex("foobar", "foobarbaz", 0)); printf(" D => rindex(\"foobar\", \"foobarbaz\", 0) = -1\n"); $failed++; } if (index("foobar", "foobarbaz", 3) != -1) { printf("perl => index(\"foobar\", \"foobarbaz\", 3) = %d\n", index("foobar", "foobarbaz", 3)); printf(" D => index(\"foobar\", \"foobarbaz\", 3) = -1\n"); $failed++; } if (rindex("foobar", "foobarbaz", 3) != -1) { printf("perl => rindex(\"foobar\", \"foobarbaz\", 3) = %d\n", rindex("foobar", "foobarbaz", 3)); printf(" D => rindex(\"foobar\", \"foobarbaz\", 3) = -1\n"); $failed++; } if (index("foobar", "foobarbaz", 6) != -1) { printf("perl => index(\"foobar\", \"foobarbaz\", 6) = %d\n", index("foobar", "foobarbaz", 6)); printf(" D => index(\"foobar\", \"foobarbaz\", 6) = -1\n"); $failed++; } if (rindex("foobar", "foobarbaz", 6) != -1) { printf("perl => rindex(\"foobar\", \"foobarbaz\", 6) = %d\n", rindex("foobar", "foobarbaz", 6)); printf(" D => rindex(\"foobar\", \"foobarbaz\", 6) = -1\n"); $failed++; } if (index("foobar", "foobarbaz", 7) != -1) { printf("perl => index(\"foobar\", \"foobarbaz\", 7) = %d\n", index("foobar", "foobarbaz", 7)); printf(" D => index(\"foobar\", \"foobarbaz\", 7) = -1\n"); $failed++; } if (rindex("foobar", "foobarbaz", 7) != -1) { printf("perl => rindex(\"foobar\", \"foobarbaz\", 7) = %d\n", rindex("foobar", "foobarbaz", 7)); printf(" D => rindex(\"foobar\", \"foobarbaz\", 7) = -1\n"); $failed++; } if (index("foobar", "foobarbaz", 8) != -1) { printf("perl => index(\"foobar\", \"foobarbaz\", 8) = %d\n", index("foobar", "foobarbaz", 8)); printf(" D => index(\"foobar\", \"foobarbaz\", 8) = -1\n"); $failed++; } if (rindex("foobar", "foobarbaz", 8) != -1) { printf("perl => rindex(\"foobar\", \"foobarbaz\", 8) = %d\n", rindex("foobar", "foobarbaz", 8)); printf(" D => rindex(\"foobar\", \"foobarbaz\", 8) = -1\n"); $failed++; } if (index("foobar", "foobarbaz", 400) != -1) { printf("perl => index(\"foobar\", \"foobarbaz\", 400) = %d\n", index("foobar", "foobarbaz", 400)); printf(" D => index(\"foobar\", \"foobarbaz\", 400) = -1\n"); $failed++; } if (rindex("foobar", "foobarbaz", 400) != -1) { printf("perl => rindex(\"foobar\", \"foobarbaz\", 400) = %d\n", rindex("foobar", "foobarbaz", 400)); printf(" D => rindex(\"foobar\", \"foobarbaz\", 400) = -1\n"); $failed++; } if (index("", "foobar", -400) != -1) { printf("perl => index(\"\", \"foobar\", -400) = %d\n", index("", "foobar", -400)); printf(" D => index(\"\", \"foobar\", -400) = -1\n"); $failed++; } if (rindex("", "foobar", -400) != -1) { printf("perl => rindex(\"\", \"foobar\", -400) = %d\n", rindex("", "foobar", -400)); printf(" D => rindex(\"\", \"foobar\", -400) = -1\n"); $failed++; } if (index("", "foobar", -1) != -1) { printf("perl => index(\"\", \"foobar\", -1) = %d\n", index("", "foobar", -1)); printf(" D => index(\"\", \"foobar\", -1) = -1\n"); $failed++; } if (rindex("", "foobar", -1) != -1) { printf("perl => rindex(\"\", \"foobar\", -1) = %d\n", rindex("", "foobar", -1)); printf(" D => rindex(\"\", \"foobar\", -1) = -1\n"); $failed++; } if (index("", "foobar", 0) != -1) { printf("perl => index(\"\", \"foobar\", 0) = %d\n", index("", "foobar", 0)); printf(" D => index(\"\", \"foobar\", 0) = -1\n"); $failed++; } if (rindex("", "foobar", 0) != -1) { printf("perl => rindex(\"\", \"foobar\", 0) = %d\n", rindex("", "foobar", 0)); printf(" D => rindex(\"\", \"foobar\", 0) = -1\n"); $failed++; } if (index("", "foobar", 0) != -1) { printf("perl => index(\"\", \"foobar\", 0) = %d\n", index("", "foobar", 0)); printf(" D => index(\"\", \"foobar\", 0) = -1\n"); $failed++; } if (rindex("", "foobar", 0) != -1) { printf("perl => rindex(\"\", \"foobar\", 0) = %d\n", rindex("", "foobar", 0)); printf(" D => rindex(\"\", \"foobar\", 0) = -1\n"); $failed++; } if (index("", "foobar", 0) != -1) { printf("perl => index(\"\", \"foobar\", 0) = %d\n", index("", "foobar", 0)); printf(" D => index(\"\", \"foobar\", 0) = -1\n"); $failed++; } if (rindex("", "foobar", 0) != -1) { printf("perl => rindex(\"\", \"foobar\", 0) = %d\n", rindex("", "foobar", 0)); printf(" D => rindex(\"\", \"foobar\", 0) = -1\n"); $failed++; } if (index("", "foobar", 1) != -1) { printf("perl => index(\"\", \"foobar\", 1) = %d\n", index("", "foobar", 1)); printf(" D => index(\"\", \"foobar\", 1) = -1\n"); $failed++; } if (rindex("", "foobar", 1) != -1) { printf("perl => rindex(\"\", \"foobar\", 1) = %d\n", rindex("", "foobar", 1)); printf(" D => rindex(\"\", \"foobar\", 1) = -1\n"); $failed++; } if (index("", "foobar", 2) != -1) { printf("perl => index(\"\", \"foobar\", 2) = %d\n", index("", "foobar", 2)); printf(" D => index(\"\", \"foobar\", 2) = -1\n"); $failed++; } if (rindex("", "foobar", 2) != -1) { printf("perl => rindex(\"\", \"foobar\", 2) = %d\n", rindex("", "foobar", 2)); printf(" D => rindex(\"\", \"foobar\", 2) = -1\n"); $failed++; } if (index("", "foobar", 400) != -1) { printf("perl => index(\"\", \"foobar\", 400) = %d\n", index("", "foobar", 400)); printf(" D => index(\"\", \"foobar\", 400) = -1\n"); $failed++; } if (rindex("", "foobar", 400) != -1) { printf("perl => rindex(\"\", \"foobar\", 400) = %d\n", rindex("", "foobar", 400)); printf(" D => rindex(\"\", \"foobar\", 400) = -1\n"); $failed++; } if (index("foobar", "", -400) != 0) { printf("perl => index(\"foobar\", \"\", -400) = %d\n", index("foobar", "", -400)); printf(" D => index(\"foobar\", \"\", -400) = 0\n"); $failed++; } if (rindex("foobar", "", -400) != 0) { printf("perl => rindex(\"foobar\", \"\", -400) = %d\n", rindex("foobar", "", -400)); printf(" D => rindex(\"foobar\", \"\", -400) = 0\n"); $failed++; } if (index("foobar", "", -1) != 0) { printf("perl => index(\"foobar\", \"\", -1) = %d\n", index("foobar", "", -1)); printf(" D => index(\"foobar\", \"\", -1) = 0\n"); $failed++; } if (rindex("foobar", "", -1) != 0) { printf("perl => rindex(\"foobar\", \"\", -1) = %d\n", rindex("foobar", "", -1)); printf(" D => rindex(\"foobar\", \"\", -1) = 0\n"); $failed++; } if (index("foobar", "", 0) != 0) { printf("perl => index(\"foobar\", \"\", 0) = %d\n", index("foobar", "", 0)); printf(" D => index(\"foobar\", \"\", 0) = 0\n"); $failed++; } if (rindex("foobar", "", 0) != 0) { printf("perl => rindex(\"foobar\", \"\", 0) = %d\n", rindex("foobar", "", 0)); printf(" D => rindex(\"foobar\", \"\", 0) = 0\n"); $failed++; } if (index("foobar", "", 3) != 3) { printf("perl => index(\"foobar\", \"\", 3) = %d\n", index("foobar", "", 3)); printf(" D => index(\"foobar\", \"\", 3) = 3\n"); $failed++; } if (rindex("foobar", "", 3) != 3) { printf("perl => rindex(\"foobar\", \"\", 3) = %d\n", rindex("foobar", "", 3)); printf(" D => rindex(\"foobar\", \"\", 3) = 3\n"); $failed++; } if (index("foobar", "", 6) != 6) { printf("perl => index(\"foobar\", \"\", 6) = %d\n", index("foobar", "", 6)); printf(" D => index(\"foobar\", \"\", 6) = 6\n"); $failed++; } if (rindex("foobar", "", 6) != 6) { printf("perl => rindex(\"foobar\", \"\", 6) = %d\n", rindex("foobar", "", 6)); printf(" D => rindex(\"foobar\", \"\", 6) = 6\n"); $failed++; } if (index("foobar", "", 7) != 6) { printf("perl => index(\"foobar\", \"\", 7) = %d\n", index("foobar", "", 7)); printf(" D => index(\"foobar\", \"\", 7) = 6\n"); $failed++; } if (rindex("foobar", "", 7) != 6) { printf("perl => rindex(\"foobar\", \"\", 7) = %d\n", rindex("foobar", "", 7)); printf(" D => rindex(\"foobar\", \"\", 7) = 6\n"); $failed++; } if (index("foobar", "", 8) != 6) { printf("perl => index(\"foobar\", \"\", 8) = %d\n", index("foobar", "", 8)); printf(" D => index(\"foobar\", \"\", 8) = 6\n"); $failed++; } if (rindex("foobar", "", 8) != 6) { printf("perl => rindex(\"foobar\", \"\", 8) = %d\n", rindex("foobar", "", 8)); printf(" D => rindex(\"foobar\", \"\", 8) = 6\n"); $failed++; } if (index("foobar", "", 400) != 6) { printf("perl => index(\"foobar\", \"\", 400) = %d\n", index("foobar", "", 400)); printf(" D => index(\"foobar\", \"\", 400) = 6\n"); $failed++; } if (rindex("foobar", "", 400) != 6) { printf("perl => rindex(\"foobar\", \"\", 400) = %d\n", rindex("foobar", "", 400)); printf(" D => rindex(\"foobar\", \"\", 400) = 6\n"); $failed++; } if (index("", "", -400) != 0) { printf("perl => index(\"\", \"\", -400) = %d\n", index("", "", -400)); printf(" D => index(\"\", \"\", -400) = 0\n"); $failed++; } if (rindex("", "", -400) != 0) { printf("perl => rindex(\"\", \"\", -400) = %d\n", rindex("", "", -400)); printf(" D => rindex(\"\", \"\", -400) = 0\n"); $failed++; } if (index("", "", -1) != 0) { printf("perl => index(\"\", \"\", -1) = %d\n", index("", "", -1)); printf(" D => index(\"\", \"\", -1) = 0\n"); $failed++; } if (rindex("", "", -1) != 0) { printf("perl => rindex(\"\", \"\", -1) = %d\n", rindex("", "", -1)); printf(" D => rindex(\"\", \"\", -1) = 0\n"); $failed++; } if (index("", "", 0) != 0) { printf("perl => index(\"\", \"\", 0) = %d\n", index("", "", 0)); printf(" D => index(\"\", \"\", 0) = 0\n"); $failed++; } if (rindex("", "", 0) != 0) { printf("perl => rindex(\"\", \"\", 0) = %d\n", rindex("", "", 0)); printf(" D => rindex(\"\", \"\", 0) = 0\n"); $failed++; } if (index("", "", 0) != 0) { printf("perl => index(\"\", \"\", 0) = %d\n", index("", "", 0)); printf(" D => index(\"\", \"\", 0) = 0\n"); $failed++; } if (rindex("", "", 0) != 0) { printf("perl => rindex(\"\", \"\", 0) = %d\n", rindex("", "", 0)); printf(" D => rindex(\"\", \"\", 0) = 0\n"); $failed++; } if (index("", "", 0) != 0) { printf("perl => index(\"\", \"\", 0) = %d\n", index("", "", 0)); printf(" D => index(\"\", \"\", 0) = 0\n"); $failed++; } if (rindex("", "", 0) != 0) { printf("perl => rindex(\"\", \"\", 0) = %d\n", rindex("", "", 0)); printf(" D => rindex(\"\", \"\", 0) = 0\n"); $failed++; } if (index("", "", 1) != 0) { printf("perl => index(\"\", \"\", 1) = %d\n", index("", "", 1)); printf(" D => index(\"\", \"\", 1) = 0\n"); $failed++; } if (rindex("", "", 1) != 0) { printf("perl => rindex(\"\", \"\", 1) = %d\n", rindex("", "", 1)); printf(" D => rindex(\"\", \"\", 1) = 0\n"); $failed++; } exit($failed); } /* * 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. */ #pragma D option quiet ipaddr_t *ip4a; ipaddr_t *ip4b; ipaddr_t *ip4c; ipaddr_t *ip4d; BEGIN { this->buf4a = alloca(sizeof (ipaddr_t)); this->buf4b = alloca(sizeof (ipaddr_t)); this->buf4c = alloca(sizeof (ipaddr_t)); this->buf4d = alloca(sizeof (ipaddr_t)); ip4a = this->buf4a; ip4b = this->buf4b; ip4c = this->buf4c; ip4d = this->buf4d; *ip4a = htonl(0xc0a80117); *ip4b = htonl(0x7f000001); *ip4c = htonl(0xffffffff); *ip4d = htonl(0x00000000); printf("%s\n", inet_ntoa(ip4a)); printf("%s\n", inet_ntoa(ip4b)); printf("%s\n", inet_ntoa(ip4c)); printf("%s\n", inet_ntoa(ip4d)); exit(0); } 192.168.1.23 127.0.0.1 255.255.255.255 0.0.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. */ #pragma D option quiet struct in6_addr *ip6a; struct in6_addr *ip6b; struct in6_addr *ip6c; struct in6_addr *ip6d; struct in6_addr *ip6e; struct in6_addr *ip6f; struct in6_addr *ip6g; BEGIN { this->buf6a = alloca(sizeof (struct in6_addr)); this->buf6b = alloca(sizeof (struct in6_addr)); this->buf6c = alloca(sizeof (struct in6_addr)); this->buf6d = alloca(sizeof (struct in6_addr)); this->buf6e = alloca(sizeof (struct in6_addr)); this->buf6f = alloca(sizeof (struct in6_addr)); this->buf6g = alloca(sizeof (struct in6_addr)); ip6a = this->buf6a; ip6b = this->buf6b; ip6c = this->buf6c; ip6d = this->buf6d; ip6e = this->buf6e; ip6f = this->buf6f; ip6g = this->buf6g; ip6a->_S6_un._S6_u8[0] = 0xfe; ip6a->_S6_un._S6_u8[1] = 0x80; ip6a->_S6_un._S6_u8[8] = 0x02; ip6a->_S6_un._S6_u8[9] = 0x14; ip6a->_S6_un._S6_u8[10] = 0x4f; ip6a->_S6_un._S6_u8[11] = 0xff; ip6a->_S6_un._S6_u8[12] = 0xfe; ip6a->_S6_un._S6_u8[13] = 0x0b; ip6a->_S6_un._S6_u8[14] = 0x76; ip6a->_S6_un._S6_u8[15] = 0xc8; ip6b->_S6_un._S6_u8[0] = 0x10; ip6b->_S6_un._S6_u8[1] = 0x80; ip6b->_S6_un._S6_u8[10] = 0x08; ip6b->_S6_un._S6_u8[11] = 0x08; ip6b->_S6_un._S6_u8[13] = 0x20; ip6b->_S6_un._S6_u8[13] = 0x0c; ip6b->_S6_un._S6_u8[14] = 0x41; ip6b->_S6_un._S6_u8[15] = 0x7a; ip6c->_S6_un._S6_u8[15] = 0x01; ip6e->_S6_un._S6_u8[12] = 0x7f; ip6e->_S6_un._S6_u8[15] = 0x01; ip6f->_S6_un._S6_u8[10] = 0xff; ip6f->_S6_un._S6_u8[11] = 0xff; ip6f->_S6_un._S6_u8[12] = 0x7f; ip6f->_S6_un._S6_u8[15] = 0x01; ip6g->_S6_un._S6_u8[10] = 0xff; ip6g->_S6_un._S6_u8[11] = 0xfe; ip6g->_S6_un._S6_u8[12] = 0x7f; ip6g->_S6_un._S6_u8[15] = 0x01; printf("%s\n", inet_ntoa6(ip6a)); printf("%s\n", inet_ntoa6(ip6b)); printf("%s\n", inet_ntoa6(ip6c)); printf("%s\n", inet_ntoa6(ip6d)); printf("%s\n", inet_ntoa6(ip6e)); printf("%s\n", inet_ntoa6(ip6f)); printf("%s\n", inet_ntoa6(ip6g)); exit(0); } fe80::214:4fff:fe0b:76c8 1080::808:c:417a ::1 :: 127.0.0.1 127.0.0.1 ::fffe:7f00:1 /* * 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. */ #pragma D option quiet ipaddr_t *ip4a; ipaddr_t *ip4b; ipaddr_t *ip4c; ipaddr_t *ip4d; struct in6_addr *ip6a; struct in6_addr *ip6b; struct in6_addr *ip6c; struct in6_addr *ip6d; struct in6_addr *ip6e; struct in6_addr *ip6f; struct in6_addr *ip6g; struct in6_addr *ip6h; BEGIN { this->buf4a = alloca(sizeof (ipaddr_t)); this->buf4b = alloca(sizeof (ipaddr_t)); this->buf4c = alloca(sizeof (ipaddr_t)); this->buf4d = alloca(sizeof (ipaddr_t)); this->buf6a = alloca(sizeof (struct in6_addr)); this->buf6b = alloca(sizeof (struct in6_addr)); this->buf6c = alloca(sizeof (struct in6_addr)); this->buf6d = alloca(sizeof (struct in6_addr)); this->buf6e = alloca(sizeof (struct in6_addr)); this->buf6f = alloca(sizeof (struct in6_addr)); this->buf6g = alloca(sizeof (struct in6_addr)); this->buf6h = alloca(sizeof (struct in6_addr)); ip4a = this->buf4a; ip4b = this->buf4b; ip4c = this->buf4c; ip4d = this->buf4d; ip6a = this->buf6a; ip6b = this->buf6b; ip6c = this->buf6c; ip6d = this->buf6d; ip6e = this->buf6e; ip6f = this->buf6f; ip6g = this->buf6g; ip6h = this->buf6h; *ip4a = htonl(0xc0a80117); *ip4b = htonl(0x7f000001); *ip4c = htonl(0xffffffff); *ip4d = htonl(0x00000000); ip6a->_S6_un._S6_u8[0] = 0xfe; ip6a->_S6_un._S6_u8[1] = 0x80; ip6a->_S6_un._S6_u8[8] = 0x02; ip6a->_S6_un._S6_u8[9] = 0x14; ip6a->_S6_un._S6_u8[10] = 0x4f; ip6a->_S6_un._S6_u8[11] = 0xff; ip6a->_S6_un._S6_u8[12] = 0xfe; ip6a->_S6_un._S6_u8[13] = 0x0b; ip6a->_S6_un._S6_u8[14] = 0x76; ip6a->_S6_un._S6_u8[15] = 0xc8; ip6b->_S6_un._S6_u8[0] = 0x10; ip6b->_S6_un._S6_u8[1] = 0x80; ip6b->_S6_un._S6_u8[10] = 0x08; ip6b->_S6_un._S6_u8[11] = 0x08; ip6b->_S6_un._S6_u8[13] = 0x20; ip6b->_S6_un._S6_u8[13] = 0x0c; ip6b->_S6_un._S6_u8[14] = 0x41; ip6b->_S6_un._S6_u8[15] = 0x7a; ip6c->_S6_un._S6_u8[15] = 0x01; ip6e->_S6_un._S6_u8[12] = 0x7f; ip6e->_S6_un._S6_u8[15] = 0x01; ip6f->_S6_un._S6_u8[10] = 0xff; ip6f->_S6_un._S6_u8[11] = 0xff; ip6f->_S6_un._S6_u8[12] = 0x7f; ip6f->_S6_un._S6_u8[15] = 0x01; ip6g->_S6_un._S6_u8[10] = 0xff; ip6g->_S6_un._S6_u8[11] = 0xfe; ip6g->_S6_un._S6_u8[12] = 0x7f; ip6g->_S6_un._S6_u8[15] = 0x01; ip6h->_S6_un._S6_u8[0] = 0xff; ip6h->_S6_un._S6_u8[1] = 0xff; ip6h->_S6_un._S6_u8[2] = 0xff; ip6h->_S6_un._S6_u8[3] = 0xff; ip6h->_S6_un._S6_u8[4] = 0xff; ip6h->_S6_un._S6_u8[5] = 0xff; ip6h->_S6_un._S6_u8[6] = 0xff; ip6h->_S6_un._S6_u8[7] = 0xff; ip6h->_S6_un._S6_u8[8] = 0xff; ip6h->_S6_un._S6_u8[9] = 0xff; ip6h->_S6_un._S6_u8[10] = 0xff; ip6h->_S6_un._S6_u8[11] = 0xff; ip6h->_S6_un._S6_u8[12] = 0xff; ip6h->_S6_un._S6_u8[13] = 0xff; ip6h->_S6_un._S6_u8[14] = 0xff; ip6h->_S6_un._S6_u8[15] = 0xff; printf("%s\n", inet_ntop(AF_INET, ip4a)); printf("%s\n", inet_ntop(AF_INET, ip4b)); printf("%s\n", inet_ntop(AF_INET, ip4c)); printf("%s\n", inet_ntop(AF_INET, ip4d)); printf("%s\n", inet_ntop(AF_INET6, ip6a)); printf("%s\n", inet_ntop(AF_INET6, ip6b)); printf("%s\n", inet_ntop(AF_INET6, ip6c)); printf("%s\n", inet_ntop(AF_INET6, ip6d)); printf("%s\n", inet_ntop(AF_INET6, ip6e)); printf("%s\n", inet_ntop(AF_INET6, ip6f)); printf("%s\n", inet_ntop(AF_INET6, ip6g)); printf("%s\n", inet_ntop(AF_INET6, ip6h)); exit(0); } 192.168.1.23 127.0.0.1 255.255.255.255 0.0.0.0 fe80::214:4fff:fe0b:76c8 1080::808:c:417a ::1 :: ::127.0.0.1 ::ffff:127.0.0.1 ::fffe:7f00:1 ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff /* * 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. */ #pragma D option quiet BEGIN { printf("%s\n", lltostr(0)); printf("%s\n", lltostr(1)); printf("%s\n", lltostr(-1)); printf("%s\n", lltostr(123456789)); printf("%s\n", lltostr(-123456789)); printf("%s\n", lltostr(1LL << 62)); printf("%s\n", lltostr(-(1LL << 62))); exit(0); } 0 1 -1 123456789 -123456789 4611686018427387904 -4611686018427387904 /* * 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 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; } 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(" \n"); } tick-1ms /i < maxval/ { i++; } tick-1ms /i == maxval/ { i = 0; base++; } tick-1ms /base > 40/ { exit(0); } base -2 of -10: base -2 of -1: base -2 of 0: base -2 of 10: base -2 of 100: base -2 of 1000: base -2 of 4611686018427387904: base -1 of -10: base -1 of -1: base -1 of 0: base -1 of 10: base -1 of 100: base -1 of 1000: base -1 of 4611686018427387904: base 0 of -10: base 0 of -1: base 0 of 0: base 0 of 10: base 0 of 100: base 0 of 1000: base 0 of 4611686018427387904: base 1 of -10: base 1 of -1: base 1 of 0: base 1 of 10: base 1 of 100: base 1 of 1000: base 1 of 4611686018427387904: 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: base 37 of -1: base 37 of 0: base 37 of 10: base 37 of 100: base 37 of 1000: base 37 of 4611686018427387904: base 38 of -10: base 38 of -1: base 38 of 0: base 38 of 10: base 38 of 100: base 38 of 1000: base 38 of 4611686018427387904: base 39 of -10: base 39 of -1: base 39 of 0: base 39 of 10: base 39 of 100: base 39 of 1000: base 39 of 4611686018427387904: base 40 of -10: base 40 of -1: base 40 of 0: base 40 of 10: base 40 of 100: base 40 of 1000: base 40 of 4611686018427387904: /* * 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. */ /* * ASSERTION: * mutex_owned() should return a non-zero value if the calling * thread currently holds the mutex. * * SECTION: Actions and Subroutines/mutex_owned() */ #pragma D option quiet lockstat:::adaptive-acquire { this->owned = mutex_owned((kmutex_t *)arg0); this->owner = mutex_owner((kmutex_t *)arg0); } lockstat:::adaptive-acquire /!this->owned/ { printf("mutex_owned() returned 0, expected non-zero\n"); exit(1); } lockstat:::adaptive-acquire /this->owner != curthread/ { printf("current thread is not current owner of owned lock\n"); exit(1); } lockstat:::adaptive-acquire { exit(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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * ASSERTION: * mutex_owner() should return a pointer to the kernel thread holding * the mutex. * * SECTION: Actions and Subroutines/mutex_owner() * * NOTES: This assertion can't be verified so we'll just call it. */ #pragma D option quiet kthread_t *ptr; BEGIN { i = 0; } lockstat:genunix:mutex_enter:adaptive-acquire { ptr = mutex_owner((kmutex_t *)arg0); i++; } tick-1 /i > 5/ { exit(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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * ASSERTION: * mutex_type_adaptive() should return a non-zero value if the * mutex is an adaptive one. * * SECTION: Actions and Subroutines/mutex_type_adaptive() */ #pragma D option quiet BEGIN { i = 0; ret = -99; } mutex_enter:adaptive-acquire { ret = mutex_type_adaptive((kmutex_t *)arg0); i++; } tick-1 /ret == 1/ { exit(0); } tick-1 /i == 100 && ret == 0/ { printf("mutex_type_adaptive returned 0, expected non-zero\n"); exit(1); } tick-1 /i == 100 && ret == -99/ { printf("No adaptive_mutexs called in the time this test was run.\n"); exit(1); } /* * 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. */ /* * ASSERTION: * progenyof() should return non-zero if the pid passed is in the # progeny of the calling process. * * SECTION: Actions and Subroutines/progenyof() * */ #pragma D option quiet BEGIN { res_1 = -1; res_2 = -1; res_3 = -1; res_1 = progenyof($ppid); /* this will always be true */ res_2 = progenyof($ppid + 1); /* this will always be false */ res_3 = progenyof(1); /* this will always be true */ } tick-1 /res_1 > 0 && res_2 == 0 && res_3 > 0/ { exit(0); } tick-1 /res_1 <= 0 || res_2 != 0 || res_3 <= 0/ { exit(1); } /* * 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. */ /* * ASSERTION: Test rand() * * SECTION: Actions and Subroutines/rand() */ BEGIN { i = 0; } tick-1 /i != 10/ { i++; trace(rand()); } tick-1 /i == 10/ { exit(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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #pragma D option quiet BEGIN { str = "fooeyfooeyfoo"; this->success = 0; c = 'f'; printf("strchr(\"%s\", '%c') = \"%s\"\n", str, c, strchr(str, c)); printf("strrchr(\"%s\", '%c') = \"%s\"\n", str, c, strrchr(str, c)); c = 'y'; printf("strchr(\"%s\", '%c') = \"%s\"\n", str, c, strchr(str, c)); printf("strrchr(\"%s\", '%c') = \"%s\"\n", str, c, strrchr(str, c)); printf("strrchr(\"%s\", '%c') = \"%s\"\n", strchr(str, c), c, strrchr(strchr(str, c), c)); this->success = 1; } BEGIN /!this->success/ { exit(1); } BEGIN /strchr(str, 'a') != NULL/ { exit(2); } BEGIN /strrchr(str, 'a') != NULL/ { exit(3); } BEGIN { exit(0); } strchr("fooeyfooeyfoo", 'f') = "fooeyfooeyfoo" strrchr("fooeyfooeyfoo", 'f') = "foo" strchr("fooeyfooeyfoo", 'y') = "yfooeyfoo" strrchr("fooeyfooeyfoo", 'y') = "yfoo" strrchr("yfooeyfoo", 'y') = "yfoo" /* * 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. */ #pragma D option quiet BEGIN { printf("%s\n", strjoin("foo", "baz")); printf("%s\n", strjoin("foo", "")); printf("%s\n", strjoin("", "baz")); printf("%s\n", strjoin("", "")); exit(0); } BEGIN { exit(1); } foobaz foo baz /* * 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. */ #pragma D option quiet BEGIN { str = "foobarbarbazbarbop"; this->success = 0; c = str; printf("strstr(\"%s\", \"%s\") = \"%s\"\n", str, c, strstr(str, c)); c = "baz"; printf("strstr(\"%s\", \"%s\") = \"%s\"\n", str, c, strstr(str, c)); c = "bar"; printf("strstr(\"%s\", \"%s\") = \"%s\"\n", str, c, strstr(str, c)); c = "bazbarbop"; printf("strstr(\"%s\", \"%s\") = \"%s\"\n", str, c, strstr(str, c)); c = "barba"; printf("strstr(\"%s\", \"%s\") = \"%s\"\n", str, c, strstr(str, c)); printf("strstr(\"%s\", \"%s\") = \"%s\"\n", strstr(str, "baz"), strstr(str, "zba"), strstr(strstr(str, "baz"), strstr(str, "zba"))); c = ""; printf("strstr(\"%s\", \"%s\") = \"%s\"\n", str, c, strstr(str, c)); str = ""; printf("strstr(\"%s\", \"%s\") = \"%s\"\n", str, c, strstr(str, c)); str = "f"; c = "f"; printf("strstr(\"%s\", \"%s\") = \"%s\"\n", str, c, strstr(str, c)); this->success = 1; } BEGIN /!this->success/ { exit(1); } BEGIN /strstr(str, "barbarf") != NULL/ { exit(2); } BEGIN /strstr(str, "foobarbarbazbarbopp") != NULL/ { exit(3); } BEGIN { exit(0); } strstr("foobarbarbazbarbop", "foobarbarbazbarbop") = "foobarbarbazbarbop" strstr("foobarbarbazbarbop", "baz") = "bazbarbop" strstr("foobarbarbazbarbop", "bar") = "barbarbazbarbop" strstr("foobarbarbazbarbop", "bazbarbop") = "bazbarbop" strstr("foobarbarbazbarbop", "barba") = "barbarbazbarbop" strstr("bazbarbop", "zbarbop") = "zbarbop" strstr("foobarbarbazbarbop", "") = "foobarbarbazbarbop" strstr("", "") = "" strstr("f", "f") = "f" /* * 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. */ #pragma D option quiet BEGIN { this->str = ",,,Carrots,,Barley,Oatmeal,,,Beans,"; } BEGIN /(this->field = strtok(this->str, ",")) == NULL/ { exit(1); } BEGIN { printf("%s\n", this->field); } BEGIN /(this->field = strtok(NULL, ",")) == NULL/ { exit(2); } BEGIN { printf("%s\n", this->field); } BEGIN /(this->field = strtok(NULL, ",")) == NULL/ { exit(3); } BEGIN { printf("%s\n", this->field); } BEGIN /(this->field = strtok(NULL, ",")) == NULL/ { exit(4); } BEGIN { printf("%s\n", this->field); } BEGIN /(self->a = strtok(NULL, ",")) != NULL/ { printf("unexpected field: %s\n", this->field); exit(5); } struct { string s1; string s2; string result; } command[int]; int i; BEGIN { command[i].s1 = ""; command[i].s2 = ""; command[i].result = ""; i++; command[i].s1 = "foo"; command[i].s2 = ""; command[i].result = command[i].s1; i++; command[i].s1 = "foobar"; command[i].s2 = "o"; command[i].result = "f"; i++; command[i].s1 = "oobar"; command[i].s2 = "o"; command[i].result = "bar"; i++; command[i].s1 = "foo"; command[i].s2 = "bar"; command[i].result = command[i].s1; i++; command[i].s1 = ""; command[i].s2 = "foo"; command[i].result = ""; i++; end = i; i = 0; } tick-1ms /i < end && (this->result = strtok(command[i].s1, command[i].s2)) != command[i].result/ { printf("strtok(\"%s\", \"%s\") = \"%s\", expected \"%s\"", command[i].s1, command[i].s2, this->result != NULL ? this->result : "", command[i].result != NULL ? command[i].result : ""); exit(6 + i); } tick-1ms /++i == end/ { exit(0); } Carrots Barley Oatmeal Beans /* * 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. */ /* * Test that a strtok(NULL, ...) without first calling strtok(string, ...) * produces an error */ BEGIN { trace(strtok(NULL, "!")); exit(1); } ERROR { exit(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 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #pragma D option quiet #pragma D option strsize=32 struct { int index; int length; int nolen; int alt; } command[int]; int i; BEGIN { str = "foobarbazbop"; str2 = ""; altstr = "CRAIG: Positioned them, I don't "; altstr2 = "know... I'm fairly wide guy."; command[i].index = 3; command[i].nolen = 1; i++; command[i].index = 300; command[i].nolen = 1; i++; command[i].index = -10; command[i].nolen = 1; i++; command[i].index = 0; command[i].nolen = 1; i++; command[i].index = 1; command[i].nolen = 1; i++; command[i].index = strlen(str) - 1; command[i].nolen = 1; i++; command[i].index = strlen(str); command[i].nolen = 1; i++; command[i].index = strlen(str) + 1; command[i].nolen = 1; i++; command[i].index = 8; command[i].length = 20; i++; command[i].index = 4; command[i].length = 4; i++; command[i].index = 5; command[i].length = strlen(str) - command[i].index + 1; i++; command[i].index = 5; command[i].length = strlen(str) - command[i].index + 2; i++; command[i].index = 400; command[i].length = 20; i++; command[i].index = 400; command[i].length = 0; i++; command[i].index = 400; command[i].length = -1; i++; command[i].index = 3; command[i].length = 0; i++; command[i].index = 3; command[i].length = -1; i++; command[i].index = 3; command[i].length = -4; i++; command[i].index = 3; command[i].length = -20; i++; command[i].index = -10; command[i].length = -5; i++; command[i].index = 0; command[i].length = 400; i++; command[i].index = -1; command[i].length = 400; i++; command[i].index = -1; command[i].length = 0; i++; command[i].index = -1; command[i].length = -1; i++; command[i].index = -2 * strlen(str); command[i].length = 2 * strlen(str); i++; command[i].index = -2 * strlen(str); command[i].length = strlen(str); i++; command[i].index = -2 * strlen(str); command[i].length = strlen(str) + 1; i++; command[i].index = -1 * strlen(str); command[i].length = strlen(str); i++; command[i].index = -1 * strlen(str); command[i].length = strlen(str) - 1; i++; command[i].index = 100; command[i].length = 10; command[i].alt = 1; i++; command[i].index = 100; command[i].nolen = 1; command[i].alt = 1; i++; end = i; i = 0; printf("#!/usr/bin/perl\n\nBEGIN {\n"); } tick-1ms /i < end && command[i].nolen/ { this->str = command[i].alt ? altstr : str; this->str2 = command[i].alt ? altstr2 : str2; this->result = substr(command[i].alt ? "CRAIG: Positioned them, I don't know... I'm fairly wide guy." : str, command[i].index); printf("\tif (substr(\"%s%s\", %d) ne \"%s\") {\n", this->str, this->str2, command[i].index, this->result); printf("\t\tprintf(\"perl => substr(\\\"%s%s\\\", %d) = ", this->str, this->str2, command[i].index); printf("\\\"%%s\\\"\\n\",\n\t\t substr(\"%s%s\", %d));\n", this->str, this->str2, command[i].index); printf("\t\tprintf(\" D => substr(\\\"%s%s\\\", %d) = ", this->str, this->str2, command[i].index); printf("\\\"%%s\\\"\\n\",\n\t\t \"%s\");\n", this->result); printf("\t\t$failed++;\n"); printf("\t}\n\n"); } tick-1ms /i < end && !command[i].nolen/ { this->str = command[i].alt ? altstr : str; this->str2 = command[i].alt ? altstr2 : str2; this->result = substr(command[i].alt ? "CRAIG: Positioned them, I don't know... I'm fairly wide guy." : str, command[i].index, command[i].length); printf("\tif (substr(\"%s%s\", %d, %d) ne \"%s\") {\n", this->str, this->str2, command[i].index, command[i].length, this->result); printf("\t\tprintf(\"perl => substr(\\\"%s%s\\\", %d, %d) = ", this->str, this->str2, command[i].index, command[i].length); printf("\\\"%%s\\\"\\n\",\n\t\t substr(\"%s%s\", %d, %d));\n", this->str, this->str2, command[i].index, command[i].length); printf("\t\tprintf(\" D => substr(\\\"%s%s\\\", %d, %d) = ", this->str, this->str2, command[i].index, command[i].length); printf("\\\"%%s\\\"\\n\",\n\t\t \"%s\");\n", this->result); printf("\t\t$failed++;\n"); printf("\t}\n\n"); } tick-1ms /++i == end/ { printf("\texit($failed);\n}\n"); exit(0); } #!/usr/bin/perl BEGIN { if (substr("foobarbazbop", 3) ne "barbazbop") { printf("perl => substr(\"foobarbazbop\", 3) = \"%s\"\n", substr("foobarbazbop", 3)); printf(" D => substr(\"foobarbazbop\", 3) = \"%s\"\n", "barbazbop"); $failed++; } if (substr("foobarbazbop", 300) ne "") { printf("perl => substr(\"foobarbazbop\", 300) = \"%s\"\n", substr("foobarbazbop", 300)); printf(" D => substr(\"foobarbazbop\", 300) = \"%s\"\n", ""); $failed++; } if (substr("foobarbazbop", -10) ne "obarbazbop") { printf("perl => substr(\"foobarbazbop\", -10) = \"%s\"\n", substr("foobarbazbop", -10)); printf(" D => substr(\"foobarbazbop\", -10) = \"%s\"\n", "obarbazbop"); $failed++; } if (substr("foobarbazbop", 0) ne "foobarbazbop") { printf("perl => substr(\"foobarbazbop\", 0) = \"%s\"\n", substr("foobarbazbop", 0)); printf(" D => substr(\"foobarbazbop\", 0) = \"%s\"\n", "foobarbazbop"); $failed++; } if (substr("foobarbazbop", 1) ne "oobarbazbop") { printf("perl => substr(\"foobarbazbop\", 1) = \"%s\"\n", substr("foobarbazbop", 1)); printf(" D => substr(\"foobarbazbop\", 1) = \"%s\"\n", "oobarbazbop"); $failed++; } if (substr("foobarbazbop", 11) ne "p") { printf("perl => substr(\"foobarbazbop\", 11) = \"%s\"\n", substr("foobarbazbop", 11)); printf(" D => substr(\"foobarbazbop\", 11) = \"%s\"\n", "p"); $failed++; } if (substr("foobarbazbop", 12) ne "") { printf("perl => substr(\"foobarbazbop\", 12) = \"%s\"\n", substr("foobarbazbop", 12)); printf(" D => substr(\"foobarbazbop\", 12) = \"%s\"\n", ""); $failed++; } if (substr("foobarbazbop", 13) ne "") { printf("perl => substr(\"foobarbazbop\", 13) = \"%s\"\n", substr("foobarbazbop", 13)); printf(" D => substr(\"foobarbazbop\", 13) = \"%s\"\n", ""); $failed++; } if (substr("foobarbazbop", 8, 20) ne "zbop") { printf("perl => substr(\"foobarbazbop\", 8, 20) = \"%s\"\n", substr("foobarbazbop", 8, 20)); printf(" D => substr(\"foobarbazbop\", 8, 20) = \"%s\"\n", "zbop"); $failed++; } if (substr("foobarbazbop", 4, 4) ne "arba") { printf("perl => substr(\"foobarbazbop\", 4, 4) = \"%s\"\n", substr("foobarbazbop", 4, 4)); printf(" D => substr(\"foobarbazbop\", 4, 4) = \"%s\"\n", "arba"); $failed++; } if (substr("foobarbazbop", 5, 8) ne "rbazbop") { printf("perl => substr(\"foobarbazbop\", 5, 8) = \"%s\"\n", substr("foobarbazbop", 5, 8)); printf(" D => substr(\"foobarbazbop\", 5, 8) = \"%s\"\n", "rbazbop"); $failed++; } if (substr("foobarbazbop", 5, 9) ne "rbazbop") { printf("perl => substr(\"foobarbazbop\", 5, 9) = \"%s\"\n", substr("foobarbazbop", 5, 9)); printf(" D => substr(\"foobarbazbop\", 5, 9) = \"%s\"\n", "rbazbop"); $failed++; } if (substr("foobarbazbop", 400, 20) ne "") { printf("perl => substr(\"foobarbazbop\", 400, 20) = \"%s\"\n", substr("foobarbazbop", 400, 20)); printf(" D => substr(\"foobarbazbop\", 400, 20) = \"%s\"\n", ""); $failed++; } if (substr("foobarbazbop", 400, 0) ne "") { printf("perl => substr(\"foobarbazbop\", 400, 0) = \"%s\"\n", substr("foobarbazbop", 400, 0)); printf(" D => substr(\"foobarbazbop\", 400, 0) = \"%s\"\n", ""); $failed++; } if (substr("foobarbazbop", 400, -1) ne "") { printf("perl => substr(\"foobarbazbop\", 400, -1) = \"%s\"\n", substr("foobarbazbop", 400, -1)); printf(" D => substr(\"foobarbazbop\", 400, -1) = \"%s\"\n", ""); $failed++; } if (substr("foobarbazbop", 3, 0) ne "") { printf("perl => substr(\"foobarbazbop\", 3, 0) = \"%s\"\n", substr("foobarbazbop", 3, 0)); printf(" D => substr(\"foobarbazbop\", 3, 0) = \"%s\"\n", ""); $failed++; } if (substr("foobarbazbop", 3, -1) ne "barbazbo") { printf("perl => substr(\"foobarbazbop\", 3, -1) = \"%s\"\n", substr("foobarbazbop", 3, -1)); printf(" D => substr(\"foobarbazbop\", 3, -1) = \"%s\"\n", "barbazbo"); $failed++; } if (substr("foobarbazbop", 3, -4) ne "barba") { printf("perl => substr(\"foobarbazbop\", 3, -4) = \"%s\"\n", substr("foobarbazbop", 3, -4)); printf(" D => substr(\"foobarbazbop\", 3, -4) = \"%s\"\n", "barba"); $failed++; } if (substr("foobarbazbop", 3, -20) ne "") { printf("perl => substr(\"foobarbazbop\", 3, -20) = \"%s\"\n", substr("foobarbazbop", 3, -20)); printf(" D => substr(\"foobarbazbop\", 3, -20) = \"%s\"\n", ""); $failed++; } if (substr("foobarbazbop", -10, -5) ne "obarb") { printf("perl => substr(\"foobarbazbop\", -10, -5) = \"%s\"\n", substr("foobarbazbop", -10, -5)); printf(" D => substr(\"foobarbazbop\", -10, -5) = \"%s\"\n", "obarb"); $failed++; } if (substr("foobarbazbop", 0, 400) ne "foobarbazbop") { printf("perl => substr(\"foobarbazbop\", 0, 400) = \"%s\"\n", substr("foobarbazbop", 0, 400)); printf(" D => substr(\"foobarbazbop\", 0, 400) = \"%s\"\n", "foobarbazbop"); $failed++; } if (substr("foobarbazbop", -1, 400) ne "p") { printf("perl => substr(\"foobarbazbop\", -1, 400) = \"%s\"\n", substr("foobarbazbop", -1, 400)); printf(" D => substr(\"foobarbazbop\", -1, 400) = \"%s\"\n", "p"); $failed++; } if (substr("foobarbazbop", -1, 0) ne "") { printf("perl => substr(\"foobarbazbop\", -1, 0) = \"%s\"\n", substr("foobarbazbop", -1, 0)); printf(" D => substr(\"foobarbazbop\", -1, 0) = \"%s\"\n", ""); $failed++; } if (substr("foobarbazbop", -1, -1) ne "") { printf("perl => substr(\"foobarbazbop\", -1, -1) = \"%s\"\n", substr("foobarbazbop", -1, -1)); printf(" D => substr(\"foobarbazbop\", -1, -1) = \"%s\"\n", ""); $failed++; } if (substr("foobarbazbop", -24, 24) ne "foobarbazbop") { printf("perl => substr(\"foobarbazbop\", -24, 24) = \"%s\"\n", substr("foobarbazbop", -24, 24)); printf(" D => substr(\"foobarbazbop\", -24, 24) = \"%s\"\n", "foobarbazbop"); $failed++; } if (substr("foobarbazbop", -24, 12) ne "") { printf("perl => substr(\"foobarbazbop\", -24, 12) = \"%s\"\n", substr("foobarbazbop", -24, 12)); printf(" D => substr(\"foobarbazbop\", -24, 12) = \"%s\"\n", ""); $failed++; } if (substr("foobarbazbop", -24, 13) ne "f") { printf("perl => substr(\"foobarbazbop\", -24, 13) = \"%s\"\n", substr("foobarbazbop", -24, 13)); printf(" D => substr(\"foobarbazbop\", -24, 13) = \"%s\"\n", "f"); $failed++; } if (substr("foobarbazbop", -12, 12) ne "foobarbazbop") { printf("perl => substr(\"foobarbazbop\", -12, 12) = \"%s\"\n", substr("foobarbazbop", -12, 12)); printf(" D => substr(\"foobarbazbop\", -12, 12) = \"%s\"\n", "foobarbazbop"); $failed++; } if (substr("foobarbazbop", -12, 11) ne "foobarbazbo") { printf("perl => substr(\"foobarbazbop\", -12, 11) = \"%s\"\n", substr("foobarbazbop", -12, 11)); printf(" D => substr(\"foobarbazbop\", -12, 11) = \"%s\"\n", "foobarbazbo"); $failed++; } if (substr("CRAIG: Positioned them, I don't know... I'm fairly wide guy.", 100, 10) ne "") { printf("perl => substr(\"CRAIG: Positioned them, I don't know... I'm fairly wide guy.\", 100, 10) = \"%s\"\n", substr("CRAIG: Positioned them, I don't know... I'm fairly wide guy.", 100, 10)); printf(" D => substr(\"CRAIG: Positioned them, I don't know... I'm fairly wide guy.\", 100, 10) = \"%s\"\n", ""); $failed++; } if (substr("CRAIG: Positioned them, I don't know... I'm fairly wide guy.", 100) ne "") { printf("perl => substr(\"CRAIG: Positioned them, I don't know... I'm fairly wide guy.\", 100) = \"%s\"\n", substr("CRAIG: Positioned them, I don't know... I'm fairly wide guy.", 100)); printf(" D => substr(\"CRAIG: Positioned them, I don't know... I'm fairly wide guy.\", 100) = \"%s\"\n", ""); $failed++; } exit($failed); } /* * 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 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #pragma D option quiet #pragma D option aggsortkey /* * This is to check that we're correctly null-terminating the result of the * substr() subroutine. */ tick-1ms /i++ > 1000/ { exit(0); } tick-1ms { @[substr((i & 1) ? "Bryan is smart" : "he's not a dummy", 0, (i & 1) ? 8 : 18)] = count(); } END { printa("%s\n", @); } Bryan is he's not a dummy /* * 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. */ #pragma D option quiet #pragma D option destructive BEGIN { this->a = 9; this->b = -2; system("echo %s %d %d", "foo", this->a, this->b); system("ping localhost"); system("echo %d", ++this->a); system("ping localhost"); system("echo %d", ++this->a); system("ping localhost"); system("echo %d", ++this->a); exit(0); } foo 9 -2 localhost is alive 10 localhost is alive 11 localhost is alive 12 /* * 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] = " Nase-5"; expected[i++] = " nase-5"; input[i] = "!@#$%"; expected[i++] = "!@#$%"; i = 0; } 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); } /* * 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); } /* * 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. */ /* * ASSERTION: * & can not be applied to a non-lvalue * * SECTION: Pointers and Arrays/Pointers and Addresses * */ BEGIN { trace(&1); exit(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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * ASSERTION: Test the "empty translation unit" error path. * * SECTION: Program Structure/Probe Clauses and Declarations * */ /* * 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. */ /* * ASSERTION: Test the kinds of probe definition clause grammar rules. * * SECTION: Program Structure/Probe Clauses and Declarations; * Program Structure/Actions */ BEGIN {} BEGIN /1/ {} tick-1 { exit(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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * ASSERTION: Test the various kinds of D probe description statement * rules in the grammar. * * SECTION: Program Structure/Probe Descriptions * */ BEGIN { i = 0; } tick-1 /i != 20/ { i++; x = 0; stack(); @a = count(); @b = max(x); @c[x] = count(); @d[x] = max(x); } tick-1 /i = 20/ { exit(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 (c) 2011, Joyent Inc. All rights reserved. # Use is subject to license terms. # # # This test verifies that we only use the first entry of a file with a given # name in the library path # if [ $# != 1 ]; then echo expected one argument: '<'dtrace-path'>' exit 2 fi firstinc=${TMPDIR:-/tmp}/firstinc.$$ secondinc=${TMPDIR:-/tmp}/secondinc.$$ expexit=23 setup_include() { mkdir $firstinc mkdir $secondinc cat > $firstinc/lib.d < $secondinc/lib.d <(curthread->t_procp); /* * 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. */ /* * ASSERTION: * Declare different types of inline data types. * * SECTION: Type and Constant Definitions/Inlines * * NOTES: The commented lines defining floats and doubles should be uncommented * once the functionality is provided. * */ #pragma D option quiet inline char new_char = 'c'; inline short new_short = 10; inline int new_int = 100; inline long new_long = 1234567890; inline long long new_long_long = 1234512345; inline int8_t new_int8 = 'p'; inline int16_t new_int16 = 20; inline int32_t new_int32 = 200; inline int64_t new_int64 = 2000000; inline intptr_t new_intptr = 0x12345; inline uint8_t new_uint8 = 'q'; inline uint16_t new_uint16 = 30; inline uint32_t new_uint32 = 300; inline uint64_t new_uint64 = 3000000; inline uintptr_t new_uintptr = 0x67890; /* inline float new_float = 1.23456; inline double new_double = 2.34567890; inline long double new_long_double = 3.567890123; */ inline int * pointer = &`kmem_flags; BEGIN { exit(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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * ASSERTION: * * Test different inline assignments by various expressions. * * SECTION: Type and Constant Definitions/Inlines * * NOTES: The commented lines for the floats and doubles should be uncommented * once the functionality is implemented. * */ #pragma D option quiet inline char new_char = 'c' + 2; inline short new_short = 10 * new_char; inline int new_int = 100 + new_short; inline long new_long = 1234567890; inline long long new_long_long = 1234512345 * new_long; inline int8_t new_int8 = 'p'; inline int16_t new_int16 = 20 / new_int8; inline int32_t new_int32 = 200; inline int64_t new_int64 = 2000000 * (-new_int16); inline intptr_t new_intptr = 0x12345 - 129; inline uint8_t new_uint8 = 'q'; inline uint16_t new_uint16 = 30 - new_uint8; inline uint32_t new_uint32 = 300 - 0; inline uint64_t new_uint64 = 3000000; inline uintptr_t new_uintptr = 0x67890 / new_uint64; /* inline float new_float = 1.23456; inline double new_double = 2.34567890; inline long double new_long_double = 3.567890123; */ inline int * pointer = &`kmem_flags; inline int result = 3 > 2 ? 3 : 2; BEGIN { printf("new_char: %c\nnew_short: %d\nnew_int: %d\nnew_long: %d\n", new_char, new_short, new_int, new_long); printf("new_long_long: %d\nnew_int8: %d\nnew_int16: %d\n", new_long_long, new_int8, new_int16); printf("new_int32: %d\nnew_int64: %d\n", new_int32, new_int64); printf("new_intptr: %d\nnew_uint8: %d\nnew_uint16: %d\n", new_intptr, new_uint8, new_uint16); printf("new_uint32:%d\nnew_uint64: %d\nnew_uintptr:%d\nresult:%d", new_uint32, new_uint64, new_uintptr, result); exit(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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * Test the code generation and results of the various kinds of inlines. * In particular, we test constant and expression-based scalar inlines, * associative array inlines, and inlines using translators. */ #pragma D option quiet inline int i0 = 100 + 23; /* constant-folded integer constant */ inline string i1 = probename; /* string variable reference */ inline int i2 = pid != 0; /* expression involving a variable */ struct s { int s_x; }; translator struct s < int T > { s_x = T + 1; }; inline struct s i3 = xlate < struct s > (i0); /* translator */ inline int i4[int x, int y] = x + y; /* associative array */ inline int i5[int x] = (xlate < struct s > (x)).s_x; /* array by xlate */ BEGIN { printf("i0 = %d\n", i0); printf("i1 = %s\n", i1); printf("i2 = %d\n", i2); printf("i3.s_x = %d\n", i3.s_x); printf("i4[10, 20] = %d\n", i4[10, 20]); printf("i5[123] = %d\n", i5[123]); exit(0); } i0 = 123 i1 = BEGIN i2 = 1 i3.s_x = 124 i4[10, 20] = 30 i5[123] = 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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * ASSERTION: * Create inline names from aliases created using typedef. * * SECTION: Type and Constant Definitions/Inlines * * NOTES: * */ #pragma D option quiet typedef char new_char; inline new_char char_var = 'c'; typedef int * pointer; inline pointer p = &`kmem_flags; BEGIN { printf("char_var: %c\npointer p: %d", char_var, *p); exit(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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * ASSERTION: * Create inline names from aliases created using typedef. * * SECTION: Type and Constant Definitions/Inlines */ #pragma D option quiet struct record { char c; int i; }; struct record rec1; inline struct record rec2 = rec1; union var { char c; int i; }; union var un1; inline union var un2 = un1; BEGIN { rec1.c = 'c'; rec1.i = 10; un1.c = 'd'; printf("rec1.c: %c\nrec1.i:%d\nun1.c: %c\n", rec1.c, rec1.i, un1.c); printf("rec2.c: %c\nrec2.i:%d\nun2.c: %c\n", rec2.c, rec2.i, un2.c); exit(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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #include #include #include #include #include #include #include static sigjmp_buf env; static void interrupt(int sig) { siglongjmp(env, sig); } int main(int argc, char *argv[]) { const char *file = "/dev/null"; int i, n, fds[10]; struct sigaction act; if (argc > 1) { (void) fprintf(stderr, "Usage: %s\n", argv[0]); return (EXIT_FAILURE); } act.sa_handler = interrupt; act.sa_flags = 0; (void) sigemptyset(&act.sa_mask); (void) sigaction(SIGUSR1, &act, NULL); closefrom(0); n = 0; /* * With all of our file descriptors closed, wait here spinning in bogus * ioctl() calls until DTrace hits us with a SIGUSR1 to start the test. */ if (sigsetjmp(env, 1) == 0) { for (;;) (void) ioctl(-1, -1, NULL); } /* * To test the fds[] array, we open /dev/null (a file with reliable * pathname and properties) using various flags and seek offsets. */ fds[n++] = open(file, O_RDONLY); fds[n++] = open(file, O_WRONLY); fds[n++] = open(file, O_RDWR); fds[n++] = open(file, O_RDWR | O_APPEND | O_CREAT | O_DSYNC | O_LARGEFILE | O_NOCTTY | O_NONBLOCK | O_NDELAY | O_RSYNC | O_SYNC | O_TRUNC | O_XATTR); fds[n++] = open(file, O_RDWR); (void) lseek(fds[n - 1], 123, SEEK_SET); /* * Once we have all the file descriptors in the state we want to test, * issue a bogus ioctl() on each fd with cmd -1 and arg NULL to whack * our DTrace script into recording the content of the fds[] array. */ for (i = 0; i < n; i++) (void) ioctl(fds[i], -1, NULL); assert(n <= sizeof (fds) / sizeof (fds[0])); exit(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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #pragma D option destructive #pragma D option quiet syscall::ioctl:entry /pid == $1 && arg0 == -1u/ { raise(SIGUSR1); /* kick tst.fds.c out of its busy-wait loop */ } syscall::ioctl:entry /pid == $1 && arg0 != -1u && arg1 == -1u && arg2 == NULL/ { printf("fds[%d] fi_name = %s\n", arg0, fds[arg0].fi_name); printf("fds[%d] fi_dirname = %s\n", arg0, fds[arg0].fi_dirname); printf("fds[%d] fi_pathname = %s\n", arg0, fds[arg0].fi_pathname); printf("fds[%d] fi_fs = %s\n", arg0, fds[arg0].fi_fs); printf("fds[%d] fi_mount = %s\n", arg0, fds[arg0].fi_mount); printf("fds[%d] fi_offset = %d\n", arg0, fds[arg0].fi_offset); printf("fds[%d] fi_oflags = 0x%x\n", arg0, fds[arg0].fi_oflags); } proc:::exit /pid == $1/ { exit(0); } fds[0] fi_name = mm@0:null fds[0] fi_dirname = /devices/pseudo fds[0] fi_pathname = /devices/pseudo/mm@0:null fds[0] fi_fs = specfs fds[0] fi_mount = /devices fds[0] fi_offset = 0 fds[0] fi_oflags = 0x0 fds[1] fi_name = mm@0:null fds[1] fi_dirname = /devices/pseudo fds[1] fi_pathname = /devices/pseudo/mm@0:null fds[1] fi_fs = specfs fds[1] fi_mount = /devices fds[1] fi_offset = 0 fds[1] fi_oflags = 0x1 fds[2] fi_name = mm@0:null fds[2] fi_dirname = /devices/pseudo fds[2] fi_pathname = /devices/pseudo/mm@0:null fds[2] fi_fs = specfs fds[2] fi_mount = /devices fds[2] fi_offset = 0 fds[2] fi_oflags = 0x2 fds[3] fi_name = mm@0:null fds[3] fi_dirname = /devices/pseudo fds[3] fi_pathname = /devices/pseudo/mm@0:null fds[3] fi_fs = specfs fds[3] fi_mount = /devices fds[3] fi_offset = 0 fds[3] fi_oflags = 0xebda fds[4] fi_name = mm@0:null fds[4] fi_dirname = /devices/pseudo fds[4] fi_pathname = /devices/pseudo/mm@0:null fds[4] fi_fs = specfs fds[4] fi_mount = /devices fds[4] fi_offset = 123 fds[4] fi_oflags = 0x2 #!/usr/bin/perl -w # # 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 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # # get.ipv4remote.pl [tcpport] # # Find an IPv4 reachable remote host using both ifconfig(8) and ping(8). # If a tcpport is specified, return a host that is also listening on this # TCP port. Print the local address and the remote address, or an # error message if no suitable remote host was found. Exit status is 0 if # a host was found. # use strict; use IO::Socket; my $MAXHOSTS = 32; # max hosts to port scan my $TIMEOUT = 3; # connection timeout my $tcpport = @ARGV == 1 ? $ARGV[0] : 0; # # Determine local IP address # my $local = ""; my $remote = ""; my %Broadcast; my $up; open IFCONFIG, '/sbin/ifconfig -a |' or die "Couldn't run ifconfig: $!\n"; while () { next if /^lo/; # "UP" is always printed first (see print_flags() in ifconfig.c): $up = 1 if /^[a-z].*) { if (/bytes from (.*): / and not defined $Broadcast{$1}) { my $addr = $1; if ($tcpport != 0) { # # Test TCP # my $socket = IO::Socket::INET->new( Proto => "tcp", PeerAddr => $addr, PeerPort => $tcpport, Timeout => $TIMEOUT, ); next unless $socket; close $socket; } $remote = $addr; last; } } close PING; die "Can't find a remote host for testing: No suitable response from " . "$Broadcast{$local}\n" if $remote eq ""; print "$local $remote\n"; #!/usr/bin/perl -w # # 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 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # # get.ipv6remote.pl # # Find an IPv6 reachable remote host using both ifconfig(8) and ping(8). # Print the local address and the remote address, or print nothing if either # no IPv6 interfaces or remote hosts were found. (Remote IPv6 testing is # considered optional, and so not finding another IPv6 host is not an error # state we need to log.) Exit status is 0 if a host was found. # use strict; use IO::Socket; my $MAXHOSTS = 32; # max hosts to scan my $TIMEOUT = 3; # connection timeout my $MULTICAST = "FF02::1"; # IPv6 multicast address # # Determine local IP address # my $local = ""; my $remote = ""; my %Local; my $up; open IFCONFIG, '/sbin/ifconfig -a inet6 |' or die "Couldn't run ifconfig: $!\n"; while () { next if /^lo/; # "UP" is always printed first (see print_flags() in ifconfig.c): $up = 1 if /^[a-z].*) { if (/bytes from (.*): / and not defined $Local{$1}) { $remote = $1; last; } } close PING; exit 2 if $remote eq ""; print "$local $remote\n"; /* * This file and its contents are supplied under the terms of the * Common Development and Distribution License ("CDDL"), version 1.0. * You may only use this file in accordance with the terms of version * 1.0 of the CDDL. * * A full copy of the text of the CDDL should have accompanied this * source. A copy of the CDDL is also available via the Internet at * http://www.illumos.org/license/CDDL. */ /* * Copyright 2025 Oxide Computer Company */ /* * This is a mini/silent version of netcat. It's used by a few of the networking * tests in this folder to make sure we exercise a full TCP state machine by * calling shutdown(SHUT_RD) specifically to make sure that we can hit the * TCPS_LAST_ACK state. * * It basically sets up an event port and tracks attempting to: * * - Connect to a target source * - Read some data from the target source (but doesn't care how much) * - Call shutdown for read * - Close the socket * * We put a 5 second timeout on all of these as an arbitrary threshold. */ #include #include #include #include #include #include #include #include uint32_t timeout_sec = 5; const char *hello = "Hello World"; static void msnc_wait(int port, int sock, int event) { port_event_t pe; timespec_t ts; if (port_associate(port, PORT_SOURCE_FD, sock, event, NULL) != 0) { err(EXIT_FAILURE, "failed to associate for event 0x%x", event); } ts.tv_sec = (time_t)timeout_sec; ts.tv_nsec = 0; if (port_get(port, &pe, &ts) != 0) { err(EXIT_FAILURE, "failed to wait for event 0x%x", event); } VERIFY3U(pe.portev_source, ==, PORT_SOURCE_FD); VERIFY3U(pe.portev_object, ==, sock); if ((pe.portev_events & event) == 0) { err(EXIT_FAILURE, "got events we weren't going to handle: " "0x%x, wanted 0x%x", event, event); } } int main(int argc, char *argv[]) { int ret, cerr, sock, eport; struct addrinfo *res, hints; socklen_t sz = sizeof (cerr); uint8_t buf[16]; if (argc != 3) { (void) fprintf(stderr, "missing required arguments\n"); errx(EXIT_FAILURE, "msnc: Usage "); } (void) memset(&hints, 0, sizeof (struct addrinfo)); hints.ai_flags = AI_NUMERICHOST | AI_ADDRCONFIG; hints.ai_family = PF_UNSPEC; hints.ai_socktype = SOCK_STREAM; if ((ret = getaddrinfo(argv[1], argv[2], &hints, &res)) != 0) { errx(EXIT_FAILURE, "failed to resolve %s: %s", argv[1], gai_strerror(ret)); } sock = socket(res->ai_family, res->ai_socktype | SOCK_NONBLOCK, res->ai_protocol); if (sock < 0) { err(EXIT_FAILURE, "failed to create socket"); } eport = port_create(); if (eport < 0) { err(EXIT_FAILURE, "failed to create event port"); } ret = connect(sock, res->ai_addr, res->ai_addrlen); if (ret != 0 && errno != EINPROGRESS && errno != EINTR) { err(EXIT_FAILURE, "failed to connect to %s:%s\n", argv[1], argv[2]); } msnc_wait(eport, sock, POLLOUT); if (getsockopt(sock, SOL_SOCKET, SO_ERROR, &cerr, &sz) != 0) { err(EXIT_FAILURE, "failed to get connection status sockopt"); } if (write(sock, hello, strlen(hello)) < 0) { err(EXIT_FAILURE, "failed to write any data to the socket"); } /* * Read some bytes, the exact quantity doesn't matter. But before that * perform our shutdown() to help get the state machine in motion. */ msnc_wait(eport, sock, POLLIN); if (shutdown(sock, SHUT_WR) != 0) { err(EXIT_FAILURE, "failed to shutdown write side socket"); } if (read(sock, buf, sizeof (buf)) < 0) { err(EXIT_FAILURE, "failed to read any data from remote side"); } VERIFY0(close(sock)); VERIFY0(close(eport)); return (EXIT_SUCCESS); } #!/usr/bin/ksh # # 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 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # # Test ip:::{send,receive} of IPv4 ICMP to a local address. # # This may fail due to: # # 1. A change to the ip stack breaking expected probe behavior, # which is the reason we are testing. # 2. The lo0 interface missing or not up. # 3. Unrelated ICMP on lo0 traced by accident. # if (( $# != 1 )); then print -u2 "expected one argument: " exit 2 fi dtrace=$1 local=127.0.0.1 $dtrace -c "/sbin/ping -D $local 3" -qs /dev/stdin <ip_saddr == "$local" && args[2]->ip_daddr == "$local" && args[4]->ipv4_protocol == IPPROTO_ICMP/ { printf("1 ip:::send ("); printf("args[2]: %d %d, ", args[2]->ip_ver, args[2]->ip_plength); printf("args[4]: %d %d %d %d %d)\n", args[4]->ipv4_ver, args[4]->ipv4_length, args[4]->ipv4_flags, args[4]->ipv4_offset, args[4]->ipv4_ttl); } ip:::receive /args[2]->ip_saddr == "$local" && args[2]->ip_daddr == "$local" && args[4]->ipv4_protocol == IPPROTO_ICMP/ { printf("2 ip:::receive ("); printf("args[2]: %d %d, ", args[2]->ip_ver, args[2]->ip_plength); printf("args[4]: %d %d %d %d %d)\n", args[4]->ipv4_ver, args[4]->ipv4_length, args[4]->ipv4_flags, args[4]->ipv4_offset, args[4]->ipv4_ttl); } EOF 1 ip:::send (args[2]: 4 64, args[4]: 4 84 2 0 255) 1 ip:::send (args[2]: 4 64, args[4]: 4 84 2 0 255) 2 ip:::receive (args[2]: 4 64, args[4]: 4 84 2 0 255) 2 ip:::receive (args[2]: 4 64, args[4]: 4 84 2 0 255) 127.0.0.1 is alive #!/usr/bin/ksh # # 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) 2008, 2010, Oracle and/or its affiliates. All rights reserved. # # # Test {ip,tcp}:::{send,receive} of IPv4 TCP to local host. # # This may fail due to: # # 1. A change to the ip stack breaking expected probe behavior, # which is the reason we are testing. # 2. The lo0 interface missing or not up. # 3. The local ssh service is not online. # 4. An unlikely race causes the unlocked global send/receive # variables to be corrupted. # # This test performs a TCP connection and checks that at least the # following packet counts were traced: # # 3 x ip:::send (2 during the TCP handshake, then a FIN) # 3 x tcp:::send (2 during the TCP handshake, then a FIN) # 2 x ip:::receive (1 during the TCP handshake, then the FIN ACK) # 2 x tcp:::receive (1 during the TCP handshake, then the FIN ACK) # The actual count tested is 5 each way, since we are tracing both # source and destination events. # # For this test to work, we are assuming that the TCP handshake and # TCP close will enter the IP code path and not use tcp fusion. # if (( $# != 1 )); then print -u2 "expected one argument: " exit 2 fi dtrace=$1 local=127.0.0.1 tcpport=22 DIR=/var/tmp/dtest.$$ mkdir $DIR cd $DIR cat > test.pl <<-EOPERL use IO::Socket; my \$s = IO::Socket::INET->new( Proto => "tcp", PeerAddr => "$local", PeerPort => $tcpport, Timeout => 3); die "Could not connect to host $local port $tcpport" unless \$s; close \$s; # # Sleep for one second to assure that our D script has ample time to # see all events induced by the close # sleep 1; EOPERL $dtrace -c 'perl test.pl' -qs /dev/stdin <ip_saddr == "$local" && args[2]->ip_daddr == "$local" && args[4]->ipv4_protocol == IPPROTO_TCP/ { ipsend++; } tcp:::send /args[2]->ip_saddr == "$local" && args[2]->ip_daddr == "$local"/ { tcpsend++; } ip:::receive /args[2]->ip_saddr == "$local" && args[2]->ip_daddr == "$local" && args[4]->ipv4_protocol == IPPROTO_TCP/ { ipreceive++; } tcp:::receive /args[2]->ip_saddr == "$local" && args[2]->ip_daddr == "$local"/ { tcpreceive++; } END { printf("Minimum TCP events seen\n\n"); printf("ip:::send - %s\n", ipsend >= 5 ? "yes" : "no"); printf("ip:::receive - %s\n", ipreceive >= 5 ? "yes" : "no"); printf("tcp:::send - %s\n", tcpsend >= 5 ? "yes" : "no"); printf("tcp:::receive - %s\n", tcpreceive >= 5 ? "yes" : "no"); } EODTRACE status=$? cd / /bin/rm -rf $DIR exit $status Minimum TCP events seen ip:::send - yes ip:::receive - yes tcp:::send - yes tcp:::receive - yes #!/usr/bin/ksh # # 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) 2008, 2010, Oracle and/or its affiliates. All rights reserved. # # # Test ip:::{send,receive} of IPv4 UDP to a local address. # # This may fail due to: # # 1. A change to the ip stack breaking expected probe behavior, # which is the reason we are testing. # 2. No physical network interface is plumbed and up. # 3. No other hosts on this subnet are reachable and listening on rpcbind. # 4. An unlikely race causes the unlocked global send/receive # variables to be corrupted. # # This test sends a UDP message using ping and checks that at least the # following counts were traced: # # 1 x ip:::send (UDP sent to ping's base UDP port) # 1 x udp:::send (UDP sent to ping's base UDP port) # 1 x ip:::receive (UDP received) # # No udp:::receive event is expected as the response ping -U elicits is # an ICMP PORT_UNREACHABLE response rather than a UDP packet, and locally # the echo request UDP packet only reaches IP, so the udp:::receive probe # is not triggered by it. # if (( $# != 1 )); then print -u2 "expected one argument: " exit 2 fi dtrace=$1 local=127.0.0.1 $dtrace -c "/sbin/ping -U $local" -qs /dev/stdin <ip_saddr == "$local" && args[2]->ip_daddr == "$local" && args[4]->ipv4_protocol == IPPROTO_UDP/ { ipsend++; } udp:::send /args[2]->ip_saddr == "$local" && args[2]->ip_daddr == "$local"/ { udpsend++; } ip:::receive /args[2]->ip_saddr == "$local" && args[2]->ip_daddr == "$local" && args[4]->ipv4_protocol == IPPROTO_UDP/ { ipreceive++; } END { printf("Minimum UDP events seen\n\n"); printf("ip:::send - %s\n", ipsend >= 1 ? "yes" : "no"); printf("ip:::receive - %s\n", ipreceive >= 1 ? "yes" : "no"); printf("udp:::send - %s\n", udpsend >= 1 ? "yes" : "no"); } EOF Minimum UDP events seen ip:::send - yes ip:::receive - yes udp:::send - yes #!/usr/bin/ksh # # 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 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # # Test ip:::{send,receive} of IPv4 ICMP to a remote host. # # This may fail due to: # # 1. A change to the ip stack breaking expected probe behavior, # which is the reason we are testing. # 2. No physical network interface is plumbed and up. # 3. No other hosts on this subnet are reachable. # 4. An unrelated ICMP between these hosts was traced by accident. # if (( $# != 1 )); then print -u2 "expected one argument: " exit 2 fi dtrace=$1 getaddr=./get.ipv4remote.pl if [[ ! -x $getaddr ]]; then print -u2 "could not find or execute sub program: $getaddr" exit 3 fi $getaddr | read source dest if (( $? != 0 )); then exit 4 fi $dtrace -c "/sbin/ping -D $dest 3" -qs /dev/stdin <ip_saddr == "$source" && args[2]->ip_daddr == "$dest" && args[4]->ipv4_protocol == IPPROTO_ICMP/ { printf("1 ip:::send ("); printf("args[2]: %d %d, ", args[2]->ip_ver, args[2]->ip_plength); printf("args[4]: %d %d %d %d %d)\n", args[4]->ipv4_ver, args[4]->ipv4_length, args[4]->ipv4_flags, args[4]->ipv4_offset, args[4]->ipv4_ttl); } ip:::receive /args[2]->ip_saddr == "$dest" && args[2]->ip_daddr == "$source" && args[4]->ipv4_protocol == IPPROTO_ICMP/ { printf("2 ip:::receive ("); printf("args[2]: %d %d, ", args[2]->ip_ver, args[2]->ip_plength); printf("args[4]: %d %d %d %d %d)\n", args[4]->ipv4_ver, args[4]->ipv4_length, args[4]->ipv4_flags, args[4]->ipv4_offset, args[4]->ipv4_ttl); } EOF 1 ip:::send (args[2]: 4 64, args[4]: 4 84 2 0 255) 2 ip:::receive (args[2]: 4 64, args[4]: 4 84 2 0 255) #!/usr/bin/ksh # # 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) 2008, 2010, Oracle and/or its affiliates. All rights reserved. # Copyright 2025 Oxide computer Company # # # Test {tcp,ip}:::{send,receive} of IPv4 TCP to a remote host. # # This may fail due to: # # 1. A change to the ip stack breaking expected probe behavior, # which is the reason we are testing. # 2. No physical network interface is plumbed and up. # 3. No other hosts on this subnet are reachable and listening on ssh. # 4. An unlikely race causes the unlocked global send/receive # variables to be corrupted. # # This test performs a TCP connection and checks that at least the # following packet counts were traced: # # 3 x ip:::send (2 during the TCP handshake, then a FIN) # 3 x tcp:::send (2 during the TCP handshake, then a FIN) # 2 x ip:::receive (1 during the TCP handshake, then the FIN ACK) # 2 x tcp:::receive (1 during the TCP handshake, then the FIN ACK) # if (( $# != 1 )); then print -u2 "expected one argument: " exit 2 fi dtrace=$1 getaddr=./get.ipv4remote.pl tcpport=22 if [[ ! -x $getaddr ]]; then print -u2 "could not find or execute sub program: $getaddr" exit 3 fi $getaddr $tcpport | read source dest if (( $? != 0 )); then exit 4 fi $dtrace -c "./msnc.exe $dest $tcpport" -qs /dev/stdin <ip_saddr == "$source" && args[2]->ip_daddr == "$dest" && args[4]->ipv4_protocol == IPPROTO_TCP/ { ipsend++; } tcp:::send /args[2]->ip_saddr == "$source" && args[2]->ip_daddr == "$dest"/ { tcpsend++; } ip:::receive /args[2]->ip_saddr == "$dest" && args[2]->ip_daddr == "$source" && args[4]->ipv4_protocol == IPPROTO_TCP/ { ipreceive++; } tcp:::receive /args[2]->ip_saddr == "$dest" && args[2]->ip_daddr == "$source"/ { tcpreceive++; } END { printf("Minimum TCP events seen\n\n"); printf("ip:::send - %s\n", ipsend >= 3 ? "yes" : "no"); printf("ip:::receive - %s\n", ipreceive >= 2 ? "yes" : "no"); printf("tcp:::send - %s\n", tcpsend >= 3 ? "yes" : "no"); printf("tcp:::receive - %s\n", tcpreceive >= 2 ? "yes" : "no"); } EODTRACE status=$? exit $? Minimum TCP events seen ip:::send - yes ip:::receive - yes tcp:::send - yes tcp:::receive - yes #!/usr/bin/ksh # # 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) 2008, 2010, Oracle and/or its affiliates. All rights reserved. # # # Test {udp,ip}:::{send,receive} of IPv4 UDP to a remote host. # # This may fail due to: # # 1. A change to the ip stack breaking expected probe behavior, # which is the reason we are testing. # 2. No physical network interface is plumbed and up. # 3. No other hosts on this subnet are reachable and listening on rpcbind. # 4. An unlikely race causes the unlocked global send/receive # variables to be corrupted. # # This test sends a UDP message using ping and checks that at least the # following counts were traced: # # 1 x ip:::send (UDP sent to ping's base UDP port) # 1 x udp:::send (UDP sent to ping's base UDP port) # if (( $# != 1 )); then print -u2 "expected one argument: " exit 2 fi dtrace=$1 getaddr=./get.ipv4remote.pl if [[ ! -x $getaddr ]]; then print -u2 "could not find or execute sub program: $getaddr" exit 3 fi $getaddr | read source dest if (( $? != 0 )); then exit 4 fi $dtrace -c "/sbin/ping -U $dest" -qs /dev/stdin <ip_saddr == "$source" && args[2]->ip_daddr == "$dest" && args[4]->ipv4_protocol == IPPROTO_UDP/ { ipsend++; } udp:::send /args[2]->ip_saddr == "$source" && args[2]->ip_daddr == "$dest"/ { udpsend++; } END { printf("Minimum UDP events seen\n\n"); printf("ip:::send - %s\n", ipsend >= 1 ? "yes" : "no"); printf("udp:::send - %s\n", udpsend >= 1 ? "yes" : "no"); } EOF Minimum UDP events seen ip:::send - yes udp:::send - yes #!/usr/bin/ksh # # 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 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # # Test ip:::{send,receive} of IPv6 ICMP to a local address. This creates a # temporary lo0/inet6 interface if one doesn't already exist. # # This may fail due to: # # 1. A change to the ip stack breaking expected probe behavior, # which is the reason we are testing. # 2. Unrelated ICMPv6 on lo0 traced by accident. # if (( $# != 1 )); then print -u2 "expected one argument: " exit 2 fi dtrace=$1 local=::1 if ! ifconfig lo0 inet6 > /dev/null 2>&1; then if ! ifconfig lo0 inet6 plumb up; then print -u2 "could not plumb lo0 inet6 for testing" exit 3 fi removeinet6=1 else removeinet6=0 fi $dtrace -c "/sbin/ping -A inet6 $local 3" -qs /dev/stdin <ip_saddr == "$local" && args[2]->ip_daddr == "$local" && args[5]->ipv6_nexthdr == IPPROTO_ICMPV6/ { printf("1 ip:::send ("); printf("args[2]: %d %d, ", args[2]->ip_ver, args[2]->ip_plength); printf("args[5]: %d %d %d)\n", args[5]->ipv6_ver, args[5]->ipv6_tclass, args[5]->ipv6_plen); } ip:::receive /args[2]->ip_saddr == "$local" && args[2]->ip_daddr == "$local" && args[5]->ipv6_nexthdr == IPPROTO_ICMPV6/ { printf("2 ip:::receive ("); printf("args[2]: %d %d, ", args[2]->ip_ver, args[2]->ip_plength); printf("args[5]: %d %d %d)\n", args[5]->ipv6_ver, args[5]->ipv6_tclass, args[5]->ipv6_plen); } EOF if (( removeinet6 )); then ifconfig lo0 inet6 unplumb fi ::1 is alive 1 ip:::send (args[2]: 6 64, args[5]: 6 0 64) 1 ip:::send (args[2]: 6 64, args[5]: 6 0 64) 2 ip:::receive (args[2]: 6 64, args[5]: 6 0 64) 2 ip:::receive (args[2]: 6 64, args[5]: 6 0 64) #!/usr/bin/ksh # # 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 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # # Test ip:::{send,receive} of IPv6 ICMP to a remote host. This test is # skipped if there are no physical interfaces configured with IPv6, or no # other IPv6 hosts are reachable. # # This may fail due to: # # 1. A change to the ip stack breaking expected probe behavior, # which is the reason we are testing. # 2. An unrelated ICMPv6 between these hosts was traced by accident. # if (( $# != 1 )); then print -u2 "expected one argument: " exit 2 fi dtrace=$1 getaddr=./get.ipv6remote.pl if [[ ! -x $getaddr ]]; then print -u2 "could not find or execute sub program: $getaddr" exit 3 fi $getaddr | read source dest if (( $? != 0 )); then print -nu2 "Could not find a local IPv6 interface and a remote IPv6 " print -u2 "host. Aborting test.\n" print -nu2 "For this test to continue, a \"ping -ns -A inet6 FF02::1\" " print -u2 "must respond with a\nremote IPv6 host." exit 3 fi # # Shake loose any ICMPv6 Neighbor advertisement messages before tracing. # /sbin/ping $dest 3 > /dev/null 2>&1 $dtrace -c "/sbin/ping $dest 3" -qs /dev/stdin <ip_daddr == "$dest" && args[5]->ipv6_nexthdr == IPPROTO_ICMPV6/ { printf("1 ip:::send ("); printf("args[2]: %d %d, ", args[2]->ip_ver, args[2]->ip_plength); printf("args[5]: %d %d %d)\n", args[5]->ipv6_ver, args[5]->ipv6_tclass, args[5]->ipv6_plen); } ip:::receive /args[2]->ip_saddr == "$dest" && args[5]->ipv6_nexthdr == IPPROTO_ICMPV6/ { printf("2 ip:::receive ("); printf("args[2]: %d %d, ", args[2]->ip_ver, args[2]->ip_plength); printf("args[5]: %d %d %d)\n", args[5]->ipv6_ver, args[5]->ipv6_tclass, args[5]->ipv6_plen); } EOF 1 ip:::send (args[2]: 6 64, args[5]: 6 0 64) 2 ip:::receive (args[2]: 6 64, args[5]: 6 0 64) #!/usr/bin/ksh # # 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) 2010, Oracle and/or its affiliates. All rights reserved. # Copyright 2025 Oxide computer Company # # # Test tcp:::state-change and tcp:::{send,receive} by connecting to # the local ssh service and sending a test message. This should result # in a "Protocol mismatch" response and a close of the connection. # A number of state transition events along with tcp fusion send and # receive events for the message should result. # # This may fail due to: # # 1. A change to the ip stack breaking expected probe behavior, # which is the reason we are testing. # 2. The lo0 interface missing or not up. # 3. The local ssh service is not online. # 4. An unlikely race causes the unlocked global send/receive # variables to be corrupted. # # This test performs a TCP connection to the ssh service (port 22) and # checks that at least the following packet counts were traced: # # 3 x ip:::send (2 during the TCP handshake, then a FIN) # 4 x tcp:::send (2 during the TCP handshake, 1 message then a FIN) # 2 x ip:::receive (1 during the TCP handshake, then the FIN ACK) # 3 x tcp:::receive (1 during the TCP handshake, 1 message then the FIN ACK) # # The actual ip count tested is 5 each way, since we are tracing both # source and destination events. The actual tcp count tested is 7 # each way, since the TCP fusion send/receive events will not reach IP. # # For this test to work, we are assuming that the TCP handshake and # TCP close will enter the IP code path and not use tcp fusion. # if (( $# != 1 )); then print -u2 "expected one argument: " exit 2 fi dtrace=$1 local=127.0.0.1 tcpport=12345 nc -l $local $tcpport >/dev/null & child=$! $dtrace -c "./msnc.exe $local $tcpport" -qs /dev/stdin <ip_saddr == "$local" && args[2]->ip_daddr == "$local" && args[4]->ipv4_protocol == IPPROTO_TCP/ { ipsend++; } tcp:::send /args[2]->ip_saddr == "$local" && args[2]->ip_daddr == "$local" && (args[4]->tcp_sport == $tcpport || args[4]->tcp_dport == $tcpport)/ { tcpsend++; } ip:::receive /args[2]->ip_saddr == "$local" && args[2]->ip_daddr == "$local" && args[4]->ipv4_protocol == IPPROTO_TCP/ { ipreceive++; } tcp:::receive /args[2]->ip_saddr == "$local" && args[2]->ip_daddr == "$local" && (args[4]->tcp_sport == $tcpport || args[4]->tcp_dport == $tcpport)/ { tcpreceive++; } tcp:::state-change { state_event[args[3]->tcps_state]++; } tcp:::connect-request /args[2]->ip_saddr == "$local" && args[2]->ip_daddr == "$local" && args[4]->tcp_dport == $tcpport/ { connreq++; } tcp:::connect-established /args[2]->ip_saddr == "$local" && args[2]->ip_daddr == "$local" && args[4]->tcp_sport == $tcpport/ { connest++; } tcp:::accept-established /args[2]->ip_saddr == "$local" && args[2]->ip_daddr == "$local" && args[4]->tcp_dport == $tcpport/ { connaccept++; } END { printf("Minimum TCP events seen\n\n"); printf("ip:::send - %s\n", ipsend >= 5 ? "yes" : "no"); printf("ip:::receive - %s\n", ipreceive >= 5 ? "yes" : "no"); printf("tcp:::send - %s\n", tcpsend >= 7 ? "yes" : "no"); printf("tcp:::receive - %s\n", tcpreceive >= 7 ? "yes" : "no"); printf("tcp:::state-change to syn-sent - %s\n", state_event[TCP_STATE_SYN_SENT] >=1 ? "yes" : "no"); printf("tcp:::state-change to syn-received - %s\n", state_event[TCP_STATE_SYN_RECEIVED] >=1 ? "yes" : "no"); printf("tcp:::state-change to established - %s\n", state_event[TCP_STATE_ESTABLISHED] >= 2 ? "yes" : "no"); printf("tcp:::state-change to fin-wait-1 - %s\n", state_event[TCP_STATE_FIN_WAIT_1] >= 1 ? "yes" : "no"); printf("tcp:::state-change to close-wait - %s\n", state_event[TCP_STATE_CLOSE_WAIT] >= 1 ? "yes" : "no"); printf("tcp:::state-change to fin-wait-2 - %s\n", state_event[TCP_STATE_FIN_WAIT_2] >= 1 ? "yes" : "no"); printf("tcp:::state-change to last-ack - %s\n", state_event[TCP_STATE_LAST_ACK] >= 1 ? "yes" : "no"); printf("tcp:::state-change to time-wait - %s\n", state_event[TCP_STATE_TIME_WAIT] >= 1 ? "yes" : "no"); printf("tcp:::connect-request - %s\n", connreq >=1 ? "yes" : "no"); printf("tcp:::connect-established - %s\n", connest >=1 ? "yes" : "no"); printf("tcp:::accept-established - %s\n", connaccept >=1 ? "yes" : "no"); } EODTRACE status=$? exit $status Minimum TCP events seen ip:::send - yes ip:::receive - yes tcp:::send - yes tcp:::receive - yes tcp:::state-change to syn-sent - yes tcp:::state-change to syn-received - yes tcp:::state-change to established - yes tcp:::state-change to fin-wait-1 - yes tcp:::state-change to close-wait - yes tcp:::state-change to fin-wait-2 - yes tcp:::state-change to last-ack - yes tcp:::state-change to time-wait - yes tcp:::connect-request - yes tcp:::connect-established - yes tcp:::accept-established - yes #!/usr/bin/ksh # # 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) 2010, Oracle and/or its affiliates. All rights reserved. # # # Test tcp:::state-change and tcp:::{send,receive} by connecting to # the remote ssh service and sending a test message. This should result # in a "Protocol mismatch" response and a close of the connection. # A number of state transition events along with tcp send and receive # events for the message should result. # # This may fail due to: # # 1. A change to the ip stack breaking expected probe behavior, # which is the reason we are testing. # 2. The lo0 interface missing or not up. # 3. The remote ssh service is not online. # 4. An unlikely race causes the unlocked global send/receive # variables to be corrupted. # # This test performs a TCP connection to the ssh service (port 22) and # checks that at least the following packet counts were traced: # # 4 x ip:::send (2 during the TCP handshake, the message, then a FIN) # 4 x tcp:::send (2 during the TCP handshake, the messages, then a FIN) # 3 x ip:::receive (1 during the TCP handshake, the response, then the FIN ACK) # 3 x tcp:::receive (1 during the TCP handshake, the response, then the FIN ACK) # # For this test to work, we are assuming that the TCP handshake and # TCP close will enter the IP code path and not use tcp fusion. # if (( $# != 1 )); then print -u2 "expected one argument: " exit 2 fi dtrace=$1 getaddr=./get.ipv4remote.pl tcpport=22 DIR=/var/tmp/dtest.$$ if [[ ! -x $getaddr ]]; then print -u2 "could not find or execute sub program: $getaddr" exit 3 fi $getaddr $tcpport | read source dest if (( $? != 0 )); then exit 4 fi mkdir $DIR cd $DIR cat > test.pl <<-EOPERL use IO::Socket; my \$s = IO::Socket::INET->new( Proto => "tcp", PeerAddr => "$dest", PeerPort => $tcpport, Timeout => 3); die "Could not connect to host $dest port $tcpport" unless \$s; print \$s "testing state machine transitions"; close \$s; EOPERL $dtrace -c 'perl test.pl' -qs /dev/stdin <ip_saddr == "$source" && args[2]->ip_daddr == "$dest" && args[4]->ipv4_protocol == IPPROTO_TCP/ { ipsend++; } tcp:::send /args[2]->ip_saddr == "$source" && args[2]->ip_daddr == "$dest" && args[4]->tcp_dport == $tcpport/ { tcpsend++; } ip:::receive /args[2]->ip_saddr == "$dest" && args[2]->ip_daddr == "$source" && args[4]->ipv4_protocol == IPPROTO_TCP/ { ipreceive++; } tcp:::receive /args[2]->ip_saddr == "$dest" && args[2]->ip_daddr == "$source" && args[4]->tcp_sport == $tcpport/ { tcpreceive++; } tcp:::state-change { state_event[args[3]->tcps_state]++; } tcp:::connect-request /args[2]->ip_saddr == "$source" && args[2]->ip_daddr == "$dest" && args[4]->tcp_dport == $tcpport/ { connreq++; } tcp:::connect-established /args[2]->ip_saddr == "$dest" && args[2]->ip_daddr == "$source" && args[4]->tcp_sport == $tcpport/ { connest++; } END { printf("Minimum TCP events seen\n\n"); printf("ip:::send - %s\n", ipsend >= 4 ? "yes" : "no"); printf("ip:::receive - %s\n", ipreceive >= 3 ? "yes" : "no"); printf("tcp:::send - %s\n", tcpsend >= 4 ? "yes" : "no"); printf("tcp:::receive - %s\n", tcpreceive >= 3 ? "yes" : "no"); printf("tcp:::state-change to syn-sent - %s\n", state_event[TCP_STATE_SYN_SENT] >=1 ? "yes" : "no"); printf("tcp:::state-change to established - %s\n", state_event[TCP_STATE_ESTABLISHED] >= 1 ? "yes" : "no"); printf("tcp:::state-change to fin-wait-1 - %s\n", state_event[TCP_STATE_FIN_WAIT_1] >= 1 ? "yes" : "no"); printf("tcp:::state-change to fin-wait-2 - %s\n", state_event[TCP_STATE_FIN_WAIT_2] >= 1 ? "yes" : "no"); printf("tcp:::state-change to time-wait - %s\n", state_event[TCP_STATE_TIME_WAIT] >= 1 ? "yes" : "no"); printf("tcp:::connect-request - %s\n", connreq >=1 ? "yes" : "no"); printf("tcp:::connect-established - %s\n", connest >=1 ? "yes" : "no"); } EODTRACE status=$? cd / /bin/rm -rf $DIR exit $status Minimum TCP events seen ip:::send - yes ip:::receive - yes tcp:::send - yes tcp:::receive - yes tcp:::state-change to syn-sent - yes tcp:::state-change to established - yes tcp:::state-change to fin-wait-1 - yes tcp:::state-change to close-wait - yes tcp:::state-change to fin-wait-2 - yes tcp:::state-change to time-wait - yes tcp:::connect-request - yes tcp:::connect-established - yes # # 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 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # include $(SRC)/Makefile.master ROOTOPTPKG = $(ROOT)/opt/SUNWdtrt JAR_DSTDIR = $(ROOTOPTPKG)/tst/common/java_api JAR_SRCDIR = $(SRC)/cmd/dtrace/test/tst/common/java_api # Use the proto dtrace.jar if it exists, otherwise use whatever is # installed on the system. It should be possible to build # usr/src/cmd/dtrace/test independently, even if only on systems that # have a compatible dtrace.jar installed. DTRACE_JAR=usr/share/lib/java/dtrace.jar PROTO_DTRACE_JAR=$(ROOT)/$(DTRACE_JAR) INSTALLED_DTRACE_JAR=/$(DTRACE_JAR) CLASSPATH=$(PROTO_DTRACE_JAR):$(INSTALLED_DTRACE_JAR) SRCDIR=src CLASSDIR=classes MANIFESTDIR=manifest MANIFEST=$(MANIFESTDIR)/test.jar-manifest TEST_JAR=$(JAR_SRCDIR)/test.jar PROTO_TEST_JAR=$(JAR_DSTDIR)/test.jar default: $(TEST_JAR) clean: $(RM) $(CLASSDIR)/*.class clobber: clean $(RM) $(TEST_JAR) all: default install: all $(PROTO_TEST_JAR) JFLAGS= -g -cp $(CLASSPATH) -d $(CLASSDIR) JFLAGS += -source 7 -target 7 -Xlint:all,-deprecation,-options,-rawtypes COMPILE.java=$(JAVAC) $(JFLAGS) $(TEST_JAR): $(SRCDIR)/*.java @mkdir -p $(CLASSDIR) $(COMPILE.java) $(SRCDIR)/*.java $(JAR) -cmf $(MANIFEST) $(TEST_JAR) -C $(CLASSDIR) . $(PROTO_TEST_JAR): $(JAR_DSTDIR) $(JAR_DSTDIR): $(INS.dir) $(JAR_DSTDIR)/%: $(JAR_SRCDIR)/% $(INS.file) Manifest-Version: 1.0 Class-Path: /usr/share/lib/java/dtrace.jar /* * 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. */ import org.opensolaris.os.dtrace.*; import java.util.NoSuchElementException; /** * Regression for 6426129 abort() after close() throws * NoSuchElementException. */ public class TestAbort { static boolean aborted = false; public static void main(String[] args) { Consumer consumer = new LocalConsumer(); // Test for deadlock (bug 6419880) try { consumer.open(); consumer.compile("syscall:::entry { @[execname] = count(); } " + "tick-101ms { printa(@); }"); consumer.enable(); consumer.go(); try { Thread.sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); System.exit(1); } consumer.close(); } catch (DTraceException e) { e.printStackTrace(); System.exit(1); } consumer = new LocalConsumer(); // Should be able to abort an unopened consumer try { aborted = false; consumer.addConsumerListener(new ConsumerAdapter() { public void consumerStopped(ConsumerEvent e) { aborted = true; } }); consumer.abort(); consumer.open(); consumer.compile("syscall:::entry { @[execname] = count(); } " + "tick-101ms { printa(@); }"); consumer.enable(); consumer.go(); try { Thread.sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); System.exit(1); } if (!aborted) { throw new IllegalStateException("consumer not aborted"); } consumer.close(); } catch (Exception e) { e.printStackTrace(); System.exit(1); } consumer = new LocalConsumer(); // Should be safe to call abort() in any state try { consumer.abort(); consumer.open(); consumer.abort(); consumer.compile("syscall:::entry { @[execname] = count(); } " + "tick-101ms { printa(@); }"); consumer.abort(); consumer.enable(); consumer.abort(); consumer.go(); consumer.abort(); consumer.close(); // Should be safe to call after close() try { consumer.abort(); } catch (NoSuchElementException e) { e.printStackTrace(); System.exit(1); } } catch (Exception e) { e.printStackTrace(); System.exit(1); } consumer = new LocalConsumer(); // Tests that close() throws expected exception when called on // synchronized consumer. try { consumer.open(); consumer.compile("syscall:::entry { @[execname] = count(); } " + "tick-101ms { printa(@); }"); consumer.enable(); consumer.go(); try { Thread.sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); System.exit(1); } try { synchronized (consumer) { consumer.close(); } } catch (IllegalThreadStateException e) { try { consumer.close(); System.out.println("Successful"); System.exit(0); } catch (NoSuchElementException x) { x.printStackTrace(); System.exit(1); } } } catch (DTraceException e) { e.printStackTrace(); System.exit(1); } System.err.println("Failed"); System.exit(1); } } /* * 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 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ import org.opensolaris.os.dtrace.*; import java.util.*; import java.io.*; import java.beans.*; import java.lang.reflect.*; /** * Regression test for serialization and XML encoding/decoding. Tests * every Serializable class in the Java DTrace API by creating a dummy * instance, writing it to a file, then reading it back in and comparing * the string values of the object before and after, as well as * verifying object equality before and after if the class overrides the * equals() method. */ public class TestBean { public static final String[] TESTS = new String[] { "ExitRecord", "AggregationRecord", "Aggregation", "Tuple", "ScalarRecord", "KernelStackRecord", "LogDistribution", "LinearDistribution", "LogLinearDistribution", "Option", "ProcessState", "ProbeDescription", "PrintaRecord", "PrintfRecord", "ProbeData", "Aggregate", "UserStackRecord", "AvgValue", "CountValue", "SumValue", "MinValue", "MaxValue", "Error", "Drop", "InterfaceAttributes", "ProgramInfo", "ProbeInfo", "Probe", "Flow", "KernelSymbolRecord", "UserSymbolRecord", "UserSymbolRecord$Value", "Program", "Program$File", "StddevValue" }; static File file; static void exit(int status) { System.out.flush(); System.err.flush(); System.exit(status); } public static XMLEncoder getXMLEncoder(File file) { XMLEncoder encoder = null; try { OutputStream out = new BufferedOutputStream (new FileOutputStream(file)); encoder = new XMLEncoder(out); } catch (Exception e) { e.printStackTrace(); exit(1); } return encoder; } public static XMLDecoder getXMLDecoder(File file) { return getXMLDecoder(file, null); } public static XMLDecoder getXMLDecoder(File file, ExceptionListener exceptionListener) { XMLDecoder decoder = null; try { InputStream in = new BufferedInputStream (new FileInputStream(file)); decoder = new XMLDecoder(in, null, exceptionListener); } catch (Exception e) { e.printStackTrace(); exit(1); } return decoder; } public static ExitRecord getExitRecord() { ExitRecord r = new ExitRecord(1); return r; } public static AggregationRecord getAggregationRecord() { Tuple tuple = getTuple(); AggregationValue value = new CountValue(7); AggregationRecord r = new AggregationRecord(tuple, value); return r; } public static Aggregation getAggregation() { List < AggregationRecord > list = new ArrayList < AggregationRecord > (); AggregationRecord r; r = getAggregationRecord(); list.add(r); ValueRecord v1 = new ScalarRecord(new byte[] {(byte)1, (byte)2, (byte)3}, 3); ValueRecord v2 = new ScalarRecord("shebang!", 256); Tuple tuple = new Tuple(v1, v2); AggregationValue value = getLinearDistribution(); r = new AggregationRecord(tuple, value); list.add(r); Aggregation a = new Aggregation("counts", 2, list); return a; } public static Tuple getTuple() { ValueRecord r1 = new ScalarRecord("cat", 256); ValueRecord r2 = new ScalarRecord(Integer.valueOf(9), 2); ValueRecord r3 = new KernelStackRecord( new StackFrame[] { new StackFrame("has"), new StackFrame("nine"), new StackFrame("lives")}, new byte[] { (byte)0, (byte)1, (byte)2 }); ValueRecord r4 = new ScalarRecord(new byte[] {(byte)1, (byte)2, (byte)3}, 3); Tuple tuple = new Tuple(r1, r2, r3, r4); return tuple; } public static ScalarRecord getScalarRecord() { Object v = new byte[] {(byte)1, (byte)2, (byte)3}; ScalarRecord r = new ScalarRecord(v, 3); return r; } public static KernelStackRecord getKernelStackRecord() { StackFrame[] stackFrames = new StackFrame[] { new StackFrame("Frame 1"), new StackFrame("Frame 2"), new StackFrame("Frame 3") }; KernelStackRecord r = new KernelStackRecord(stackFrames, new byte[] { (byte)0, (byte)1, (byte)2 }); return r; } public static LogDistribution getLogDistribution() { List < Distribution.Bucket > buckets = new ArrayList < Distribution.Bucket > (); Distribution.Bucket bucket; int n = 0; long base = 0; long i; long sign; long nextSign; long power; long nextPower; long lowerBound; long upperBound; for (i = -62; i <= 62; ++i) { if (i == 0) { bucket = new Distribution.Bucket(-1, -1, n++); buckets.add(bucket); bucket = new Distribution.Bucket(0, 0, n++); buckets.add(bucket); bucket = new Distribution.Bucket(1, 1, n++); buckets.add(bucket); continue; } sign = ((i < 0) ? -1L : 1L); power = (sign * i); nextSign = (((i + 1) < 0) ? -1L : 1L); nextPower = (nextSign * (i + 1)); lowerBound = sign * ((long) Math.pow(2L, power)); upperBound = (nextPower == 0 ? -2L : (nextSign * ((long) Math.pow(2L, nextPower))) - 1); if ((upperBound > 0) && ((upperBound * 2L) < 0)) { upperBound = Long.MAX_VALUE; } bucket = new Distribution.Bucket(lowerBound, upperBound, n++); buckets.add(bucket); } LogDistribution d = new LogDistribution(buckets); return d; } public static LinearDistribution getLinearDistribution() { List < Distribution.Bucket > buckets = new ArrayList < Distribution.Bucket > (); Distribution.Bucket bucket; int n = 10; // number of buckets int base = 1; int step = 10; bucket = new Distribution.Bucket(Long.MIN_VALUE, (base - 1), 0); buckets.add(bucket); for (int i = base; i < (n * step); i += step) { bucket = new Distribution.Bucket(i, (i + (step - 1)), ((i - 1) / step)); buckets.add(bucket); } bucket = new Distribution.Bucket((n * step) + 1, Long.MAX_VALUE, 0); buckets.add(bucket); LinearDistribution d = new LinearDistribution(base, step, buckets); return d; } public static LogLinearDistribution getLogLinearDistribution() { Distribution.Bucket bucket; long next, step; long low = 0; long high = 6; long factor = 2; long nsteps = 2; int value = 1; int order; List < Distribution.Bucket > buckets = new ArrayList < Distribution.Bucket > (); for (order = 0; order < low; order++) value *= factor; bucket = new Distribution.Bucket(Long.MIN_VALUE, (value - 1), 0); buckets.add(bucket); next = value * factor; step = (next > nsteps) ? (next / nsteps) : 1; while (order <= high) { bucket = new Distribution.Bucket(value, value + step - 1, 5); buckets.add(bucket); if ((value += step) != next) continue; next = value * factor; step = (next > nsteps) ? (next / nsteps) : 1; order++; } bucket = new Distribution.Bucket(value, Long.MAX_VALUE, 0); buckets.add(bucket); LogLinearDistribution d = new LogLinearDistribution(factor, low, high, nsteps, 0, buckets); return d; } public static Option getOption() { Option option = new Option("aggrate", "1s"); return option; } public static ProcessState getProcessState() { ProcessState p = new ProcessState(123456, "UNDEAD", 3, "SIGSTOP", -2, "Process stopped on dime"); return p; } public static ProbeDescription getProbeDescription() { ProbeDescription d = new ProbeDescription(256, "syscall", null, "malloc", "entry"); return d; } public static PrintaRecord getPrintaRecord() { List < Aggregation > aggregations = new ArrayList < Aggregation > (); Aggregation a = getAggregation(); aggregations.add(a); aggregations.add(a); Map < Tuple, String > formattedOutput = new HashMap < Tuple, String > (); for (Tuple t : a.asMap().keySet()) { formattedOutput.put(t, "cat"); } List < Tuple > tuples = new ArrayList < Tuple > (); for (Tuple t : a.asMap().keySet()) { tuples.add(t); } Collections.sort(tuples); PrintaRecord r = new PrintaRecord(1234567890L, aggregations, formattedOutput, tuples, "Yes, this is the formatted printa() output"); return r; } public static PrintfRecord getPrintfRecord() { List < ValueRecord > list = new ArrayList < ValueRecord > (); ValueRecord v1 = getScalarRecord(); ValueRecord v2 = new ScalarRecord(Integer.valueOf(7), 4); list.add(v1); list.add(v2); PrintfRecord r = new PrintfRecord(list, "long formatted string"); return r; } public static ProbeData getProbeData() { List < org.opensolaris.os.dtrace.Record > list = new ArrayList < org.opensolaris.os.dtrace.Record > (); list.add(getPrintaRecord()); list.add(getPrintfRecord()); list.add(getScalarRecord()); list.add(getUserSymbolRecord()); list.add(getUserStackRecord()); list.add(getExitRecord()); ProbeData d = new ProbeData(7, 1, getProbeDescription(), getFlow(), list); return d; } public static Aggregate getAggregate() { List < Aggregation > list = new ArrayList < Aggregation > (); list.add(getAggregation()); List < AggregationRecord > reclist = new ArrayList < AggregationRecord > (); AggregationRecord r; ValueRecord v1 = new ScalarRecord("cat", 256); ValueRecord v2 = new ScalarRecord("dog", 256); ValueRecord v3 = new ScalarRecord("mouse", 256); ValueRecord v4 = new ScalarRecord("mouse", 256); ValueRecord v5 = new ScalarRecord(Byte.valueOf((byte) 'C'), 1); ValueRecord v6 = new ScalarRecord(Short.valueOf((short) 7), 2); Tuple tuple = new Tuple(v1, v2, v3, v4, v5, v6); AggregationValue value = getCountValue(); r = new AggregationRecord(tuple, value); reclist.add(r); list.add(new Aggregation("times", 1, reclist)); Aggregate a = new Aggregate(1234567890L, list); return a; } public static UserStackRecord getUserStackRecord() { StackFrame[] frames = new StackFrame[] { new StackFrame("User Stack Frame 1"), new StackFrame("User Stack Frame 2"), new StackFrame("User Stack Frame 3") }; UserStackRecord r = new UserStackRecord(123456, frames, new byte[] { (byte)0, (byte)1, (byte)2 }); return r; } public static AvgValue getAvgValue() { AvgValue v = new AvgValue(5, 20, 4); return v; } public static CountValue getCountValue() { CountValue v = new CountValue(9); return v; } public static MinValue getMinValue() { MinValue v = new MinValue(101); return v; } public static MaxValue getMaxValue() { MaxValue v = new MaxValue(101); return v; } public static SumValue getSumValue() { SumValue v = new SumValue(25); return v; } public static org.opensolaris.os.dtrace.Error getError() { ProbeDescription probe = getProbeDescription(); org.opensolaris.os.dtrace.Error e = new org.opensolaris.os.dtrace.Error(probe, 8, 3, 1, 20, "DTRACEFLT_BADALIGN", -1, "error on enabled probe ID 8 " + "(ID " + probe.getID() + ": " + probe + "): Bad alignment " + "(0x33ef) in action #1 at DIF offset 20"); return e; } public static Drop getDrop() { Drop drop = new Drop(2, "SPECBUSY", 72, 1041, "Guess we dropped stuff all over the place."); return drop; } public static InterfaceAttributes getInterfaceAttributes() { InterfaceAttributes a = new InterfaceAttributes( InterfaceAttributes.Stability.UNSTABLE, InterfaceAttributes.Stability.EVOLVING, InterfaceAttributes.DependencyClass.ISA); return a; } public static ProgramInfo getProgramInfo() { ProgramInfo info = new ProgramInfo(getInterfaceAttributes(), getInterfaceAttributes(), 256); return info; } public static ProbeInfo getProbeInfo() { ProbeInfo info = new ProbeInfo(getInterfaceAttributes(), getInterfaceAttributes()); return info; } public static Probe getProbe() { Probe p = new Probe(getProbeDescription(), getProbeInfo()); return p; } public static Flow getFlow() { Flow f = new Flow(Flow.Kind.RETURN.name(), 3); return f; } public static KernelSymbolRecord getKernelSymbolRecord() { KernelSymbolRecord r = new KernelSymbolRecord("mod`func+0x4", -1L); return r; } public static UserSymbolRecord getUserSymbolRecord() { UserSymbolRecord r = new UserSymbolRecord(7, "mod`func+0x4", -1L); return r; } public static UserSymbolRecord.Value getUserSymbolRecord$Value() { UserSymbolRecord.Value v = new UserSymbolRecord.Value(7, -1L); return v; } public static Program getProgram() { final String PROGRAM = "syscall:::entry { @[execname] = count(); }"; Consumer consumer = new LocalConsumer(); Program p; try { consumer.open(); p = consumer.compile(PROGRAM); consumer.close(); } catch (DTraceException e) { e.printStackTrace(); p = null; } return p; } public static Program.File getProgram$File() { final String PROGRAM = "syscall:::entry { @[execname] = count(); }"; Consumer consumer = new LocalConsumer(); Program p; try { OutputStream out = new FileOutputStream(file); out.write(PROGRAM.getBytes(), 0, PROGRAM.length()); out.flush(); out.close(); consumer.open(); p = consumer.compile(file); consumer.close(); } catch (Exception e) { e.printStackTrace(); p = null; } return Program.File.class.cast(p); } public static StddevValue getStddevValue() { StddevValue v = new StddevValue(37, 114, 5, Integer.toString(9544)); return v; } @SuppressWarnings("unchecked") static String getString(Object o) { String s; if (o instanceof ScalarRecord) { o = ((ScalarRecord)o).getValue(); } if (o instanceof byte[]) { s = Arrays.toString((byte[])o); } else if (o instanceof Object[]) { s = Arrays.toString((Object[])o); } else { Class c = o.getClass(); try { Method m = c.getDeclaredMethod("toLogString"); s = (String)m.invoke(o); } catch (Exception e) { s = o.toString(); } } return s; } static void checkEquality(Object obj, Object newobj) { // If the class overrides equals(), make sure the re-created // object still equals the original object try { Method eq = obj.getClass().getDeclaredMethod("equals", Object.class); Boolean ret = (Boolean) eq.invoke(obj, newobj); if (ret != true) { System.err.println("serialization failed: " + obj.getClass().getName()); exit(1); } } catch (Exception e) { // Does not override equals(), although a super-class might. // A better test would check for any superclass other than // Object.class. } } static void performSerializationTest(File file, String classname) throws IOException, ClassNotFoundException { String methodName = "get" + classname; Object obj = null; Object newobj = null; try { Method method = TestBean.class.getDeclaredMethod(methodName); obj = method.invoke(null); } catch (Exception e) { e.printStackTrace(); exit(1); } System.out.println(classname + ":"); String serialized = getString(obj); System.out.println(" serialized: " + serialized); FileOutputStream fos = new FileOutputStream(file); ObjectOutputStream out = new ObjectOutputStream(fos); out.writeObject(obj); out.close(); FileInputStream fis = new FileInputStream(file); ObjectInputStream in = new ObjectInputStream(fis); newobj = in.readObject(); in.close(); String deserialized = getString(newobj); System.out.println(" deserialized: " + deserialized); if (!serialized.equals(deserialized)) { System.err.println("serialization failed: " + classname); exit(1); } checkEquality(obj, newobj); } static void performBeanTest(File file, String classname) { String methodName = "get" + classname; Object obj = null; Object newobj = null; try { Method method = TestBean.class.getDeclaredMethod(methodName); obj = method.invoke(null); } catch (Exception e) { e.printStackTrace(); exit(1); } Class c = obj.getClass(); if (c.getConstructors().length == 0) { return; } System.out.println(classname + ":"); XMLEncoder encoder = getXMLEncoder(file); String encoded = getString(obj); System.out.println(" encoded: " + encoded); encoder.writeObject(obj); encoder.close(); XMLDecoder decoder = getXMLDecoder(file); newobj = decoder.readObject(); String decoded = getString(newobj); System.out.println(" decoded: " + decoded); decoder.close(); if (!encoded.equals(decoded)) { System.err.println("bean persistence failed: " + classname); exit(1); } checkEquality(obj, newobj); } public static void main(String[] args) { if ((args.length != 1) && (args.length != 2)) { System.err.println("usage: java TestBean < filename > " + "[ < classname > ]"); exit(1); } String filename = args[0]; String classname = null; if (args.length >= 2) { classname = args[1]; } file = new File(filename); try { if (!file.canRead()) { try { file.createNewFile(); } catch (Exception e) { System.err.println("failed to create " + filename); exit(1); } } } catch (SecurityException e) { System.err.println("failed to open " + filename); exit(1); } String[] tests = (classname == null ? TESTS: new String[] { classname }); try { for (int i = 0; i < tests.length; ++i) { performSerializationTest(file, tests[i]); performBeanTest(file, tests[i]); } } catch (IOException e) { e.printStackTrace(); exit(1); } catch (ClassNotFoundException e) { e.printStackTrace(); exit(1); } } } /* * 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. */ import org.opensolaris.os.dtrace.*; /** * Regression for bug 6419880 close() hangs running consumer. */ public class TestClose { public static void main(String[] args) { Consumer consumer = new LocalConsumer(); try { consumer.open(); consumer.compile("syscall:::entry { @[execname] = count(); } " + "tick-101ms { printa(@); }"); consumer.enable(); consumer.go(); try { Thread.sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); System.exit(1); } consumer.close(); } catch (DTraceException e) { e.printStackTrace(); System.exit(1); } consumer = new LocalConsumer(); try { consumer.open(); consumer.compile("syscall:::entry { @[execname] = count(); } " + "tick-101ms { printa(@); }"); consumer.enable(); consumer.go(); try { Thread.sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); System.exit(1); } try { // Test new rule that close() is illegal while holding // lock on consumer. synchronized (consumer) { consumer.close(); } } catch (IllegalThreadStateException e) { consumer.close(); System.out.println("Successful"); System.exit(0); } } catch (DTraceException e) { e.printStackTrace(); System.exit(1); } System.err.println("Failed"); System.exit(1); } } /* * 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. */ import java.util.*; import java.util.concurrent.atomic.*; import org.opensolaris.os.dtrace.*; /** * Regression test for 6521523 aggregation drops can hang the Java * DTrace API. */ public class TestDrop { static final String PROGRAM = "fbt:genunix::entry { @[execname, pid] = count(); }"; static AtomicLong consumerThreadID = new AtomicLong(); static AtomicLong getAggregateThreadID = new AtomicLong(); static AtomicBoolean done = new AtomicBoolean(); static int seconds; private static void startTimer() { if (seconds <= 0) { return; } final Timer timer = new Timer(); timer.schedule(new TimerTask() { public void run() { done.set(true); timer.cancel(); } }, seconds * 1000L); } private static void sampleAggregate(Consumer consumer) throws DTraceException { while (consumer.isRunning() && !done.get()) { try { Thread.sleep(50); } catch (InterruptedException e) { } consumer.getAggregate(Collections. emptySet()); } } private static void startAggregateThread(final Consumer consumer) { Runnable aggregateSampler = new Runnable() { public void run() { Thread t = Thread.currentThread(); getAggregateThreadID.set(t.getId()); Throwable x = null; try { sampleAggregate(consumer); } catch (Throwable e) { x = e; } if (Thread.holdsLock(LocalConsumer.class)) { if (x != null) { x.printStackTrace(); } System.out.println("Lock held"); System.exit(1); } else { System.out.println("Lock released"); consumer.close(); // blocks if lock held } } }; Thread t = new Thread(aggregateSampler, "Aggregate Sampler"); t.start(); } static void usage() { System.err.println("usage: java TestDrop [ seconds ]"); System.exit(2); } public static void main(String[] args) { if (args.length == 1) { try { seconds = Integer.parseInt(args[0]); } catch (NumberFormatException e) { usage(); } } else if (args.length > 1) { usage(); } final Consumer consumer = new LocalConsumer() { protected Thread createThread() { Runnable worker = new Runnable() { public void run() { Thread t = Thread.currentThread(); consumerThreadID.set(t.getId()); work(); } }; Thread t = new Thread(worker); return t; } }; consumer.addConsumerListener(new ConsumerAdapter() { public void consumerStarted(ConsumerEvent e) { startAggregateThread(consumer); startTimer(); } public void dataDropped(DropEvent e) throws ConsumerException { Thread t = Thread.currentThread(); if (t.getId() == getAggregateThreadID.get()) { Drop drop = e.getDrop(); throw new ConsumerException(drop.getDefaultMessage(), drop); } } }); try { consumer.open(); consumer.setOption(Option.aggsize, Option.kb(1)); consumer.setOption(Option.aggrate, Option.millis(101)); consumer.compile(PROGRAM); consumer.enable(); consumer.go(new ExceptionHandler() { public void handleException(Throwable e) { e.printStackTrace(); } }); } catch (DTraceException e) { e.printStackTrace(); } } } /* * 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. * * ident "%Z%%M% %I% %E% SMI" */ import org.opensolaris.os.dtrace.*; /** * Prove that enable() handles multiple programs, recognizing programs * that are already enabled and programs that were compiled by another * consumer. */ public class TestEnable { static void exit(int status) { System.out.flush(); System.err.flush(); System.exit(status); } public static void main(String[] args) { Consumer consumer = new LocalConsumer(); try { consumer.open(); Program p0 = consumer.compile("dtrace:::BEGIN"); Program p1 = consumer.compile("syscall:::entry"); Program p2 = consumer.compile("dtrace:::END"); consumer.enable(p0); consumer.enable(p1); try { consumer.go(); System.err.println("go() illegal, not all programs " + "enabled (p0, p1)"); exit(1); } catch (IllegalStateException e) { System.out.println(e); } catch (Exception e) { e.printStackTrace(); exit(1); } try { consumer.enable(); System.err.println("enable() illegal, some programs " + "already enabled (p0, p1)"); exit(1); } catch (IllegalStateException e) { System.out.println(e); } catch (Exception e) { e.printStackTrace(); exit(1); } try { consumer.enable(p0); System.err.println("cannot enable a program that " + "has already been enabled (p0)"); exit(1); } catch (IllegalStateException e) { System.out.println(e); } catch (Exception e) { e.printStackTrace(); exit(1); } consumer.enable(p2); Program p3 = consumer.compile("syscall:::return"); try { consumer.go(); System.err.println("go() illegal, not all programs " + "enabled (p0, p1, p2)"); exit(1); } catch (IllegalStateException e) { System.out.println(e); } catch (Exception e) { e.printStackTrace(); exit(1); } try { consumer.enable(); System.err.println("enable() illegal, some programs " + "already enabled (p0, p1, p2)"); exit(1); } catch (IllegalStateException e) { System.out.println(e); } catch (Exception e) { e.printStackTrace(); exit(1); } // Try to fool the consumer with a program compiled by // another consumer Consumer consumer2 = new LocalConsumer(); consumer2.open(); Program p3x = consumer2.compile("syscall:::return"); try { consumer.enable(p3x); System.err.println("cannot enable program compiled " + "by another consumer"); exit(1); } catch (IllegalArgumentException e) { System.out.println(e); } catch (Exception e) { e.printStackTrace(); exit(1); } finally { consumer2.close(); } consumer.enable(p3); consumer.go(); consumer.close(); // Enable all compiled programs at once consumer = new LocalConsumer(); consumer.open(); consumer.compile("dtrace:::BEGIN"); consumer.compile("syscall:::entry"); consumer.compile("dtrace:::END"); consumer.enable(); consumer.go(); consumer.close(); exit(0); } catch (DTraceException e) { e.printStackTrace(); exit(1); } } } /* * 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 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ import org.opensolaris.os.dtrace.*; /** * Regression for bug 6413280 lookupKernelFunction() and * lookupUserFunction() truncate last character. */ public class TestFunctionLookup { static final String kernelLookupProgram = "sdt:::callout-start { " + "@[((callout_t *)arg0)->c_func] = count(); }"; static final String userLookupProgram = "pid$target::f2:entry { " + "@[arg0] = count(); }"; public static void main(String[] args) { if (args.length != 1) { System.err.println("usage: java TestFunctionLookup "); System.exit(1); } String cmd = args[0]; Consumer consumer = new LocalConsumer(); try { consumer.open(); consumer.compile(kernelLookupProgram); consumer.enable(); consumer.go(); Aggregate a; Number address; String f; boolean done = false; for (int i = 0; (i < 20) && !done; ++i) { Thread.sleep(100); a = consumer.getAggregate(); for (Aggregation agg : a.getAggregations()) { for (Tuple tuple : agg.asMap().keySet()) { address = (Number)tuple.get(0).getValue(); if (address instanceof Integer) { int addr = (Integer)address; f = consumer.lookupKernelFunction(addr); } else { long addr = (Long)address; f = consumer.lookupKernelFunction(addr); } if (f.equals("genunix`cv_wakeup")) { System.out.println(f); done = true; } } } } consumer.close(); } catch (Exception e) { e.printStackTrace(); System.exit(1); } consumer = new LocalConsumer(); try { consumer.open(); int pid = consumer.createProcess(cmd); consumer.compile(userLookupProgram); consumer.enable(); consumer.go(); Thread.sleep(500); Aggregate a = consumer.getAggregate(); Number address; String f; for (Aggregation agg : a.getAggregations()) { for (Tuple tuple : agg.asMap().keySet()) { address = (Number)tuple.get(0).getValue(); if (address instanceof Integer) { int addr = (Integer)address; f = consumer.lookupUserFunction(pid, addr); } else { long addr = (Long)address; f = consumer.lookupUserFunction(pid, addr); } System.out.println(f); } } consumer.close(); } catch (Exception e) { e.printStackTrace(); System.exit(1); } } } /* * 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 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ import org.opensolaris.os.dtrace.*; import java.util.*; /** * Assert getAggregate() can explicitly specify the anonymous aggregation. */ public class TestGetAggregate { static final String programString = "profile:::tick-50ms" + "{" + " @ = count();" + " @a = count();" + "}"; static final String ANONYMOUS_AGGREGATION = ""; static final int TICK = 50; static final int EXPECTED_TICKS = 3; static final int INTERVALS = 4; static void testIncluded(Consumer consumer, String ... aggregationNames) throws DTraceException, InterruptedException { Aggregate aggregate; Set included = new HashSet (); int n = 1; for (String name : aggregationNames) { included.add(name); } // Wait up to a full second to obtain aggregate data. Without a // time limit, we'll loop forever if no aggregation was // successfully included. do { Thread.sleep(TICK); aggregate = consumer.getAggregate(included, null); } while (aggregate.asMap().isEmpty() && n++ < (1000 / TICK)); for (String name : included) { if (aggregate.getAggregation(name) == null) { throw new IllegalStateException("@" + name + " was explicitly included but did not appear " + "in the aggregate"); } } for (Aggregation a : aggregate.getAggregations()) { if (!included.contains(a.getName())) { throw new IllegalStateException("@" + a.getName() + " was not explicitly included but appeared " + "in the aggregate anyway"); } } if (!consumer.isRunning()) { throw new IllegalStateException("consumer exited"); } } static void testCleared(Consumer consumer, String ... aggregationNames) throws DTraceException, InterruptedException { Aggregate aggregate; AggregationRecord rec; long value; Long firstValue; int n = 1; Map firstValues = new HashMap (); Set cleared = new HashSet (); for (String name : aggregationNames) { cleared.add(name); } do { Thread.sleep(TICK); aggregate = consumer.getAggregate(null, cleared); } while (aggregate.asMap().isEmpty() && n++ < (1000 / TICK)); n = 1; do { Thread.sleep(TICK * EXPECTED_TICKS); aggregate = consumer.getAggregate(null, cleared); for (Aggregation a : aggregate.getAggregations()) { if (!firstValues.containsKey(a.getName())) { rec = a.getRecord(Tuple.EMPTY); value = rec.getValue().getValue().longValue(); firstValues.put(a.getName(), value); } } } while (consumer.isRunning() && n++ < INTERVALS); for (Aggregation a : aggregate.getAggregations()) { rec = a.getRecord(Tuple.EMPTY); value = rec.getValue().getValue().longValue(); firstValue = firstValues.get(a.getName()); if (cleared.contains(a.getName())) { // last value should be about the same as first value if (value > (firstValue * 2)) { throw new IllegalStateException( "@" + a.getName() + " should have " + "been cleared but instead grew from " + firstValue + " to " + value); } } else { // last value should be about (INTERVALS * firstValue) if (value < (firstValue * 2)) { throw new IllegalStateException( "@" + a.getName() + " should have " + "accumulated a running total but " + "instead went from " + firstValue + " to " + value); } } } if (!consumer.isRunning()) { throw new IllegalStateException("consumer exited"); } } static Integer includedStatus; static Integer clearedStatus; static void startIncludedTest() { final Consumer consumer = new LocalConsumer(); consumer.addConsumerListener(new ConsumerAdapter() { public void consumerStarted(ConsumerEvent e) { new Thread(new Runnable() { public void run() { try { testIncluded(consumer, ANONYMOUS_AGGREGATION); includedStatus = 0; } catch (Exception e) { includedStatus = 1; e.printStackTrace(); } finally { consumer.abort(); } } }).start(); } }); try { consumer.open(); consumer.setOption(Option.aggrate, Option.millis(TICK)); consumer.compile(programString); consumer.enable(); consumer.go(); } catch (Exception e) { includedStatus = 1; e.printStackTrace(); } } static void startClearedTest() { final Consumer consumer = new LocalConsumer(); consumer.addConsumerListener(new ConsumerAdapter() { public void consumerStarted(ConsumerEvent e) { new Thread(new Runnable() { public void run() { try { testCleared(consumer, ANONYMOUS_AGGREGATION); clearedStatus = 0; } catch (Exception e) { clearedStatus = 1; e.printStackTrace(); } finally { consumer.abort(); } } }).start(); } }); try { consumer.open(); consumer.setOption(Option.aggrate, Option.millis(TICK)); consumer.compile(programString); consumer.enable(); consumer.go(); } catch (Exception e) { clearedStatus = 1; e.printStackTrace(); } } public static void main(String[] args) { startIncludedTest(); do { try { Thread.sleep(TICK); } catch (InterruptedException e) { e.printStackTrace(); } } while (includedStatus == null); startClearedTest(); do { try { Thread.sleep(TICK); } catch (InterruptedException e) { e.printStackTrace(); } } while (clearedStatus == null); if (includedStatus != 0 || clearedStatus != 0) { System.out.println("Failure"); System.exit(1); } System.out.println("Success"); } } /* * 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" */ import org.opensolaris.os.dtrace.*; /** * Regression for 6506495 -DJAVA_DTRACE_MAX_CONSUMERS=N for any N < 8 * is treated as if it were 8. */ public class TestMaxConsumers { static final String MAX_CONSUMERS_PROPERTY_NAME = "JAVA_DTRACE_MAX_CONSUMERS"; static Integer getIntegerProperty(String name) { Integer value = null; String property = System.getProperty(name); if (property != null && property.length() != 0) { try { value = Integer.parseInt(property); } catch (NumberFormatException e) { e.printStackTrace(); } } return value; } public static void main(String[] args) { Integer property = getIntegerProperty(MAX_CONSUMERS_PROPERTY_NAME); int max = (property == null ? 0 : property); int n = (property == null ? 11 : (max < 1 ? 1 : max)); Consumer[] consumers = new Consumer[n]; try { for (int i = 0; i < n; ++i) { consumers[i] = new LocalConsumer(); consumers[i].open(); } for (int i = 0; i < n; ++i) { consumers[i].close(); } for (int i = 0; i < n; ++i) { consumers[i] = new LocalConsumer(); consumers[i].open(); } } catch (Exception e) { e.printStackTrace(); System.exit(1); } try { Consumer consumer = new LocalConsumer(); consumer.open(); if (max > 0) { System.out.println("Error: " + (max + 1) + " > " + MAX_CONSUMERS_PROPERTY_NAME); } else { System.out.println("Success"); } consumer.close(); } catch (Exception e) { System.out.println("Success"); } finally { for (int i = 0; i < n; ++i) { consumers[i].close(); } } } } /* * 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. * * ident "%Z%%M% %I% %E% SMI" */ import java.io.File; import java.io.IOException; import java.util.List; import org.opensolaris.os.dtrace.*; /** * Regression for multi-aggregation printa() corner cases. */ public class TestMultiAggPrinta { static int exitStatus; // Gets a string representation of the given PrintaRecord minus the // timestamp of the aggregate snapshot, so that the output is // comparable across multiple test runs. static String printaRecordString(PrintaRecord rec) { StringBuffer buf = new StringBuffer(); buf.append(PrintaRecord.class.getName()); buf.append("[aggregations = "); buf.append(rec.getAggregations()); buf.append(", formattedStrings = "); buf.append(rec.getFormattedStrings()); buf.append(", tuples = "); buf.append(rec.getTuples()); buf.append(", output = "); buf.append(rec.getOutput()); buf.append(']'); return buf.toString(); } static String probeDataString(ProbeData data) { StringBuffer buf = new StringBuffer(); buf.append(ProbeData.class.getName()); buf.append("[epid = "); buf.append(data.getEnabledProbeID()); // Do not include cpu, since it can change across test runs buf.append(", enabledProbeDescription = "); buf.append(data.getEnabledProbeDescription()); buf.append(", flow = "); buf.append(data.getFlow()); buf.append(", records = "); List records = data.getRecords(); org.opensolaris.os.dtrace.Record record; Object value; buf.append('['); for (int i = 0; i < records.size(); ++i) { if (i > 0) { buf.append(", "); } record = records.get(i); if (record instanceof ValueRecord) { value = ((ValueRecord)record).getValue(); if (value instanceof String) { buf.append("\""); buf.append((String)value); buf.append("\""); } else { buf.append(record); } } else if (record instanceof PrintaRecord) { PrintaRecord printa = (PrintaRecord)record; buf.append(printaRecordString(printa)); } else { buf.append(record); } } buf.append(']'); return buf.toString(); } public static void main(String[] args) { if (args.length != 1) { System.err.println("usage: java TestMultiAggPrinta