122347Spst# 222347Spst# CDDL HEADER START 329964Sache# 492906Smarkm# The contents of this file are subject to the terms of the 522347Spst# Common Development and Distribution License (the "License"). 622347Spst# You may not use this file except in compliance with the License. 722347Spst# 822347Spst# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 922347Spst# or http://www.opensolaris.org/os/licensing. 1022347Spst# See the License for the specific language governing permissions 1122347Spst# and limitations under the License. 1222347Spst# 1322347Spst# When distributing Covered Code, include this CDDL HEADER in each 1422347Spst# file and include the License file at usr/src/OPENSOLARIS.LICENSE. 1522347Spst# If applicable, add the following below this CDDL HEADER, with the 1622347Spst# fields enclosed by brackets "[]" replaced with your own identifying 1722347Spst# information: Portions Copyright [yyyy] [name of copyright owner] 1822347Spst# 1922347Spst# CDDL HEADER END 2022347Spst# 2122347Spst 2222347Spst# 2322347Spst# Copyright (c) 2012, Joyent, Inc. All rights reserved. 2422347Spst# 2522347Spst 2622347Spstppriv -s A=basic,dtrace_proc,dtrace_user $$ 2722347Spst 2822347Spst/usr/sbin/dtrace -q -Cs /dev/stdin <<EOF 2922347Spst 3022347Spst#define CANREAD(field) \ 3122347Spst BEGIN { this->fp = getf(0); errmsg = "can't read field"; \ 3222347Spst printf("field: "); trace(this->fp->field); printf("\n"); } 3322347Spst 3422347Spst#define CANTREAD(field) \ 3522347Spst BEGIN { errmsg = ""; this->fp = getf(0); trace(this->fp->field); \ 3622347Spst printf("\nable to successfully read field!"); exit(1); } 3722347Spst 3822347SpstCANREAD(f_flag) 3922347SpstCANREAD(f_flag2) 4022347SpstCANREAD(f_vnode) 4122347SpstCANREAD(f_offset) 4222347SpstCANREAD(f_cred) 4322347SpstCANREAD(f_audit_data) 4422347SpstCANREAD(f_count) 4522347Spst 4622347Spst/* 4722347Spst * We can potentially read parts of our cred, but we can't dereference 4822347Spst * through cr_zone. 4922347Spst */ 5022347SpstCANTREAD(f_cred->cr_zone->zone_id) 5122347Spst 5222347SpstCANREAD(f_vnode->v_path) 5322347SpstCANREAD(f_vnode->v_op) 5422347SpstCANREAD(f_vnode->v_op->vnop_name) 5522347Spst 5622347SpstCANTREAD(f_vnode->v_flag) 5722347SpstCANTREAD(f_vnode->v_count) 5822347SpstCANTREAD(f_vnode->v_pages) 5922347SpstCANTREAD(f_vnode->v_type) 6022347SpstCANTREAD(f_vnode->v_vfsmountedhere) 6122347SpstCANTREAD(f_vnode->v_op->vop_open) 6222347Spst 6322347SpstBEGIN 6422347Spst{ 6522347Spst errmsg = ""; 6622347Spst this->fp = getf(0); 6722347Spst this->fp2 = getf(1); 6822347Spst 6922347Spst trace(this->fp->f_vnode); 7022347Spst printf("\nable to successfully read this->fp!"); 7122347Spst exit(1); 7222347Spst} 7322347Spst 7422347SpstBEGIN 7522347Spst{ 7622347Spst errmsg = ""; 7722347Spst this->fp = getf(0); 7822347Spst} 7922347Spst 8022347SpstBEGIN 8122347Spst{ 8222347Spst trace(this->fp->f_vnode); 8322347Spst printf("\nable to successfully read this->fp from prior clause!"); 8422347Spst} 8522347Spst 8622347SpstBEGIN 8722347Spst{ 8822347Spst exit(0); 8922347Spst} 9022347Spst 9122347SpstERROR 9222347Spst/errmsg != ""/ 9322347Spst{ 9422347Spst printf("fatal error: %s", errmsg); 9522347Spst exit(1); 9622347Spst} 9722347Spst 9822347SpstEOF 9922347Spst