1
0

dontkill 323 B

12345678910
  1. #!/cmd/rc
  2. # dontkill regexp - mark invoker's processes with names matching regexp
  3. # as not killable when the kernel runs out of memory
  4. if (! ~ $#* 1) {
  5. echo $0 regexp >[1=2]
  6. exit usage
  7. }
  8. # see /sys/src/kern/port/proc.c:/^killbig
  9. pids=`{psu | awk '$NF ~ /'$1'/ {print $2}'}
  10. ~ $#pids 0 || chmod -w $pids^/ctl >[2]/dev/null