#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
#
# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
#ident "%Z%%M% %I% %E% SMI"
umask 022
else
fi
if [[ -n "$CODEMGR_WS" ]]; then
elif [[ -n "$ROOT" ]]; then
else
sysroot=/
fi
eol='\'
files=
simchan=com.sun:fm:fmd$$
simscript=run
simpid=
truss_cmd=
truss_args=
dump_args=
inj_args=
fmd_args=
opt_h=false
opt_i=false
opt_s=false
opt_w=false
opt_x=false
function cp_so
{
[[ $type != T ]] && continue
case $name in
esac
done
die "\nunknown .so type -- $1"
}
function cp_topo
{
done
}
function list_cmds
{
for cmd in fmadm fmdump fmstat; do
done
}
function wait_status
{
if [[ $1 -gt 128 ]]; then
sig=$(kill -l $(($1 - 128)))
die "fmd terminated from signal $sig (see $simroot)"
elif [[ $1 -ne 0 ]]; then
die "fmd terminated with status $1 (see $simroot)"
fi
}
function wait_prompt
{
echo "fmsim: [ Press return to $* ] \c"
mode=$(stty -g)
stty -echo -isig min 1 time 0
read s; echo
stty $mode
}
function die
{
echo "fmsim: $*" >& 2
$opt_w && wait_prompt exit
[[ -n "$simpid" ]] && exit 1 || exit 2
}
while [[ $# -gt 0 ]]; do
case "$c" in
d)
simroot=$OPTARG
;;
D)
truss_cmd=dtrace
truss_args="-s $OPTARG -c"
quote="'"; eol=""
;;
e|v|V)
;;
h|i|s|w|x)
eval opt_$c'='true
;;
o)
;;
t)
truss_cmd=truss
;;
:)
;;
*)
;;
esac
done
if [[ $# -gt 0 ]]; then
if [[ -d $1 ]]; then
else
fi
shift
fi
done
for file in $files; do
done
exit 0
fi
cd $simroot || exit 1
echo "done."
echo "done."
done
cd $cwd || exit $1
for file in $files; do
case $base in
esac
done
cd $simroot || exit 1
echo " done."
cat >$simscript <<EOS
#
# Copyright 2005 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
#
# fmsim(1M) script generated for $simroot $(date)
#
export _THREAD_ERROR_DETECTION=2
exec $truss_cmd $truss_args $quote./usr/lib/fm/fmd/fmd -R $simroot $eol
-o rpc.adm.prog=0 -o rpc.adm.path=$simroot/rpc $eol
chmod 0555 $simscript
echo "done."
if $opt_s; then
echo "fmsim: simulation is saved in $simroot"
exit 0
fi
echo "fmsim: simulation $$ running fmd(1M)\c"
./$simscript &
simpid=$!
cd $cwd
i=0
let i="$i + 1"
sleep 1
done
wait $simpid
wait_status $?
}
echo "fmsim: injectors should use channel $simchan"
echo "fmsim: debuggers should attach to PID $simpid"
echo "fmsim: injecting events from $arg ... \c"
}
echo "done."
done
if [[ $opt_i = false ]]; then
echo "fmsim: injecting event to advance to end-of-time ... \c"
echo "done."
fi
wait $simpid
status=$?
fi
$opt_w && wait_prompt exit
exit 0