tst.func_access.ksh revision 2870:a343ed00e23c
1238582Smm# 2238582Smm# CDDL HEADER START 3238582Smm# 4238582Smm# The contents of this file are subject to the terms of the 5238582Smm# Common Development and Distribution License (the "License"). 6238582Smm# You may not use this file except in compliance with the License. 7238582Smm# 8238582Smm# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9238582Smm# or http://www.opensolaris.org/os/licensing. 10238582Smm# See the License for the specific language governing permissions 11238582Smm# and limitations under the License. 12238582Smm# 13238582Smm# When distributing Covered Code, include this CDDL HEADER in each 14238582Smm# file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15238582Smm# If applicable, add the following below this CDDL HEADER, with the 16238582Smm# fields enclosed by brackets "[]" replaced with your own identifying 17238582Smm# information: Portions Copyright [yyyy] [name of copyright owner] 18238582Smm# 19238582Smm# CDDL HEADER END 20238582Smm# 21238582Smm 22238582Smm# 23238582Smm# Copyright 2006 Sun Microsystems, Inc. All rights reserved. 24238582Smm# Use is subject to license terms. 25238582Smm# 26238582Smm#ident "%Z%%M% %I% %E% SMI" 27238582Smm 28238582Smmppriv -s A=basic,dtrace_proc,dtrace_user $$ 29238582Smm 30238582Smm/usr/sbin/dtrace -q -s /dev/stdin <<"EOF" 31238582Smm 32238582SmmBEGIN { 33238582Smm errorcount = 0; 34238582Smm expected_errorcount = 23; 35238582Smm} 36238582Smm 37238582SmmBEGIN { trace(mutex_owned(&`pidlock)); } 38238582SmmBEGIN { trace(mutex_owner(&`pidlock)); } 39238582SmmBEGIN { trace(mutex_type_adaptive(&`pidlock)); } 40238582SmmBEGIN { trace(mutex_type_spin(&`pidlock)); } 41238582Smm 42238582SmmBEGIN { trace(rw_read_held(&`ksyms_lock)); } 43238582SmmBEGIN { trace(rw_write_held(&`ksyms_lock)); } 44238582SmmBEGIN { trace(rw_iswriter(&`ksyms_lock)); } 45238582Smm 46BEGIN { x = alloca(10); bcopy(`initname, x, 10); trace(stringof(x)); } 47/* We have no reliable way to test msgsize */ 48 49BEGIN { trace(strlen(`initname)); } 50BEGIN { trace(strchr(`initname, 0x69)); } 51BEGIN { trace(strrchr(`initname, 0x69)); } 52BEGIN { trace(strstr("/sbin/init/foo", `initname)); } 53BEGIN { trace(strstr(`initname, "in")); } 54BEGIN { trace(strtok(`initname, "/")); } 55BEGIN { trace(strtok(NULL, "/")); } 56BEGIN { trace(strtok("foo/bar", `initname)); } 57BEGIN { trace(strtok(NULL, `initname)); } 58BEGIN { trace(substr(`initname, 2, 3)); } 59 60BEGIN { trace(ddi_pathname(`top_devinfo, 1)); } 61BEGIN { trace(strjoin(`initname, "foo")); } 62BEGIN { trace(strjoin("foo", `initname)); } 63BEGIN { trace(dirname(`initname)); } 64BEGIN { trace(cleanpath(`initname)); } 65 66ERROR { 67 errorcount++; 68} 69 70BEGIN /errorcount == expected_errorcount/ { 71 trace("test passed"); 72 exit(0); 73} 74 75BEGIN /errorcount != expected_errorcount/ { 76 printf("fail: expected %d. saw %d.", expected_errorcount, errorcount); 77 exit(1); 78} 79EOF 80 81 82exit $? 83