8322 nl: misleading-indentation
[unleashed/tickless.git] / usr / src / cmd / sgs / link_audit / common / sotruss.ksh
blob46b22b9ff1d6c3411e726651a7a2b17daf55b883
1 #!/bin/ksh -p
3 # CDDL HEADER START
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]
20 # CDDL HEADER END
22 # Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved.
24 usage() {
25 echo "usage: sotruss [-F:-T:-o:-f] utility [utility arguments]"
26 echo " -F <bindfromlist>"
27 echo " A colon seperated list of libraries that are to be"
28 echo " traced. Only calls from these libraries will be"
29 echo " traced. The default is to trace calls from the"
30 echo " main executable."
31 echo " -T <bindtolist>"
32 echo " A colon seperated list of libraries that are to be"
33 echo " traced. Only calls to these libraries will be"
34 echo " traced. The default is to trace all calls."
35 echo " -o <outputfile>"
36 echo " sotruss output will be directed to 'outputfile'."
37 echo " by default it is placed on stdout."
38 echo " -f"
39 echo " Follow all children created by fork() and also"
40 echo " print truss output for the children. This also"
41 echo " causes a 'pid' to be added to each truss output line."
44 bindto=""
45 bindfrom=""
46 outfile=""
47 noindentopt=""
48 trusslib32="/usr/lib/link_audit/32/truss.so.1"
49 trusslib64="/usr/lib/link_audit/64/truss.so.1"
50 pidopt=""
51 noexitopt="1"
53 optlet="eF:T:o:fl:i"
55 if [[ $# -lt 1 ]]; then
56 usage
57 exit 1
60 while getopts $optlet c
62 case $c in
64 bindfrom="$OPTARG"
67 bindto="$OPTARG"
70 outfile="$OPTARG"
73 trusslib32="$OPTARG"
74 trusslib64="$OPTARG"
77 pidopt="1"
80 noindentopt="1"
83 noexitopt=""
85 \?)
86 usage
87 exit 1
89 esac
90 done
91 shift `expr $OPTIND - 1`
94 # Build environment variables
97 TRUSS_BINDTO="$bindto" \
98 TRUSS_BINDFROM="$bindfrom" \
99 TRUSS_OUTPUT="$outfile" \
100 TRUSS_PID="$pidopt" \
101 TRUSS_NOINDENT="$noindentopt" \
102 TRUSS_NOEXIT="$noexitopt" \
103 LD_AUDIT_32="$trusslib32" \
104 LD_AUDIT_64="$trusslib64" \
105 "$@"
107 exit 0