summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin H. Johnson <robbat2@gentoo.org>2015-08-08 13:49:04 -0700
committerRobin H. Johnson <robbat2@gentoo.org>2015-08-08 17:38:18 -0700
commit56bd759df1d0c750a065b8c845e93d5dfa6b549d (patch)
tree3f91093cdb475e565ae857f1c5a7fd339e2d781e /dev-libs/libcgroup
downloadgentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.tar.gz
gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.tar.bz2
gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.zip
proj/gentoo: Initial commit
This commit represents a new era for Gentoo: Storing the gentoo-x86 tree in Git, as converted from CVS. This commit is the start of the NEW history. Any historical data is intended to be grafted onto this point. Creation process: 1. Take final CVS checkout snapshot 2. Remove ALL ChangeLog* files 3. Transform all Manifests to thin 4. Remove empty Manifests 5. Convert all stale $Header$/$Id$ CVS keywords to non-expanded Git $Id$ 5.1. Do not touch files with -kb/-ko keyword flags. Signed-off-by: Robin H. Johnson <robbat2@gentoo.org> X-Thanks: Alec Warner <antarus@gentoo.org> - did the GSoC 2006 migration tests X-Thanks: Robin H. Johnson <robbat2@gentoo.org> - infra guy, herding this project X-Thanks: Nguyen Thai Ngoc Duy <pclouds@gentoo.org> - Former Gentoo developer, wrote Git features for the migration X-Thanks: Brian Harring <ferringb@gentoo.org> - wrote much python to improve cvs2svn X-Thanks: Rich Freeman <rich0@gentoo.org> - validation scripts X-Thanks: Patrick Lauer <patrick@gentoo.org> - Gentoo dev, running new 2014 work in migration X-Thanks: Michał Górny <mgorny@gentoo.org> - scripts, QA, nagging X-Thanks: All of other Gentoo developers - many ideas and lots of paint on the bikeshed
Diffstat (limited to 'dev-libs/libcgroup')
-rw-r--r--dev-libs/libcgroup/Manifest1
-rw-r--r--dev-libs/libcgroup/files/cgconfig.confd4
-rw-r--r--dev-libs/libcgroup/files/cgconfig.initd117
-rw-r--r--dev-libs/libcgroup/files/cgred.confd17
-rw-r--r--dev-libs/libcgroup/files/cgred.initd41
-rw-r--r--dev-libs/libcgroup/files/libcgroup-0.41-reorder-headers.patch28
-rw-r--r--dev-libs/libcgroup/files/libcgroup-0.41-replace_DECLS.patch225
-rw-r--r--dev-libs/libcgroup/files/libcgroup-0.41-replace_INLCUDES.patch74
-rw-r--r--dev-libs/libcgroup/libcgroup-0.41-r1.ebuild104
-rw-r--r--dev-libs/libcgroup/libcgroup-0.41.ebuild105
-rw-r--r--dev-libs/libcgroup/metadata.xml19
11 files changed, 735 insertions, 0 deletions
diff --git a/dev-libs/libcgroup/Manifest b/dev-libs/libcgroup/Manifest
new file mode 100644
index 000000000000..62dae46a1e56
--- /dev/null
+++ b/dev-libs/libcgroup/Manifest
@@ -0,0 +1 @@
+DIST libcgroup-0.41.tar.bz2 500120 SHA256 e4e38bdc7ef70645ce33740ddcca051248d56b53283c0dc6d404e17706f6fb51 SHA512 1aedb02cd2ce3bc2e2a328a247a92976ad0978ca4d3aee4eb671fbcc6bb270348efc78dcf84f27fc500f8bfb9bb57c7d6e4d429ef2bc69e4e5118b7cd895a6bd WHIRLPOOL 3941ec9362dd7da1c5d1b9eaf2b44303982a04d460ab92946201b1fe952c2f94e19950e9a08104c262eb982d8e64bcf290f1b95115aaba11d8b1457b715a3646
diff --git a/dev-libs/libcgroup/files/cgconfig.confd b/dev-libs/libcgroup/files/cgconfig.confd
new file mode 100644
index 000000000000..e41730ae0ea5
--- /dev/null
+++ b/dev-libs/libcgroup/files/cgconfig.confd
@@ -0,0 +1,4 @@
+# /etc/conf.d/cgconfig: config file for /etc/init.d/cgconfig
+
+# Configuration file location
+#CONFIG_FILE=/etc/cgroup/cgconfig.conf
diff --git a/dev-libs/libcgroup/files/cgconfig.initd b/dev-libs/libcgroup/files/cgconfig.initd
new file mode 100644
index 000000000000..65278f1eb479
--- /dev/null
+++ b/dev-libs/libcgroup/files/cgconfig.initd
@@ -0,0 +1,117 @@
+#!/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
+
+ 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}
+}
+
+umount_fs() {
+ local i
+ for i in $(seq 1 ${MAX_INDEX}); do
+ umount ${MOUNT_POINTS[$i]}
+ rmdir ${MOUNT_POINTS[$i]}
+ done
+}
+
+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() {
+ ebegin "Stopping cgconfig service"
+ parse_mounts
+ move_all_to_init_class
+ umount_fs
+ eend 0
+}
diff --git a/dev-libs/libcgroup/files/cgred.confd b/dev-libs/libcgroup/files/cgred.confd
new file mode 100644
index 000000000000..663ffc0c7dbd
--- /dev/null
+++ b/dev-libs/libcgroup/files/cgred.confd
@@ -0,0 +1,17 @@
+# /etc/conf.d/cgred.conf: config file for /etc/init.d/cgred
+
+# 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"
+
+# Uncomment the second line to disable logging for CGroup Rules Engine
+# Uncomment the third line to enable more verbose logging.
+#LOG=""
+LOG="--nolog"
+#LOG="-v"
+
+# PID file
+PID_FILE=/var/run/cgred.pid
diff --git a/dev-libs/libcgroup/files/cgred.initd b/dev-libs/libcgroup/files/cgred.initd
new file mode 100644
index 000000000000..9c14364adfdf
--- /dev/null
+++ b/dev-libs/libcgroup/files/cgred.initd
@@ -0,0 +1,41 @@
+#!/sbin/runscript
+#
+# CGroups Rules Engine Daemon
+#
+# This is a daemon for automatically classifying processes into cgroups based
+# on UID/GID.
+#
+opts="${opts} reload"
+
+CGRULESENGD="/usr/sbin/cgrulesengd"
+PID_FILE=${PID_FILE:-"/var/run/cgred.pid"}
+
+depend() {
+ need cgconfig
+ use logger
+}
+
+start() {
+ local options="${NODAEMON} ${LOG}"
+ if [[ -n "${LOG_FILE}" ]]; then
+ options="${options} --log-file=${LOG_FILE}"
+ fi
+
+ ebegin "Starting CGroup Rules Engine Daemon"
+ start-stop-daemon --start --pidfile "${PID_FILE}" --make-pidfile \
+ --background --exec "${CGRULESENGD}" -- ${options} >/dev/null
+ eend $?
+}
+
+stop() {
+ ebegin "Stopping CGroup Rules Engine Daemon"
+ start-stop-daemon --stop --pidfile "${PID_FILE}" --exec "${CGRULESENGD}"
+ eend $?
+}
+
+reload() {
+ ebegin "Reloading CGroup Rules Engine Daemon"
+ start-stop-daemon --stop --signal USR2 --oknodo --background \
+ --pidfile "${PID_FILE}" --make-pidfile --exec "${CGRULESENGD}"
+ eend $?
+}
diff --git a/dev-libs/libcgroup/files/libcgroup-0.41-reorder-headers.patch b/dev-libs/libcgroup/files/libcgroup-0.41-reorder-headers.patch
new file mode 100644
index 000000000000..78a3d09a3a08
--- /dev/null
+++ b/dev-libs/libcgroup/files/libcgroup-0.41-reorder-headers.patch
@@ -0,0 +1,28 @@
+libcgroup-internal.h: reorder the header stacking.
+
+`man 3 fts` not only specifies the headers to be included, but
+also the order. <fts.h> must be included after <sys/types.h>
+and <sys/stats.h>. On glibc and uClibc systems, an incorrect
+order does not pose a problem, but on musl this leads to undefine
+types such as dev_t and friends.
+
+Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
+
+diff -Naur libcgroup-0.41.orig/src/libcgroup-internal.h libcgroup-0.41/src/libcgroup-internal.h
+--- libcgroup-0.41.orig/src/libcgroup-internal.h 2015-07-13 21:08:26.740965713 -0400
++++ libcgroup-0.41/src/libcgroup-internal.h 2015-07-13 21:09:40.774962164 -0400
+@@ -21,12 +21,12 @@
+ #endif
+
+ #include "config.h"
+-#include <fts.h>
+ #include <libcgroup.h>
+ #include <limits.h>
+ #include <pthread.h>
+-#include <sys/stat.h>
+ #include <sys/types.h>
++#include <sys/stat.h>
++#include <fts.h>
+ #include <setjmp.h>
+
+ /* Maximum number of mount points/controllers */
diff --git a/dev-libs/libcgroup/files/libcgroup-0.41-replace_DECLS.patch b/dev-libs/libcgroup/files/libcgroup-0.41-replace_DECLS.patch
new file mode 100644
index 000000000000..770109310c67
--- /dev/null
+++ b/dev-libs/libcgroup/files/libcgroup-0.41-replace_DECLS.patch
@@ -0,0 +1,225 @@
+Replace __BEGIN_DECLS and __END_DECLS with extern "C".
+
+The macros __BEGIN_DECLS and __END_DECLS are a GNU-ism found in
+glibc and uClibc, but not musl. We replace them by the more general
+extern "C" { ... } block exposed only if we have __cplusplus.
+
+Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
+
+diff -Naur libcgroup-0.41.orig/include/libcgroup/config.h libcgroup-0.41/include/libcgroup/config.h
+--- libcgroup-0.41.orig/include/libcgroup/config.h 2014-01-13 14:05:56.000000000 +0000
++++ libcgroup-0.41/include/libcgroup/config.h 2015-07-11 23:19:20.451977284 +0000
+@@ -9,7 +9,9 @@
+ #include <features.h>
+ #endif
+
+-__BEGIN_DECLS
++#ifdef __cplusplus
++extern "C" {
++#endif
+
+ /**
+ * @defgroup group_config 5. Configuration
+@@ -107,6 +109,8 @@
+ * @}
+ * @}
+ */
+-__END_DECLS
++#ifdef __cplusplus
++}
++#endif
+
+ #endif /*_LIBCGROUP_CONFIG_H*/
+diff -Naur libcgroup-0.41.orig/include/libcgroup/error.h libcgroup-0.41/include/libcgroup/error.h
+--- libcgroup-0.41.orig/include/libcgroup/error.h 2014-01-13 14:05:56.000000000 +0000
++++ libcgroup-0.41/include/libcgroup/error.h 2015-07-11 23:19:34.253977328 +0000
+@@ -9,7 +9,9 @@
+ #include <features.h>
+ #endif
+
+-__BEGIN_DECLS
++#ifdef __cplusplus
++extern "C" {
++#endif
+
+ /**
+ * @defgroup group_errors 6. Error handling
+@@ -99,6 +101,8 @@
+ * @}
+ * @}
+ */
+-__END_DECLS
++#ifdef __cplusplus
++}
++#endif
+
+ #endif /* _LIBCGROUP_INIT_H */
+diff -Naur libcgroup-0.41.orig/include/libcgroup/groups.h libcgroup-0.41/include/libcgroup/groups.h
+--- libcgroup-0.41.orig/include/libcgroup/groups.h 2014-01-13 14:05:56.000000000 +0000
++++ libcgroup-0.41/include/libcgroup/groups.h 2015-07-11 23:19:40.305977347 +0000
+@@ -11,7 +11,9 @@
+ #include <stdbool.h>
+ #endif
+
+-__BEGIN_DECLS
++#ifdef __cplusplus
++extern "C" {
++#endif
+
+ /**
+ * Flags for cgroup_delete_cgroup_ext().
+@@ -577,6 +579,8 @@
+ */
+
+
+-__END_DECLS
++#ifdef __cplusplus
++}
++#endif
+
+ #endif /* _LIBCGROUP_GROUPS_H */
+diff -Naur libcgroup-0.41.orig/include/libcgroup/init.h libcgroup-0.41/include/libcgroup/init.h
+--- libcgroup-0.41.orig/include/libcgroup/init.h 2014-01-13 14:05:56.000000000 +0000
++++ libcgroup-0.41/include/libcgroup/init.h 2015-07-11 23:19:46.369977366 +0000
+@@ -9,7 +9,9 @@
+ #include <features.h>
+ #endif
+
+-__BEGIN_DECLS
++#ifdef __cplusplus
++extern "C" {
++#endif
+
+ /**
+ * @defgroup group_init 1. Initialization
+@@ -58,6 +60,8 @@
+ * @}
+ * @}
+ */
+-__END_DECLS
++#ifdef __cplusplus
++}
++#endif
+
+ #endif /* _LIBCGROUP_INIT_H */
+diff -Naur libcgroup-0.41.orig/include/libcgroup/iterators.h libcgroup-0.41/include/libcgroup/iterators.h
+--- libcgroup-0.41.orig/include/libcgroup/iterators.h 2014-01-13 14:05:56.000000000 +0000
++++ libcgroup-0.41/include/libcgroup/iterators.h 2015-07-11 23:19:53.353977388 +0000
+@@ -11,7 +11,9 @@
+ #include <features.h>
+ #endif
+
+-__BEGIN_DECLS
++#ifdef __cplusplus
++extern "C" {
++#endif
+
+ /**
+ * @defgroup group_iterators 3. Iterators
+@@ -423,6 +425,8 @@
+ * @}
+ */
+
+-__END_DECLS
++#ifdef __cplusplus
++}
++#endif
+
+ #endif /* _LIBCGROUP_ITERATORS_H */
+diff -Naur libcgroup-0.41.orig/include/libcgroup/log.h libcgroup-0.41/include/libcgroup/log.h
+--- libcgroup-0.41.orig/include/libcgroup/log.h 2014-01-13 14:05:56.000000000 +0000
++++ libcgroup-0.41/include/libcgroup/log.h 2015-07-11 23:19:58.922977406 +0000
+@@ -11,7 +11,9 @@
+
+ #include <stdarg.h>
+
+-__BEGIN_DECLS
++#ifdef __cplusplus
++extern "C" {
++#endif
+
+ /**
+ * @defgroup group_log 7. Logging
+@@ -142,6 +144,8 @@
+ * @}
+ * @}
+ */
+-__END_DECLS
++#ifdef __cplusplus
++}
++#endif
+
+ #endif /* _LIBCGROUP_LOG_H */
+diff -Naur libcgroup-0.41.orig/include/libcgroup/tasks.h libcgroup-0.41/include/libcgroup/tasks.h
+--- libcgroup-0.41.orig/include/libcgroup/tasks.h 2014-01-13 14:05:56.000000000 +0000
++++ libcgroup-0.41/include/libcgroup/tasks.h 2015-07-11 23:20:03.329977420 +0000
+@@ -12,7 +12,9 @@
+ #include <stdbool.h>
+ #endif
+
+-__BEGIN_DECLS
++#ifdef __cplusplus
++extern "C" {
++#endif
+
+ /** Flags for cgroup_change_cgroup_uid_gid(). */
+ enum cgflags {
+@@ -204,6 +206,8 @@
+ * @}
+ * @}
+ */
+-__END_DECLS
++#ifdef __cplusplus
++}
++#endif
+
+ #endif /* _LIBCGROUP_TASKS_H */
+diff -Naur libcgroup-0.41.orig/src/daemon/cgrulesengd.h libcgroup-0.41/src/daemon/cgrulesengd.h
+--- libcgroup-0.41.orig/src/daemon/cgrulesengd.h 2014-01-13 14:05:56.000000000 +0000
++++ libcgroup-0.41/src/daemon/cgrulesengd.h 2015-07-11 23:20:34.282977519 +0000
+@@ -17,7 +17,9 @@
+
+ #include <features.h>
+
+-__BEGIN_DECLS
++#ifdef __cplusplus
++extern "C" {
++#endif
+
+ #include "config.h"
+ #include "libcgroup.h"
+@@ -119,7 +121,9 @@
+ */
+ void cgre_catch_term(int signum);
+
+-__END_DECLS
++#ifdef __cplusplus
++}
++#endif
+
+ #endif /* _CGRULESENGD_H */
+
+diff -Naur libcgroup-0.41.orig/src/libcgroup-internal.h libcgroup-0.41/src/libcgroup-internal.h
+--- libcgroup-0.41.orig/src/libcgroup-internal.h 2015-07-11 23:16:37.497976764 +0000
++++ libcgroup-0.41/src/libcgroup-internal.h 2015-07-11 23:20:22.299977481 +0000
+@@ -16,7 +16,9 @@
+
+ #define __LIBCG_INTERNAL
+
+-__BEGIN_DECLS
++#ifdef __cplusplus
++extern "C" {
++#endif
+
+ #include "config.h"
+ #include <fts.h>
+@@ -279,6 +281,8 @@
+ */
+ int cg_chmod_path(const char *path, mode_t mode, int owner_is_umask);
+
+-__END_DECLS
++#ifdef __cplusplus
++}
++#endif
+
+ #endif
diff --git a/dev-libs/libcgroup/files/libcgroup-0.41-replace_INLCUDES.patch b/dev-libs/libcgroup/files/libcgroup-0.41-replace_INLCUDES.patch
new file mode 100644
index 000000000000..191de87d814d
--- /dev/null
+++ b/dev-libs/libcgroup/files/libcgroup-0.41-replace_INLCUDES.patch
@@ -0,0 +1,74 @@
+Replace INCLUDES with AM_CPPFLAGS in Makefile.am
+
+We replace the deprecated INCLUDES with AM_CPPFLAGS in all
+Makefile.am's.
+
+Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
+
+diff -Naur libcgroup-0.41.orig/src/Makefile.am libcgroup-0.41/src/Makefile.am
+--- libcgroup-0.41.orig/src/Makefile.am 2014-01-13 14:05:56.000000000 +0000
++++ libcgroup-0.41/src/Makefile.am 2015-07-13 14:36:38.922428040 +0000
+@@ -9,7 +9,7 @@
+
+ CLEANFILES = lex.c parse.c parse.h
+
+-INCLUDES = -I$(top_srcdir)/include
++AM_CPPFLAGS = -I$(top_srcdir)/include
+ lib_LTLIBRARIES = libcgroup.la
+ libcgroup_la_SOURCES = parse.h parse.y lex.l api.c config.c libcgroup-internal.h libcgroup.map wrapper.c log.c
+ libcgroup_la_LIBADD = -lpthread
+diff -Naur libcgroup-0.41.orig/src/bindings/Makefile.am libcgroup-0.41/src/bindings/Makefile.am
+--- libcgroup-0.41.orig/src/bindings/Makefile.am 2014-01-13 14:05:56.000000000 +0000
++++ libcgroup-0.41/src/bindings/Makefile.am 2015-07-13 14:37:12.267428146 +0000
+@@ -1,5 +1,5 @@
+ SUBDIRS = .
+-INCLUDES = -I$(top_srcdir)/include
++AM_CPPFLAGS = -I$(top_srcdir)/include
+
+ lib_LTLIBRARIES = _libcgroup.la
+ _libcgroup_la_SOURCES = libcgroup.c
+@@ -11,5 +11,5 @@
+
+ libcgroup.c: libcgroup.p $(top_srcdir)/include/libcgroup.h
+ cp libcgroup.p libcgroup.i
+- $(CC) $(INCLUDES) -DSWIG -E $(top_srcdir)/include/libcgroup.h >> libcgroup.i
++ $(CC) $(CPPFLAGS) -DSWIG -E $(top_srcdir)/include/libcgroup.h >> libcgroup.i
+ $(SWIG) -python -o libcgroup.c libcgroup.i
+diff -Naur libcgroup-0.41.orig/src/daemon/Makefile.am libcgroup-0.41/src/daemon/Makefile.am
+--- libcgroup-0.41.orig/src/daemon/Makefile.am 2014-01-13 14:05:56.000000000 +0000
++++ libcgroup-0.41/src/daemon/Makefile.am 2015-07-13 14:36:55.781428093 +0000
+@@ -1,4 +1,4 @@
+-INCLUDES = -I $(top_srcdir)/include
++AM_CPPFLAGS = -I $(top_srcdir)/include
+
+ if WITH_DAEMON
+
+diff -Naur libcgroup-0.41.orig/src/pam/Makefile.am libcgroup-0.41/src/pam/Makefile.am
+--- libcgroup-0.41.orig/src/pam/Makefile.am 2014-01-13 14:05:56.000000000 +0000
++++ libcgroup-0.41/src/pam/Makefile.am 2015-07-13 14:36:28.768428007 +0000
+@@ -1,4 +1,4 @@
+-INCLUDES = -I $(top_srcdir)/include
++AM_CPPFLAGS = -I $(top_srcdir)/include
+
+ if WITH_PAM
+
+diff -Naur libcgroup-0.41.orig/src/tools/Makefile.am libcgroup-0.41/src/tools/Makefile.am
+--- libcgroup-0.41.orig/src/tools/Makefile.am 2014-01-13 14:05:56.000000000 +0000
++++ libcgroup-0.41/src/tools/Makefile.am 2015-07-13 14:36:19.098427976 +0000
+@@ -1,4 +1,4 @@
+-INCLUDES = -I$(top_srcdir)/src -I$(top_srcdir)/include
++AM_CPPFLAGS = -I$(top_srcdir)/src -I$(top_srcdir)/include
+ LDADD = $(top_builddir)/src/.libs/libcgroup.la
+
+ if WITH_TOOLS
+diff -Naur libcgroup-0.41.orig/tests/Makefile.am libcgroup-0.41/tests/Makefile.am
+--- libcgroup-0.41.orig/tests/Makefile.am 2014-01-13 14:05:56.000000000 +0000
++++ libcgroup-0.41/tests/Makefile.am 2015-07-13 14:37:23.146428181 +0000
+@@ -1,6 +1,6 @@
+ SUBDIRS = tools
+
+-INCLUDES = -I$(top_srcdir)/include
++AM_CPPFLAGS = -I$(top_srcdir)/include
+ LDADD = $(top_builddir)/src/.libs/libcgroup.la
+
+ # compile the tests, but do not install them
diff --git a/dev-libs/libcgroup/libcgroup-0.41-r1.ebuild b/dev-libs/libcgroup/libcgroup-0.41-r1.ebuild
new file mode 100644
index 000000000000..439a6429920c
--- /dev/null
+++ b/dev-libs/libcgroup/libcgroup-0.41-r1.ebuild
@@ -0,0 +1,104 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="5"
+
+inherit autotools eutils flag-o-matic linux-info pam
+
+DESCRIPTION="Tools and libraries to configure and manage kernel control groups"
+HOMEPAGE="http://libcg.sourceforge.net/"
+SRC_URI="mirror://sourceforge/project/libcg/${PN}/v${PV}/${P}.tar.bz2"
+
+LICENSE="LGPL-2.1"
+SLOT="0"
+KEYWORDS="~amd64 ~ppc ~ppc64 ~x86"
+IUSE="+daemon elibc_musl pam static-libs +tools"
+
+RDEPEND="pam? ( virtual/pam )"
+
+DEPEND="
+ ${RDEPEND}
+ sys-devel/bison
+ sys-devel/flex
+ elibc_musl? ( sys-libs/fts-standalone )
+ "
+REQUIRED_USE="daemon? ( tools )"
+
+DOCS=(README_daemon README README_systemd INSTALL)
+pkg_setup() {
+ local CONFIG_CHECK="~CGROUPS"
+ if use daemon; then
+ CONFIG_CHECK="${CONFIG_CHECK} ~CONNECTOR ~PROC_EVENTS"
+ fi
+ linux-info_pkg_setup
+}
+
+src_prepare() {
+ epatch "${FILESDIR}"/${P}-replace_DECLS.patch
+ epatch "${FILESDIR}"/${P}-replace_INLCUDES.patch
+ epatch "${FILESDIR}"/${P}-reorder-headers.patch
+
+ # Change rules file location
+ sed -e 's:/etc/cgrules.conf:/etc/cgroup/cgrules.conf:' \
+ -i src/libcgroup-internal.h || die "sed failed"
+ sed -e 's:\(pam_cgroup_la_LDFLAGS.*\):\1\ -avoid-version:' \
+ -i src/pam/Makefile.am || die "sed failed"
+ sed -e 's#/var/run#/run#g' -i configure.in || die "sed failed"
+
+ eautoreconf
+}
+
+src_configure() {
+ local my_conf
+
+ if use pam; then
+ my_conf=" --enable-pam-module-dir=$(getpam_mod_dir) "
+ fi
+
+ use elibc_musl && append-ldflags "-lfts"
+ econf \
+ $(use_enable daemon) \
+ $(use_enable pam) \
+ $(use_enable tools) \
+ ${my_conf}
+}
+
+src_test() {
+ # Use mount cgroup to build directory
+ # sandbox restricted to trivial build,
+ # possible kill Diego tanderbox ;)
+ true
+}
+
+src_install() {
+ prune_libtool_files --all
+
+ insinto /etc/cgroup
+ doins samples/*.conf || die
+
+ if use tools; then
+ newconfd "${FILESDIR}"/cgconfig.confd cgconfig || die
+ newinitd "${FILESDIR}"/cgconfig.initd cgconfig || die
+ fi
+
+ if use daemon; then
+ newconfd "${FILESDIR}"/cgred.confd cgred || die
+ newinitd "${FILESDIR}"/cgred.initd cgred || die
+ fi
+}
+
+pkg_postinst() {
+ elog "Read the kernel docs on cgroups, related schedulers, and the"
+ elog "block I/O controllers. The Redhat Resource Management Guide"
+ elog "is also helpful. DO NOT enable the cgroup namespace subsytem"
+ elog "if you want a custom config, rule processing, etc. This option"
+ elog "should only be enabled for a VM environment. The UID wildcard"
+ elog "rules seem to work only without a custom config (since wildcards"
+ elog "don't work in config blocks). Specific user-id configs *do*"
+ elog "work, but be careful about how the mem limits add up if using"
+ elog "the memory.limit_* directives. There should be a basic task"
+ elog "partitioning into the default group when running cgred with no"
+ elog "specific config blocks or rules (other than the mount directive)."
+ elog "See the docs for the pam module config, and as always, RTFM..."
+}
diff --git a/dev-libs/libcgroup/libcgroup-0.41.ebuild b/dev-libs/libcgroup/libcgroup-0.41.ebuild
new file mode 100644
index 000000000000..df8b956101bb
--- /dev/null
+++ b/dev-libs/libcgroup/libcgroup-0.41.ebuild
@@ -0,0 +1,105 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="5"
+
+AUTOTOOLS_AUTORECONF=1
+
+inherit eutils linux-info pam autotools-utils
+
+DESCRIPTION="Tools and libraries to configure and manage kernel control groups"
+HOMEPAGE="http://libcg.sourceforge.net/"
+SRC_URI="mirror://sourceforge/project/libcg/${PN}/v${PV}/${P}.tar.bz2"
+
+LICENSE="LGPL-2.1"
+SLOT="0"
+KEYWORDS="amd64 ppc ~ppc64 x86"
+IUSE="+daemon debug pam static-libs +tools debug"
+
+RDEPEND="pam? ( virtual/pam )"
+
+DEPEND="
+ ${RDEPEND}
+ sys-devel/bison
+ sys-devel/flex
+ "
+REQUIRED_USE="daemon? ( tools )"
+
+DOCS=(README_daemon README README_systemd INSTALL)
+pkg_setup() {
+ local CONFIG_CHECK="~CGROUPS"
+ if use daemon; then
+ CONFIG_CHECK="${CONFIG_CHECK} ~CONNECTOR ~PROC_EVENTS"
+ fi
+ linux-info_pkg_setup
+}
+
+src_prepare() {
+
+ # Change rules file location
+ sed -e 's:/etc/cgrules.conf:/etc/cgroup/cgrules.conf:' \
+ -i src/libcgroup-internal.h || die "sed failed"
+ sed -e 's:\(pam_cgroup_la_LDFLAGS.*\):\1\ -avoid-version:' \
+ -i src/pam/Makefile.am || die "sed failed"
+ sed -e 's#/var/run#/run#g' -i configure.in || die "sed failed"
+
+ autotools-utils_src_prepare
+}
+
+src_configure() {
+ local my_conf
+
+ if use pam; then
+ my_conf=" --enable-pam-module-dir=$(getpam_mod_dir) "
+ fi
+
+ local myeconfargs=(
+ $(use_enable daemon)
+ $(use_enable debug)
+ $(use_enable pam)
+ $(use_enable tools)
+ ${my_conf}
+ )
+ autotools-utils_src_configure
+}
+
+src_test() {
+ # Use mount cgroup to build directory
+ # sandbox restricted to trivial build,
+ # possible kill Diego tanderbox ;)
+ true
+}
+
+src_install() {
+ autotools-utils_src_install
+ prune_libtool_files --all
+
+ insinto /etc/cgroup
+ doins samples/*.conf || die
+
+ if use tools; then
+ newconfd "${FILESDIR}"/cgconfig.confd cgconfig || die
+ newinitd "${FILESDIR}"/cgconfig.initd cgconfig || die
+ fi
+
+ if use daemon; then
+ newconfd "${FILESDIR}"/cgred.confd cgred || die
+ newinitd "${FILESDIR}"/cgred.initd cgred || die
+ fi
+}
+
+pkg_postinst() {
+ elog "Read the kernel docs on cgroups, related schedulers, and the"
+ elog "block I/O controllers. The Redhat Resource Management Guide"
+ elog "is also helpful. DO NOT enable the cgroup namespace subsytem"
+ elog "if you want a custom config, rule processing, etc. This option"
+ elog "should only be enabled for a VM environment. The UID wildcard"
+ elog "rules seem to work only without a custom config (since wildcards"
+ elog "don't work in config blocks). Specific user-id configs *do*"
+ elog "work, but be careful about how the mem limits add up if using"
+ elog "the memory.limit_* directives. There should be a basic task"
+ elog "partitioning into the default group when running cgred with no"
+ elog "specific config blocks or rules (other than the mount directive)."
+ elog "See the docs for the pam module config, and as always, RTFM..."
+}
diff --git a/dev-libs/libcgroup/metadata.xml b/dev-libs/libcgroup/metadata.xml
new file mode 100644
index 000000000000..a9bc388e0b4d
--- /dev/null
+++ b/dev-libs/libcgroup/metadata.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer>
+ <email>blueness@gentoo.org</email>
+ <name>Anthony G. Basile</name>
+ </maintainer>
+ <longdescription>
+ This package provides configuration and command-line tools, as well as a
+ rules processing daemon for working with kernel control groups.
+ </longdescription>
+ <use>
+ <flag name="daemon">Install the configuration tools and init/config files.</flag>
+ <flag name="tools">Install the cgroup rules processing daemon and init/config files.</flag>
+ </use>
+ <upstream>
+ <remote-id type="sourceforge">libcg</remote-id>
+ </upstream>
+</pkgmetadata>