Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 396930 Details for
Bug 540160
dev-libs/libcgroup: Ebuild improvements
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
cgconfig.conf-init-d.patch
cgconfig.conf-init-d.patch (text/plain), 4.78 KB, created by
tokiclover
on 2015-02-19 10:03:45 UTC
(
hide
)
Description:
cgconfig.conf-init-d.patch
Filename:
MIME Type:
Creator:
tokiclover
Created:
2015-02-19 10:03:45 UTC
Size:
4.78 KB
patch
obsolete
>diff --git a/dev-libs/libcgroup/files/cgconfig.confd b/dev-libs/libcgroup/files/cgconfig.confd >index e41730a..334958e 100644 >--- a/dev-libs/libcgroup/files/cgconfig.confd >+++ b/dev-libs/libcgroup/files/cgconfig.confd >@@ -1,4 +1,7 @@ > # /etc/conf.d/cgconfig: config file for /etc/init.d/cgconfig > > # Configuration file location >-#CONFIG_FILE=/etc/cgroup/cgconfig.conf >+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 b/dev-libs/libcgroup/files/cgconfig.initd >index 65278f1..f10d994 100644 >--- a/dev-libs/libcgroup/files/cgconfig.initd >+++ b/dev-libs/libcgroup/files/cgconfig.initd >@@ -1,117 +1,53 @@ > #!/sbin/runscript >-# >-# Control Groups Configuration Startup >-# >-# This script runs the cgconfigparser utility to parse and setup >-# the control group filesystem. It uses ${CONFIG_FILE} >-# and parses the configuration specified in there. >-# >-CGCONFIGPARSER="/usr/sbin/cgconfigparser" >-CGROUP_FS="cgroup" >-CONFIG_FILE=${CONFIG_FILE:-"/etc/cgroup/cgconfig.conf"} >-MOUNTS_FILE="/proc/mounts" >-RULES_FILE="/etc/cgroup/cgrules.conf" >- >-# Support multiple mount points >-MAX_INDEX=0 >-declare -a MOUNT_POINTS MOUNT_OPTIONS >- >-move_all_to_init_class() { >- local i >- for i in $(seq 1 ${MAX_INDEX}); do >- cd ${MOUNT_POINTS[$i]} >- >- if grep -qw ${MOUNT_POINTS[$i]} ${MOUNTS_FILE}; then >- local directory >- for directory in $(find . -depth -type d); do >- if [[ ${directory} != "." ]]; then >- # cat fails with "Argument list too long" error >- sed -nu p < ${directory}/tasks > tasks >- rmdir ${directory} >- fi >- done >- else >- ewarn "Resource control filesystem not mounted" >- fi >+# 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 $ > >- cd - >/dev/null >- done >-} >- >-parse_mounts() { >- local device mount_point fs_type options other >- while read device mount_point fs_type options other; do >- if grep -q ${device} <<< ${CGROUP_FS}; then >- let MAX_INDEX++ >- MOUNT_POINTS[${MAX_INDEX}]=${mount_point} >- MOUNT_OPTIONS[${MAX_INDEX}]=${options} >- fi >- done < ${MOUNTS_FILE} >+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 "$?" > } > >-umount_fs() { >- local i >- for i in $(seq 1 ${MAX_INDEX}); do >- umount ${MOUNT_POINTS[$i]} >- rmdir ${MOUNT_POINTS[$i]} >+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 "$?" > } > >-start() { >- ebegin "Starting cgconfig service" >- >- # Mount filesystem and create cgroups >- if ! ${CGCONFIGPARSER} -l ${CONFIG_FILE} >/dev/null; then >- eend 1 "Failed to parse ${CONFIG_FILE}" >- return 1 >- fi >- >- parse_mounts >- >- # Find default cgroup name in rules file >- local default_cgroup >- if [[ -f ${RULES_FILE} ]]; then >- local user controller >- read user controller default_cgroup <<< $(grep -m1 '^\*\s' ${RULES_FILE}) >- if [[ $default_cgroup == "*" ]]; then >- ewarn "${RULES_FILE} incorrect" >- ewarn "Overriding it" >- default_cgroup= >- fi >- fi >- # Use predefined name if none was found >- if [[ -z ${default_cgroup} ]]; then >- default_cgroup=sysdefault >- fi >- >- # Create a default cgroup for tasks to return back to >- local i >- for i in $(seq 1 ${MAX_INDEX}); do >- # Ignore if directory already exists >- mkdir -p ${MOUNT_POINTS[$i]}/${default_cgroup} >- find ${MOUNT_POINTS[$i]}/ -name tasks | xargs chmod a+rw >- chmod go-w ${MOUNT_POINTS[$i]}/tasks >- >- # Special rule for cpusets >- if grep -qw cpuset <<< ${MOUNT_OPTIONS[$i]}; then >- cat ${MOUNT_POINTS[$i]}/cpuset.cpus > ${MOUNT_POINTS[$i]}/${default_cgroup}/cpuset.cpus >- cat ${MOUNT_POINTS[$i]}/cpuset.mems > ${MOUNT_POINTS[$i]}/${default_cgroup}/cpuset.mems >- fi >- >- # Classify everything to default cgroup >- local j >- for j in $(ps --no-headers -eL o tid); do >- echo $j > ${MOUNT_POINTS[$i]}/${default_cgroup}/tasks 2>/dev/null >- done >- done >- >- eend 0 >+stop() >+{ >+ cgconfig_umount > } > >-stop() { >- ebegin "Stopping cgconfig service" >- parse_mounts >- move_all_to_init_class >- umount_fs >- eend 0 >+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}" > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 540160
:
396520
|
396730
|
396792
|
396804
|
396926
|
396928
| 396930 |
406828
|
406830