12633Sahl#!/bin/ksh -p 22633Sahl# 32633Sahl# CDDL HEADER START 42633Sahl# 52633Sahl# The contents of this file are subject to the terms of the 62633Sahl# Common Development and Distribution License (the "License"). 72633Sahl# You may not use this file except in compliance with the License. 82633Sahl# 92633Sahl# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 102633Sahl# or http://www.opensolaris.org/os/licensing. 112633Sahl# See the License for the specific language governing permissions 122633Sahl# and limitations under the License. 132633Sahl# 142633Sahl# When distributing Covered Code, include this CDDL HEADER in each 152633Sahl# file and include the License file at usr/src/OPENSOLARIS.LICENSE. 162633Sahl# If applicable, add the following below this CDDL HEADER, with the 172633Sahl# fields enclosed by brackets "[]" replaced with your own identifying 182633Sahl# information: Portions Copyright [yyyy] [name of copyright owner] 192633Sahl# 202633Sahl# CDDL HEADER END 212633Sahl# 222633Sahl 232633Sahl# 242633Sahl# Copyright 2006 Sun Microsystems, Inc. All rights reserved. 252633Sahl# Use is subject to license terms. 262633Sahl# 272633Sahl#ident "%Z%%M% %I% %E% SMI" 282633Sahl 292633Sahlscript() { 30*2804Stomee $dtrace -c 'cat shajirosan' -qs /dev/stdin <<EOF 312633Sahl syscall::open*:entry 322633Sahl /pid == \$target/ 332633Sahl { 342633Sahl self->p = arg0; 352633Sahl } 362633Sahl 372633Sahl syscall::open*:return 382633Sahl /self->p && copyinstr(self->p) == "shajirosan"/ 392633Sahl { 402633Sahl self->err = 1; 412633Sahl self->p = 0; 422633Sahl } 432633Sahl 442633Sahl syscall::open*:return 452633Sahl /self->err && (int)arg0 == -1 && (int)arg1 == -1/ 462633Sahl { 472633Sahl exit(0); 482633Sahl } 492633Sahl 502633Sahl syscall::open*:return 512633Sahl /self->err/ 522633Sahl { 532633Sahl printf("a failed open(2) returned %d\n", (int)arg0); 542633Sahl exit(1); 552633Sahl } 562633Sahl 572633Sahl syscall::open*:return 582633Sahl /self->p/ 592633Sahl { 602633Sahl self->p = 0; 612633Sahl } 622633SahlEOF 632633Sahl} 642633Sahl 65*2804Stomeeif [ $# != 1 ]; then 66*2804Stomee echo expected one argument: '<'dtrace-path'>' 67*2804Stomee exit 2 68*2804Stomeefi 69*2804Stomee 70*2804Stomeedtrace=$1 71*2804Stomee 722633Sahlscript 732633Sahlstatus=$? 742633Sahl 752633Sahlexit $status 76