#!/bin/sh
#
# The sunwindows driver now uses wall clock time in addition to
# a process's user and system time usage statistics to do window
# lock timeout resolution. This script can be run to customize
# the amount of time the kernel driver will allow a process to hold
# on to any window lock. The time is wall clock time elapsed also known
# as real time. 
# 
#	Usage is: setrlim [seconds]
#	If no argument is passed the time limit to set to a default of
#	4 seconds. 
#
# Set real time (wall clock time) limit for window lock timeouts in
# the sunwindows driver. Default is 4 secs.
#
# Must be run as root

if [ `whoami` != "root" ]
then
	echo "setrlim: Must be root."
	exit 1
fi

case $# in
0) limit=4;;
1) limit=$1;;
*) echo "usage: setrlim [seconds] "
   echo "Default real time limit is 4 seconds"
   exit
   ;;
esac

/bin/adb -k -w /vmunix /dev/mem <<END > /dev/null 2>&1
winlock_rlimit/W $limit
$quit
END

echo "Done setting real time limit on window locks to $limit seconds"

