f484800de70343e19872fa0f3fde2a00504a9cecBryan Cantrill# CDDL HEADER START
f484800de70343e19872fa0f3fde2a00504a9cecBryan Cantrill# The contents of this file are subject to the terms of the
f484800de70343e19872fa0f3fde2a00504a9cecBryan Cantrill# Common Development and Distribution License (the "License").
f484800de70343e19872fa0f3fde2a00504a9cecBryan Cantrill# You may not use this file except in compliance with the License.
f484800de70343e19872fa0f3fde2a00504a9cecBryan Cantrill# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
f484800de70343e19872fa0f3fde2a00504a9cecBryan Cantrill# See the License for the specific language governing permissions
f484800de70343e19872fa0f3fde2a00504a9cecBryan Cantrill# and limitations under the License.
f484800de70343e19872fa0f3fde2a00504a9cecBryan Cantrill# When distributing Covered Code, include this CDDL HEADER in each
f484800de70343e19872fa0f3fde2a00504a9cecBryan Cantrill# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
f484800de70343e19872fa0f3fde2a00504a9cecBryan Cantrill# If applicable, add the following below this CDDL HEADER, with the
f484800de70343e19872fa0f3fde2a00504a9cecBryan Cantrill# fields enclosed by brackets "[]" replaced with your own identifying
f484800de70343e19872fa0f3fde2a00504a9cecBryan Cantrill# information: Portions Copyright [yyyy] [name of copyright owner]
f484800de70343e19872fa0f3fde2a00504a9cecBryan Cantrill# CDDL HEADER END
f484800de70343e19872fa0f3fde2a00504a9cecBryan Cantrill# Copyright (c) 2011, Joyent, Inc. All rights reserved.
f484800de70343e19872fa0f3fde2a00504a9cecBryan Cantrillif [ $# != 1 ]; then
f484800de70343e19872fa0f3fde2a00504a9cecBryan Cantrill echo expected one argument: '<'dtrace-path'>'
f484800de70343e19872fa0f3fde2a00504a9cecBryan Cantrill#include <unistd.h>
f484800de70343e19872fa0f3fde2a00504a9cecBryan Cantrill#include <sys/sdt.h>
f484800de70343e19872fa0f3fde2a00504a9cecBryan Cantrillmain(int argc, char **argv)
f484800de70343e19872fa0f3fde2a00504a9cecBryan Cantrill DTRACE_PROBE(test_prov, probe1);
f484800de70343e19872fa0f3fde2a00504a9cecBryan Cantrillprovider test_prov {
f484800de70343e19872fa0f3fde2a00504a9cecBryan Cantrill probe probe1();
f484800de70343e19872fa0f3fde2a00504a9cecBryan Cantrill spec = speculation();
f484800de70343e19872fa0f3fde2a00504a9cecBryan Cantrill speculate(spec);
f484800de70343e19872fa0f3fde2a00504a9cecBryan Cantrill printf("this is speculative!\n");
f484800de70343e19872fa0f3fde2a00504a9cecBryan Cantrill test_prov*:::
f484800de70343e19872fa0f3fde2a00504a9cecBryan Cantrill probeid = id;
f484800de70343e19872fa0f3fde2a00504a9cecBryan Cantrill /probeid == 0/
f484800de70343e19872fa0f3fde2a00504a9cecBryan Cantrill printf("launching test\n");
f484800de70343e19872fa0f3fde2a00504a9cecBryan Cantrill system("./test");
f484800de70343e19872fa0f3fde2a00504a9cecBryan Cantrill /probeid != 0/
f484800de70343e19872fa0f3fde2a00504a9cecBryan Cantrill printf("attempting re-enabling\n");
f484800de70343e19872fa0f3fde2a00504a9cecBryan Cantrill system("dtrace -e -x errtags -i %d", probeid);
f484800de70343e19872fa0f3fde2a00504a9cecBryan Cantrill /attempts > 10/
f484800de70343e19872fa0f3fde2a00504a9cecBryan Cantrill# It should be true that our probe was not reaped after the provider was made
f484800de70343e19872fa0f3fde2a00504a9cecBryan Cantrill# defunct: the speculative tracing action prevents reaping of any ECB in the
f484800de70343e19872fa0f3fde2a00504a9cecBryan Cantrillif grep D_PDESC_INVAL test.out 2> /dev/null 1>&2 ; then