2011-03-30 14:14:36 +00:00
|
|
|
#!/bin/rc
|
|
|
|
# dontkill regexp - mark invoker's processes with names matching regexp
|
|
|
|
# as not killable when the kernel runs out of memory
|
|
|
|
if (! ~ $#* 1) {
|
|
|
|
echo $0 regexp >[1=2]
|
|
|
|
exit usage
|
|
|
|
}
|
|
|
|
# see /sys/src/9/port/proc.c:/^killbig
|
2011-08-27 16:39:14 +00:00
|
|
|
psu | awk '$NF ~ /'$1'/ {
|
|
|
|
c="/proc/"$2"/ctl"
|
|
|
|
print "chmod +w "c
|
2011-08-27 19:39:00 +00:00
|
|
|
print "@{echo noswap >"c"}"
|
2011-08-27 16:39:14 +00:00
|
|
|
print "chmod -w "c
|
|
|
|
}' | rc >/dev/null >[2=1]
|