Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F146949720
D5176.id12969.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D5176.id12969.diff
View Options
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,22 @@
if [ -n "$_prepend" ]; then
_doit="$_prepend $_doit"
fi
+ if [ -n "$_oomprotect" ]; then
+ if [ -r /usr/bin/protect ]; then
+ case $_oomprotect in
+ [Aa][Ll][Ll])
+ echo "all"
+ _doit="protect -i ${command} ${rc_flags}"
+ ;;
+ [Yy][Ee][Ss])
+ echo "yes"
+ pgrep ${command}
+ #_doit="${command} ${rc_flags}; pgrep ${command} | xargs protect -p"
+ pgrep ${command}
+ ;;
+ esac
+ fi
+ fi
fi
# Prepend default limits
Index: usr.bin/protect/protect.1
===================================================================
--- usr.bin/protect/protect.1
+++ usr.bin/protect/protect.1
@@ -25,7 +25,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd September 19, 2013
+.Dd February 03, 2016
.Dt PROTECT 1
.Os
.Sh NAME
@@ -53,6 +53,8 @@
Apply the operation to all current children of the specified processes.
.It Fl i
Apply the operation to all future children of the specified processes.
+.It Fl s
+Apply the operation to the specified processes.
.It Fl g Ar pgrp
Apply the operation to all processes in the specified process group.
.It Fl p Ar pid
Index: usr.bin/protect/protect.c
===================================================================
--- usr.bin/protect/protect.c
+++ usr.bin/protect/protect.c
@@ -42,8 +42,8 @@
usage(void)
{
- fprintf(stderr, "usage: protect [-i] command\n");
- fprintf(stderr, " protect [-cdi] -g pgrp | -p pid\n");
+ fprintf(stderr, "usage: protect [-i|-s] command\n");
+ fprintf(stderr, " protect [-cdi|-cs] -g pgrp | -p pid\n");
exit(1);
}
@@ -78,7 +78,7 @@
id = getpid();
flags = PPROT_SET;
descend = inherit = idset = false;
- while ((ch = getopt(argc, argv, "cdig:p:")) != -1)
+ while ((ch = getopt(argc, argv, "cdisg:p:")) != -1)
switch (ch) {
case 'c':
flags = PPROT_CLEAR;
@@ -89,6 +89,8 @@
case 'i':
inherit = true;
break;
+ case 's':
+ break;
case 'g':
idtype = P_PGID;
id = parse_id(optarg);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Mar 8, 1:17 AM (3 h, 3 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
29389314
Default Alt Text
D5176.id12969.diff (2 KB)
Attached To
Mode
D5176: Add ${name}_oomprotect to rc.conf
Attached
Detach File
Event Timeline
Log In to Comment