blob: 557bbd8fb18330df1ce3a051939460c181ca5a74 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
#!/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
psu | awk '$NF ~ /'$1'/ {
c="/proc/"$2"/ctl"
print "chmod +w "c
print "@{echo noswap >"c"}"
print "chmod -w "c
}' | rc >/dev/null >[2=1]
|