aboutsummaryrefslogblamecommitdiffstats
path: root/setsched
blob: 4b7160f16ea5f9e2a1f8420a6dea2695efd46594 (plain) (tree)





















                                                                           
                                                              

















                                            
#!/bin/bash
#
# setsched: facilitate changing the active scheduler plugin.

ADIR=/proc/litmus/active_plugin
PDIR=/proc/litmus/plugins

CHOICE=$1

if [ ! -e $ADIR ]; then
    KERN=`uname -s -r`
    echo "Error: LITMUS^RT not found on $KERN!" 
    exit 1
fi

ACTIVE=`cat $ADIR`

if [ -z "$1" ]; then
    TMP=`mktemp`
    (awk "{print \$1 \" 'Plugin'\"}" $PDIR | \
    xargs  dialog --title "Select Plugin" --backtitle "Current: $ACTIVE"  \
	--cancel-label "Cancel" --ok-label "Select Plugin" \
	--menu "Select a new plugin to run: " 15 60 6) 2> $TMP
    OK=$?
    clear
    if [ "$OK" != "0" ]; then	
	exit 0;
    fi
    CHOICE=`cat $TMP`
    rm $TMP   
fi


echo "$CHOICE" > $ADIR

ACTIVE=`cat $ADIR`

if [ "$ACTIVE" != "$CHOICE" ]; then
    echo "Error: Setting new plugin failed."
    exit 1
fi