Index: 0.38-1/md5sums
===================================================================
--- 0.38-1/md5sums	(revision 1)
+++ 0.38-1/md5sums	(revision 19)
@@ -1,3 +1,10 @@
+4f8f6ca8a67d8014374b1c4c4f662f58  etc/cgconfig.conf
+678576af1f6f70b8485f1fce358e522c  etc/cgrules.conf
+f55d7fd207ffa2221f0a94b3ed640e70  etc/cgsnapshot_blacklist.conf
+86d15ed4ed53308ed33ee54d76c90e1d  etc/default/cgconfig
+2ca9c3f8eb4eb4f1312252ac6e6e535c  etc/default/cgred
+954e9c5a176d69921b064c3c35719ca0  etc/init.d/cgconfig
+16b4ed6ca050095059ec67bbc187f38a  etc/init.d/cgred
 7117f1966fc26597a794a20af4811dec  usr/bin/cgclassify
 2ad67d43de3bf60df6abadafdac05506  usr/bin/cgcreate
 bc8fd81faf097302b58d268d09cdaa76  usr/bin/cgdelete
Index: 0.38-1/etc/cgconfig.conf
===================================================================
--- 0.38-1/etc/cgconfig.conf	(revision 0)
+++ 0.38-1/etc/cgconfig.conf	(revision 19)
@@ -0,0 +1,48 @@
+#
+#  Copyright IBM Corporation. 2007
+#
+#  Authors:	Balbir Singh <balbir@linux.vnet.ibm.com>
+#  This program is free software; you can redistribute it and/or modify it
+#  under the terms of version 2.1 of the GNU Lesser General Public License
+#  as published by the Free Software Foundation.
+#
+#  This program is distributed in the hope that it would be useful, but
+#  WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+#
+#group daemons/www {
+#	perm {
+#		task {
+#			uid = root;
+#			gid = webmaster;
+#		}
+#		admin {
+#			uid = root;
+#			gid = root;
+#		}
+#	}
+#	cpu {
+#		cpu.shares = 1000;
+#	}
+#}
+#
+#group daemons/ftp {
+#	perm {
+#		task {
+#			uid = root;
+#			gid = ftpmaster;
+#		}
+#		admin {
+#			uid = root;
+#			gid = root;
+#		}
+#	}
+#	cpu {
+#		cpu.shares = 500;
+#	}
+#}
+#
+#mount {
+#	cpu = /mnt/cgroups/cpu;
+#	cpuacct = /mnt/cgroups/cpuacct;
+#}
Index: 0.38-1/etc/default/cgred
===================================================================
--- 0.38-1/etc/default/cgred	(revision 0)
+++ 0.38-1/etc/default/cgred	(revision 19)
@@ -0,0 +1,30 @@
+# /etc/sysconfig/cgred.conf - CGroup Rules Engine Daemon configuration file
+# 
+# The four options listed below (CONFIG_FILE, LOG_FILE, NODAEMON, LOG) are
+# the only valid ones.  Defining anything else in this file will cause the
+# CGroup Rules Engine program to fail.  So, don't do it.
+
+# The pathname to the configuration file for CGroup Rules Engine
+CONFIG_FILE="/etc/cgrules.conf"
+
+# Uncomment the following line to log to specified file instead of syslog
+#LOG_FILE="/var/log/cgrulesengd.log"
+
+# Uncomment the second line to run CGroup Rules Engine in non-daemon mode
+NODAEMON=""
+#NODAEMON="--nodaemon"
+
+# Set owner of cgred socket. 'cgexec' tool should have write access there
+# (either using suid and/or sgid permissions or Linux capabilities).
+SOCKET_USER=""
+SOCKET_GROUP=""
+
+# Set log file location
+#LOG_FILE="/var/log/cgroups/cgrulesengd.log"
+
+# Uncomment the second line to disable logging for CGroup Rules Engine
+# Uncomment the third line to enable more verbose logging.
+#LOG_LEVEL=""
+LOG_LEVEL="--nolog"
+#LOG_LEVEL="-v"
+
Index: 0.38-1/etc/default/cgconfig
===================================================================
--- 0.38-1/etc/default/cgconfig	(revision 0)
+++ 0.38-1/etc/default/cgconfig	(revision 19)
@@ -0,0 +1,12 @@
+# Service cgconfig can create a default group in all mounted hierarchies and
+# move all processes there on boot. If no default rule is specified in
+# /etc/cgrules.conf, the default group is named '/sysdefault'.
+# This automatically created group(s) can be useful e.g. when using 'cpu'
+# controller to limit cpu.shares of this default group and allowing some more
+# important group take most of the CPU.
+#
+# By default, don't create these groups:
+CREATE_DEFAULT=no
+
+# Uncomment following line to enable creation of the default group on startup:
+# CREATE_DEFAULT=yes
Index: 0.38-1/etc/cgsnapshot_blacklist.conf
===================================================================
--- 0.38-1/etc/cgsnapshot_blacklist.conf	(revision 0)
+++ 0.38-1/etc/cgsnapshot_blacklist.conf	(revision 19)
@@ -0,0 +1,20 @@
+#cgsnapshot tool configuration file
+
+#memory
+#memory.oom_control
+
+#cpu
+
+#cpuacct
+
+#devices
+
+#cpuset
+
+#ns
+
+#freezer
+
+#net_cls
+
+#blkio
Index: 0.38-1/etc/init.d/cgconfig
===================================================================
--- 0.38-1/etc/init.d/cgconfig	(revision 0)
+++ 0.38-1/etc/init.d/cgconfig	(revision 19)
@@ -0,0 +1,227 @@
+#!/bin/bash
+#
+# Start/Stop the workload manager
+#
+# Copyright IBM Corporation. 2008
+#
+# Authors:     Balbir Singh <balbir@linux.vnet.ibm.com>
+# Fixes for Debian Wheezy: Roman Chebotarev <RomanCh@artel.im>
+#
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of version 2.1 of the GNU Lesser General Public License
+# as published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it would be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+#
+# cgconfig Control Groups Configuration Startup
+# chkconfig: - 5 95
+# description: This script runs the cgconfigparser utility to parse and setup
+#              the control group filesystem. It uses /etc/cgconfig.conf
+#              and parses the configuration specified in there.
+
+### BEGIN INIT INFO
+# Provides:             cgconfig
+# Required-Start:
+# Required-Stop:
+# Default-Start:		2 3 4 5
+# Default-Stop:			0 1 6
+# Should-Start:         
+# Should-Stop:          
+# Short-Description:    Create and setup control group filesystem(s)
+# Description:          Create and setup control group filesystem(s)
+### END INIT INFO
+
+# get correct location of binaries from configure
+prefix=/usr
+exec_prefix=${prefix}
+sbindir=${exec_prefix}/sbin
+CGCONFIGPARSER_BIN=$sbindir/cgconfigparser
+CONFIG_FILE=/etc/cgconfig.conf
+servicename=cgconfig
+lockfile=/var/lock/$servicename
+
+#
+# Source LSB routines
+#
+. /lib/lsb/init-functions
+
+# read the config
+CREATE_DEFAULT=no
+if [ -e /etc/default/cgconfig ]
+then
+	. /etc/default/cgconfig
+fi
+
+create_default_groups() {
+	defaultcgroup=
+		if [ -f /etc/cgrules.conf ]
+		then
+			grep -m1 '^\*[[:space:]]\+' /etc/cgrules.conf | \
+			read user ctrl defaultcgroup
+			if [ -n "$defaultcgroup" -a "$defaultcgroup" = "*" ]; then
+				log_warning_msg "/etc/cgrules.conf incorrect"
+				log_warning_msg "Overriding it"
+				defaultcgroup=
+			fi
+		fi
+
+		if [ -z $defaultcgroup ]
+		then
+			defaultcgroup=sysdefault/
+		fi
+
+		#
+		# Find all mounted subsystems and create comma-separated list
+		# of controllers.
+		#
+		controllers=`lssubsys 2>/dev/null | tr '\n' ',' | sed s/.$//`
+
+		#
+		# Create the default group, ignore errors when the default group
+		# already exists.
+		#
+		cgcreate -f 664 -d 775 -g $controllers:$defaultcgroup 2>/dev/null
+
+		#
+		# special rule for cpusets
+		#
+		if echo $controllers | grep -q -w cpuset
+		then
+			cpus=`cgget -nv -r cpuset.cpus /`
+			cgset -r cpuset.cpus=$cpus $defaultcgroup
+			mems=`cgget -nv -r cpuset.mems /`
+			cgset -r cpuset.mems=$mems $defaultcgroup
+		fi
+
+		#
+		# Classify everything to default cgroup. Ignore errors, some processes
+		# may exit after ps is run and before cgclassify moves them.
+		#
+		cgclassify -g $controllers:$defaultcgroup `ps --no-headers -eL o tid` 2>/dev/null || :
+}
+
+start() {
+	echo -ne "Starting cgconfig service...\t\t"
+	if [ -f "$lockfile" ]
+	then
+		log_warning_msg "lock file already exists"
+		return 1
+	fi
+
+	if [ $? -eq 0 ]
+	then
+		if [ ! -s $CONFIG_FILE ]
+		then
+			log_failure_msg $CONFIG_FILE "is not configured"
+			return 6
+		fi
+
+		$CGCONFIGPARSER_BIN -l $CONFIG_FILE
+		retval=$?
+		if [ $retval -ne 0 ]
+		then
+			log_failure_msg "Failed to parse " $CONFIG_FILE
+			return 1
+		fi
+	fi
+
+	if [ $CREATE_DEFAULT = "yes" ]
+	then
+		create_default_groups
+	fi
+
+	touch "$lockfile"
+	retval=$?
+	if [ $retval -ne 0 ]
+	then
+		log_failure_msg "Failed to touch $lockfile"
+		return 1
+	fi
+	log_success_msg "Success"
+
+	return 0
+}
+
+stop() {
+    echo -ne "Stopping cgconfig service...\t\t"
+    cgclear && log_success_msg "Success" || log_failure_msg "Can't clear CGroups. Busy or already unmounted?"
+    rm -f "$lockfile"
+    return 0
+}
+
+trapped() {
+    #
+    # Do nothing
+    #
+    true
+}
+
+usage() {
+    echo "$0 <start|stop|restart|condrestart|status>"
+    exit 2
+}
+
+common() {
+    #
+    # main script work done here
+    #
+    trap "trapped ABRT" ABRT
+    trap "trapped QUIT" QUIT
+    trap "trapped TERM" TERM
+    trap "trapped INT"   INT
+}
+
+restart() {
+	common
+	stop
+	start
+}
+
+############# START EXECUTION #############
+
+RETVAL=0
+
+case $1 in
+    'stop')
+        common
+        stop
+        RETVAL=$?
+	;;
+
+    'start')
+        common
+        start
+        RETVAL=$?
+	;;
+
+    'restart'|'reload')
+		restart
+        RETVAL=$?
+	;;
+
+    'condrestart')
+        if [ -f "$lockfile" ]
+		then
+            restart
+            RETVAL=$?
+        fi
+	;;
+
+    'status')
+        if [ -f "$lockfile" ]; then
+            echo "Running"
+            exit 0
+        else
+            echo "Stopped"
+            exit 3
+        fi
+	;;
+
+    *)
+        usage
+	;;
+esac
+
+exit $RETVAL

Property changes on: 0.38-1/etc/init.d/cgconfig
___________________________________________________________________
Added: svn:executable
   + *

Index: 0.38-1/etc/init.d/cgred
===================================================================
--- 0.38-1/etc/init.d/cgred	(revision 0)
+++ 0.38-1/etc/init.d/cgred	(revision 19)
@@ -0,0 +1,240 @@
+#!/bin/bash
+#
+# Start/Stop the CGroups Rules Engine Daemon
+#
+# Copyright Red Hat Inc. 2008
+#
+# Authors:	Steve Olivieri <sjo@redhat.com>
+# Fixes for Debian Wheezy: Roman Chebotarev <RomanCh@artel.im>
+#
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of version 2.1 of the GNU Lesser General Public License
+# as published by the Free Software Foundation.
+# 
+# This program is distributed in the hope that it would be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+#
+# cgred		CGroups Rules Engine Daemon
+# chkconfig:	- 14 86
+# description:	This is a daemon for automatically classifying processes \
+#		into cgroups based on UID/GID.
+#
+# processname: cgrulesengd
+# pidfile: /var/run/cgred.pid
+#
+### BEGIN INIT INFO
+# Provides:		cgrulesengd
+# Required-Start:		$local_fs $syslog $cgconfig
+# Required-Stop:		$local_fs $syslog
+# Should-Start:		
+# Should-Stop:		
+# Default-Start:		2 3 4 5
+# Default-Stop:			0 1 6
+# Short-Description:	start and stop the cgroups rules engine daemon
+# Description:		CGroup Rules Engine is a tool for automatically using \
+#			cgroups to classify processes
+### END INIT INFO
+
+prefix=/usr
+exec_prefix=${prefix}
+sbindir=${exec_prefix}/sbin
+CGRED_BIN=$sbindir/cgrulesengd
+CGRED_CONF=/etc/cgrules.conf
+
+# Sanity checks
+[ -x $CGRED_BIN ] || exit 1
+
+# Source function library & LSB routines
+[ -f /etc/rc.d/init.d/functions ] && . /etc/rc.d/init.d/functions
+. /lib/lsb/init-functions
+
+# Read in configuration options.
+if [ -f "/etc/default/cgred" ] 
+then
+	. /etc/default/cgred
+	OPTIONS="$NODAEMON $LOG_LEVEL"
+
+	if [ -n "$LOG_FILE" ]
+	then
+		OPTIONS="$OPTIONS --logfile=$LOG_FILE"
+	fi
+
+	if [ -n "$SOCKET_USER" ]
+	then
+		OPTIONS="$OPTIONS -u $SOCKET_USER"
+	fi
+
+	if [ -n "$SOCKET_GROUP" ]
+	then
+		OPTIONS="$OPTIONS -g $SOCKET_GROUP"
+	fi
+else
+	OPTIONS=""
+fi
+
+# For convenience
+processname=cgrulesengd
+servicename=cgred
+lockfile="/var/lock/${servicename}"
+pidfile=/var/run/${servicename}.pid
+
+start()
+{
+	echo -ne $"Starting CGroup Rules Engine Daemon:\t\t"
+	if [ -f "$lockfile" ]
+	then
+		log_failure_msg "$servicename is already running with PID $(cat ${pidfile})"
+		return 1
+	fi
+
+	if [ ! -s $CGRED_CONF ]
+	then
+		log_failure_msg "not configured"
+		return 6
+	fi
+
+	if ! grep "^cgroup" /proc/mounts &>/dev/null
+	then
+		log_failure_msg $"Cannot find cgroups, is cgconfig service running?"
+		return 1
+	fi
+	
+	start-stop-daemon --start --quiet --pidfile $pidfile --exec $CGRED_BIN -- $OPTIONS
+	retval=$?
+
+	if [ $retval -ne 0 ]
+	then
+		return 7
+	fi
+
+	touch "$lockfile"
+	if [ $? -ne 0 ]
+	then
+		return 1
+	fi
+	echo "`pidof $processname`" > $pidfile
+
+	log_success_msg "Success"
+
+	return 0
+}
+
+stop()
+{
+	echo -en "Stopping CGroup Rules Engine Daemon...\t\t"
+	if [ ! -f $pidfile ]
+	then
+		log_warning_msg "PID file not found"
+		return 1
+	fi
+
+	start-stop-daemon --stop --quiet --pidfile $pidfile --exec $CGRED_BIN
+	retval=$?
+
+	if [ $retval -ne 0 ]
+	then
+		echo "Can't stop process with pid $(cat $pidfile). Already stopped?"
+	fi
+
+	rm -f "$lockfile" "$pidfile"
+
+	echo "Success"
+
+	return 0
+}
+
+status()
+{
+	echo -en "Get status for CGroup Rules Engine Daeon...\t\t"
+
+	if [ ! -f $pidfile ]
+	then
+		log_warning_msg "PID file not exist."
+	fi
+	start-stop-daemon --status --pidfile $pidfile
+	retval=$?
+	case $retval in
+		0)
+			echo Running
+		;;
+
+		1)
+			echo 'Not running, but pid exist. Crashed?'
+		;;
+
+		2)
+			echo Not running
+		;;
+
+		3)
+			echo "Can't get status"
+		;;
+		
+		*)
+			echo "Unknown status"
+		;;
+	esac
+	return $retval
+}
+
+############# START EXECUTION #############
+
+RETVAL=0
+
+# See how we are called
+case "$1" in
+	start)
+		start
+		RETVAL=$?
+	;;
+
+	stop)
+		stop
+		RETVAL=$?
+	;;
+
+	status)
+		status 
+		RETVAL=$?
+	;;
+
+	restart)
+		stop
+		start
+		RETVAL=$?
+	;;
+
+	condrestart)
+		if [ -f "$lockfile" ]
+		then
+			stop
+			start
+			RETVAL=$?
+		fi
+	;;
+
+	reload|flash)
+		echo -ne "Reloading rules configuration...\t\t"
+		if [ -f "$lockfile" ]
+		then
+			kill -SIGUSR2 $(cat ${pidfile})
+			RETVAL=$?
+			if [ $RETVAL -eq 0 ] ; then
+				log_success_msg "Success"
+			else
+				log_failure_msg "Fail"
+			fi
+		else
+			log_failure_msg "$servicename is not running"
+			RETVAL=1
+		fi
+	;;
+
+	*)
+		echo $"Usage: $0 {start|stop|status|restart|condrestart|reload}"
+		RETVAL=2
+	;;
+esac
+
+exit $RETVAL

Property changes on: 0.38-1/etc/init.d/cgred
___________________________________________________________________
Added: svn:executable
   + *

Index: 0.38-1/etc/cgrules.conf
===================================================================
--- 0.38-1/etc/cgrules.conf	(revision 0)
+++ 0.38-1/etc/cgrules.conf	(revision 19)
@@ -0,0 +1,51 @@
+# /etc/cgrules.conf
+#
+#Each line describes a rule for a user in the forms:
+#
+#<user>			<controllers>		<destination>
+#<user>:<process name>	<controllers>		<destination>
+#
+#Where:
+# <user> can be:
+#        - an user name
+#        - a group name, with @group syntax
+#        - the wildcard *, for any user or group.
+#        - The %, which is equivalent to "ditto". This is useful for
+#          multiline rules where different cgroups need to be specified
+#          for various hierarchies for a single user.
+#
+# <process name> is optional and it can be:
+#	 - a process name
+#	 - a full command path of a process
+#
+# <controller> can be:
+# 	 - comma separated controller names (no spaces)
+# 	 - * (for all mounted controllers)
+#
+# <destination> can be:
+# 	 - path with-in the controller hierarchy (ex. pgrp1/gid1/uid1)
+#
+# Note:
+# - It currently has rules based on uids, gids and process name.
+#
+# - Don't put overlapping rules. First rule which matches the criteria
+#   will be executed.
+#
+# - Multiline rules can be specified for specifying different cgroups
+#   for multiple hierarchies. In the example below, user "peter" has
+#   specified 2 line rule. First line says put peter's task in test1/
+#   dir for "cpu" controller and second line says put peter's tasks in
+#   test2/ dir for memory controller. Make a note of "%" sign in second line.
+#   This is an indication that it is continuation of previous rule.
+#
+#
+#<user>  	<controllers>  	<destination>
+#
+#john          cpu		usergroup/faculty/john/
+#john:cp       cpu		usergroup/faculty/john/cp
+#@student      cpu,memory	usergroup/student/
+#peter	       cpu		test1/
+#%	       memory		test2/
+#@root	    	*		admingroup/
+#*		*		default/
+# End of file
