summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnthony G. Basile <blueness@gentoo.org>2015-11-16 18:09:14 -0500
committerAnthony G. Basile <blueness@gentoo.org>2015-11-16 18:09:33 -0500
commita8cc51c8c561a5b98aa079858de05b2b869b6e76 (patch)
treefffc7a0e5dbd49cf130990deaf75c9bda3ef63f5 /dev-libs/libcgroup/files
parentUpdate gnome 3.18 mask (diff)
downloadgentoo-a8cc51c8c561a5b98aa079858de05b2b869b6e76.tar.gz
gentoo-a8cc51c8c561a5b98aa079858de05b2b869b6e76.tar.bz2
gentoo-a8cc51c8c561a5b98aa079858de05b2b869b6e76.zip
dev-libs/libcgroup: refactor the init scripts.
Thanks tokiclover@eclipso.email Package-Manager: portage-2.2.20.1
Diffstat (limited to 'dev-libs/libcgroup/files')
-rw-r--r--dev-libs/libcgroup/files/cgconfig.confd-r17
-rw-r--r--dev-libs/libcgroup/files/cgconfig.initd-r153
-rw-r--r--dev-libs/libcgroup/files/cgred.confd-r15
-rw-r--r--dev-libs/libcgroup/files/cgred.initd-r124
4 files changed, 89 insertions, 0 deletions
diff --git a/dev-libs/libcgroup/files/cgconfig.confd-r1 b/dev-libs/libcgroup/files/cgconfig.confd-r1
new file mode 100644
index 000000000000..334958ef3b8f
--- /dev/null
+++ b/dev-libs/libcgroup/files/cgconfig.confd-r1
@@ -0,0 +1,7 @@
+# /etc/conf.d/cgconfig: config file for /etc/init.d/cgconfig
+
+# Configuration file location
+CG_CONFIGFILE=/etc/cgroup/cgconfig.conf
+
+# Enable calssifying pid according to rules if necessary
+CG_CLASSIFY=No
diff --git a/dev-libs/libcgroup/files/cgconfig.initd-r1 b/dev-libs/libcgroup/files/cgconfig.initd-r1
new file mode 100644
index 000000000000..f10d994162c4
--- /dev/null
+++ b/dev-libs/libcgroup/files/cgconfig.initd-r1
@@ -0,0 +1,53 @@
+#!/sbin/runscript
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /etc/init.d/cgconfig,v 1.1 2015/02/18 09:53:59 tokiclover Exp $
+
+CGCONFIGPARSER="/usr/sbin/cgconfigparser"
+CGCLASSIFY="/usr/sbin/cgclassify"
+: ${CG_CONFIGFILE:=/etc/cgroup/cgconfig.conf}
+description="Control Group Configuration Service"
+
+start()
+{
+ ebegin "Setting up CGroups"
+ ${CGCONFIGPARSER} --load=${CG_CONFIGFILE} >/dev/null 2>&1
+ eend "$?"
+}
+
+start_post()
+{
+ # Classify PID according to the rules if requested
+ yesno "${CG_CLASSIFY}" || return 0
+ ebegin "Classifying PID to CGroups"
+ local pid
+ for pid in $(ps --no-headers -eL o tid); do
+ ${CGCLASSIFY} ${pid}
+ done
+ eend "$?"
+}
+
+stop()
+{
+ cgconfig_umount
+}
+
+cgconfig_umount()
+{
+ local ctrl eq mnt_pnt mnt_pts
+
+ while read ctrl eq mnt_pnt; do
+ case "${ctrl}" in
+ (\#*) continue ;;
+ (mount*) mnt_pts=true;;
+ (\}*) mnt_pts= ;;
+ (*)
+ [ -n "${mnt_pts}" ] || continue
+ mnt_pnt="${mnt_pnt%;}"
+ ebegin "Unmounting ${mnt_pnt}"
+ umount "${mnt_pnt}"
+ eend "$?"
+ ;;
+ esac
+ done < "${CG_CONFIGFILE}"
+}
diff --git a/dev-libs/libcgroup/files/cgred.confd-r1 b/dev-libs/libcgroup/files/cgred.confd-r1
new file mode 100644
index 000000000000..e351434afa69
--- /dev/null
+++ b/dev-libs/libcgroup/files/cgred.confd-r1
@@ -0,0 +1,5 @@
+# /etc/conf.d/cgred.conf: config file for /etc/init.d/cgred
+
+# Options to pass to cgrulesengd;
+# See the cgrulesengd(8) man page for more info.
+CGRED_OPTS=""
diff --git a/dev-libs/libcgroup/files/cgred.initd-r1 b/dev-libs/libcgroup/files/cgred.initd-r1
new file mode 100644
index 000000000000..85cbb05931e9
--- /dev/null
+++ b/dev-libs/libcgroup/files/cgred.initd-r1
@@ -0,0 +1,24 @@
+#!/sbin/runscript
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /etc/init.d/cgred,v 1.1 2015/02/14 09:53:59 tokiclover Exp $
+
+command="/usr/sbin/cgrulesengd"
+command_args="${CGRED_OPTS}"
+command_background="1"
+pidfile="/var/run/cgred.pid"
+description="CGroups Rules Engine Daemon"
+extra_started_commands="reload"
+
+depend()
+{
+ need cgconfig
+ use logger
+}
+
+reload()
+{
+ ebegin "Reloading CGroup Rules Engine Daemon"
+ kill -USR2 $(cat "${pidfile}")
+ eend $?
+}