Index: etc/rc.subr =================================================================== --- etc/rc.subr +++ etc/rc.subr @@ -755,6 +755,8 @@ # # ${name}_nice n Nice level to run ${command} at. # +# ${name}_oomprotect n Protect against OOM Killer. +# # ${name}_user n User to run ${command} as, using su(1) if not # using ${name}_chroot. # Requires /usr to be mounted. @@ -944,7 +946,8 @@ _nice=\$${name}_nice _user=\$${name}_user \ _group=\$${name}_group _groups=\$${name}_groups \ _fib=\$${name}_fib _env=\$${name}_env \ - _prepend=\$${name}_prepend _login_class=\${${name}_login_class:-daemon} + _prepend=\$${name}_prepend _login_class=\${${name}_login_class:-daemon} \ + _oomprotect=\$${name}_oomprotect if [ -n "$_user" ]; then # unset $_user if running as that user if [ "$_user" = "$(eval $IDCMD)" ]; then @@ -1050,6 +1053,18 @@ if [ -n "$_prepend" ]; then _doit="$_prepend $_doit" fi + if [ -n "$_oomprotect" ]; then + if [ -r /usr/bin/protect ]; then + case $_oomprotect in + [Aa][Ll][Ll]) + _doit="protect -i ${command} ${rc_flags}" + ;; + [Yy][Ee][Ss]) + _doit="protect ${command} ${rc_flags}" + ;; + esac + fi + fi fi # Prepend default limits