1 #
!/usr
/sbin
/dtrace
-s
-q
5 * The contents of this file are subject to the terms of the
6 * Common Development and Distribution License (the "License").
7 * You may not use this file except in compliance with the License.
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
22 * Copyright (c) 2010, Oracle and/or it's affiliates. All rights reserved.
25 * build-watch.d - a simple dtrace script to keep track of some key
26 * information to help determine build dependencies.
30 * record paths successfully opened
32 syscall
::open
:entry
, syscall
::open64
:entry
33 /(pid
== $target
) ||
progenyof($target
)/
35 self
->file
= cleanpath(copyinstr(arg0
));
38 /(pid
== $target
) ||
progenyof($target
)/
40 self
->file
= cleanpath(copyinstr(arg1
));
44 /((pid
== $target
) ||
progenyof($target
)) && (arg0
!= -1) && (self
->file
!= "")/
46 @opened[self
->file
] = count();
51 * record the programs successfully execed (full path names)
54 /(pid
== $target
) ||
progenyof($target
)/
56 self
->execpath
= stringof(arg0
);
60 /(pid
== $target
) ||
progenyof($target
)/
62 @tools[execname
, self
->execpath
] = count();
67 * Summarize the results of watching the [sub]process tree
72 printa("TOOL: %s = %s\n", @tools);
73 printa("FILE: %s\n", @opened);