summaryrefslogtreecommitdiff
path: root/sys/dev/filemon/mknod-sh
blob: 9fab38af01340571cd0322ef8065f84a4f2ee2b9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/bin/sh

# Note that filemon.kmod needs the 6.x version of modload.

Error() {
	echo "ERROR: $@" >&2; exit 1
}

major=`sysctl kern.drivers | tr ',' '\012' | sed -n '/filemon/s,.*\[\([0-9][0-9]*\).*,\1,p'`

[ ${major:-0} -gt 0 ] || Error filemon not loaded
dev=/dev/filemon

if [ -c $dev ]; then
   x=`'ls' -l $dev`
   case "$x" in
   *" $major,"*) exit 0;;
   esac
   rm -f $dev
fi
mknod -m 666 $dev c $major 0