#!/bin/sh
# 101 = svc
# 104 = svc return
LVM="10a,10b,10d"
HOOKS="-j 101,104,106,107,108,119,120,121,122,12e,130,134,135,137,139,13e,145,146,147,14c,14e,152,154,15b,15f,160,163,169,16e,16f,174,175,176,177,178,179,17a,17b,17c,17d,17e,17f,180,181,18e,18f,195,19b,19c,1a4,1a5,1a6,1a7,1a8,1a9,1aa,1ab,1ac,1ad,1ae,1af,252"
PID=""

set -- `getopt "alp:" $@`
if test $? -ne 0
then
	echo "Usage: $0 [-a] [-l] [-p pid] [command]" >&2
	exit 1
fi
while test X$1 != X--
do
	case $1 in
	-a)
		HOOKS=""
		shift
		;;
	-l)
		HOOKS="$HOOKS,$LVM"
		shift
		;;
	-p)
		PID="$1 $2"
		shift 2
		;;
	esac
done
shift
if test $# -eq 0
then
	trace $HOOKS -a -o /tmp/trace$$
	echo "press return to stop trace: \c"
	read x
	trcstop
else
	trace $HOOKS -o /tmp/trace$$ <<-eof
	trcon
	! $@
	trcoff
	q
	eof
fi
trcrpt -O "svc=on,pid=on,exec=on" $PID /tmp/trace$$ | more
rm -f /tmp/trace$$
