#!/bin/sh # # -- myscript -- # # This script extracts the address of the 'sys_call_table[]' # from the 'System.map' file for the current kernel version, # then uses it as the module-parameter value for 'svctable' # when it installs our 'myexport.o' module into the kernel. # # Reference: Stephen G. Kochan and Patrick Wood, "UNIX Shell # Programming (3rd Edition)," SAMS Publishing (2003). # # programmer: ALLAN CRUSE # written on: 24 JUN 2004 # version=$(uname -r) mapfile=/boot/System.map-$version # echo $mapfile # helpful during script debugging address=$(grep "D sys_call_table" $mapfile | cut -c0-8) # echo $address # helpful during script debugging argument="svctable=$address" # echo $argument # helpful during script debugging /sbin/insmod myexport.o $argument