diff options
Diffstat (limited to 'dev-libs/libcgroup')
-rw-r--r-- | dev-libs/libcgroup/Manifest | 14 | ||||
-rw-r--r-- | dev-libs/libcgroup/files/cgconfig.confd | 4 | ||||
-rw-r--r-- | dev-libs/libcgroup/files/cgconfig.confd-r1 | 7 | ||||
-rw-r--r-- | dev-libs/libcgroup/files/cgconfig.initd | 117 | ||||
-rw-r--r-- | dev-libs/libcgroup/files/cgconfig.initd-r1 | 52 | ||||
-rw-r--r-- | dev-libs/libcgroup/files/cgred.confd | 17 | ||||
-rw-r--r-- | dev-libs/libcgroup/files/cgred.confd-r2 | 5 | ||||
-rw-r--r-- | dev-libs/libcgroup/files/cgred.initd | 41 | ||||
-rw-r--r-- | dev-libs/libcgroup/files/cgred.initd-r1 | 23 | ||||
-rw-r--r-- | dev-libs/libcgroup/files/libcgroup-0.41-reorder-headers.patch | 28 | ||||
-rw-r--r-- | dev-libs/libcgroup/files/libcgroup-0.41-replace_DECLS.patch | 225 | ||||
-rw-r--r-- | dev-libs/libcgroup/files/libcgroup-0.41-replace_INLCUDES.patch | 74 | ||||
-rw-r--r-- | dev-libs/libcgroup/libcgroup-0.41-r4.ebuild | 95 | ||||
-rw-r--r-- | dev-libs/libcgroup/metadata.xml | 19 |
14 files changed, 721 insertions, 0 deletions
diff --git a/dev-libs/libcgroup/Manifest b/dev-libs/libcgroup/Manifest new file mode 100644 index 000000000000..bceaa8c2743d --- /dev/null +++ b/dev-libs/libcgroup/Manifest @@ -0,0 +1,14 @@ +AUX cgconfig.confd 131 BLAKE2B f27cde041032bf921c76b3911283021c5106d1cca47455fe72b95d83a07e98438f832bf0e3c2b78ac2b69b042e1c0e0c10bfa3d6472570c6f5847d28556e6b6b SHA512 9bb289c20c3230414888e82be2b7a1389ac652143bcbbc746d0731c46a2f1404b4bc8154c90b59ebc53520107fe2f04c9eb5df742451887947b8a3b7a4c31f00 +AUX cgconfig.confd-r1 205 BLAKE2B e68daec204e2daa5103bcba2e2e40cd93c9e3d97d85927f21f84443efb8281bdb2464f75f0b9e33244557d4b119e32d774191c20a3e7d50752a2df2204cfda5d SHA512 f5f1d0d09266417276f93434ad47116452e1ab18d736ce08e7c63f797b2d2180a490cdef1f3dd9d960c88426f1dc5b12dcf72b09de765d52d281feceffe7550d +AUX cgconfig.initd 2923 BLAKE2B 5a7ba5cb3ce260dae0b20a428e6d8787d8749e14109273610a329f9d1daa15ed3d641e246e32e7721aa3c186ecc75ebe7f87dbf3a5f1fc3ece1b8da3755c64a4 SHA512 705b6df9ac93e8978dc697c497344096cad2b01961eb5c7b4a3ab89e80dc904b5d0076ad3b1e0478e1a86bcffe37b37591f001efcb21eb6f8b68cd14edc7c006 +AUX cgconfig.initd-r1 1052 BLAKE2B 6da1fed6741a9f21e31506f6306a5a10d8e82ed1e65ed0b53e6ee466d5496b25f5aaf521a037755d6ee87bb4c520a7915880f040ba99dd6a0f8f279d913bb810 SHA512 66303411c98355b1fe5e0eb58b797887f9971604902afb2f95738b64b1fd9dd42fc8cb22c65e10c264d68ef2d7cd85f58247fed08d650ccbe0a5756ec780ea3c +AUX cgred.confd 485 BLAKE2B 93bb177b184deb718836e0abba411fd6f007cf376bebe2babe8f6567df3255ee3316c2b7a2e14a5a31f141b2dcf0fa55c199ebc54a795e125f00dcfcd2155752 SHA512 871b7e7df26bf6b4164d5ec04e9998b0bd3f354e75ba2306b330e382eadd38ad044f85cfaa122a5a2e600fb4f39e1a7fe7778551a05dfc3e0ae095621c965996 +AUX cgred.confd-r2 160 BLAKE2B 17bc7c1ce54d490071324a670ecb150027e322c938f305930330a8505af3b9f332e8a80b25ae65a363319c2e14b071a4544713179cbf6882d92063e744bf4bda SHA512 5b83b2413e36184671cfd7d654fa0b06940360790aed3c235cdb8eb168c17a703c1a72654fdbf57459ac493f79fd87e90deb33e89297929ca5f681dfa80a7078 +AUX cgred.initd 950 BLAKE2B eb42533e40d33af728a460bb495a62a39662cea47edbb2223c880092ea9b792423ad4a1873a2b14846de8640bad575bb7bd5196bddaa565745487cc2fe658cf5 SHA512 cfa70c25c40c29d3dc1249f808f58365fa5ec09f4918edd971ac088a33a810cefa15c7ccf5b7ce75813301b104bf5fad23f752363600c10af7f1ecbb30f4aa15 +AUX cgred.initd-r1 457 BLAKE2B 6d2a79af91daaf77be9530d69473aa8b67c24fc7be2366486b2c2e82ae8962160576d8d778c5ac817aeb17a9371b1db0127853a4c431844d268a9e371755a8f1 SHA512 2ef66c697b56e4c29c4a224480a6a7270205359d254c07847e57feb8d5e219cd0d0c2c4f6161f9e6c001f14a9419f9be18b3fd1750d7b4e5a0082985821062bc +AUX libcgroup-0.41-reorder-headers.patch 953 BLAKE2B dcc4936227cfc67ddc0c32b207403326236b22a05814349385833a887598014277e99744825e4d6ec0e64ccdf35bb19b470d685d5f2ebf1957130ea1af071a01 SHA512 4f8d4b49668dc0ddae373ab922422a0e933cb6c46af05d01da498c657b5a8df1ea62e644b8ac3db7e7818d33ba21c06d1902b7915f6aaf76f8f96107515433d4 +AUX libcgroup-0.41-replace_DECLS.patch 5193 BLAKE2B d22bded7e356b31e9f1e8ceec50f7987311f36453ffd13acaf48e95eacce06052c19a89aedfbcd068218a5fdefc26e5aec737d1c00576f25fdef0b1fe658513a SHA512 c7601810e491764c30e8adfadd65e1b1b578a07af24df62cc9a7b291622d806fc196a98e01957b5acbd3bca072617bd0ff54cae200a8e6c21b5cca4d18cd45db +AUX libcgroup-0.41-replace_INLCUDES.patch 3064 BLAKE2B 1947d306117beb62dba48d46b9e3caa7e2d5195c6d661b2d061c982220b7d3d92d42d4ef23172e34bf32be2e54b6c82c531aa839432e0489c2abe463b93e25f4 SHA512 17c8fa471347da4973969b954f966501d54889050766dfdd225235dd4539bb4249d57e719fa7a894aadc2e0f7296d233c89c44c96291a9266c958ca3a319541b +DIST libcgroup-0.41.tar.bz2 500120 BLAKE2B 3410b430aa58613b5b9abedba05bef99b1b8a1fd619d55fb446ab951e052a336efc918879217055bceee886a03d97c3ff46028a87e8231212653a886cfb80521 SHA512 1aedb02cd2ce3bc2e2a328a247a92976ad0978ca4d3aee4eb671fbcc6bb270348efc78dcf84f27fc500f8bfb9bb57c7d6e4d429ef2bc69e4e5118b7cd895a6bd +EBUILD libcgroup-0.41-r4.ebuild 2238 BLAKE2B f75aebe90185575c88a447cf21f16044f0a59a45e8b5489a7bccfd000e62294039bbd9e71579bd5ae1beee572a078ffcdff63a8f8cd71bcdc53ef0cf8d8e9ba6 SHA512 0e480164da2bcf1da53a63d9d41afe645d4cdb3d2559b1dced7973381eda939d123e088b174a37410a01b2afe5134ebbe95faa46f28a2ca5d544d4e8db0813c7 +MISC metadata.xml 700 BLAKE2B 4638c1287da7cb72c04f77ab1f8c9a46888f0c45194a1221fcc03e2f0ea0b148e7edd4608d2bf61a527dcd8f1701f91a123ecde3118b5f93bad67e56afd6e714 SHA512 faddc728ee6971cbf5e52bc89999f3bec9d312fe04d2c876a2ee69e6533ca1ba85350d0b504bff0c7da668b58a3531606fb3d67cb4f6925c08f65df2190ec0c1 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.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 b/dev-libs/libcgroup/files/cgconfig.initd new file mode 100644 index 000000000000..f182b92ff843 --- /dev/null +++ b/dev-libs/libcgroup/files/cgconfig.initd @@ -0,0 +1,117 @@ +#!/sbin/openrc-run +# +# 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/cgconfig.initd-r1 b/dev-libs/libcgroup/files/cgconfig.initd-r1 new file mode 100644 index 000000000000..e0fef9caab21 --- /dev/null +++ b/dev-libs/libcgroup/files/cgconfig.initd-r1 @@ -0,0 +1,52 @@ +#!/sbin/openrc-run +# Copyright 1999-2015 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +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 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.confd-r2 b/dev-libs/libcgroup/files/cgred.confd-r2 new file mode 100644 index 000000000000..cdc7a7c51cf3 --- /dev/null +++ b/dev-libs/libcgroup/files/cgred.confd-r2 @@ -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="-n" diff --git a/dev-libs/libcgroup/files/cgred.initd b/dev-libs/libcgroup/files/cgred.initd new file mode 100644 index 000000000000..d507e09a8154 --- /dev/null +++ b/dev-libs/libcgroup/files/cgred.initd @@ -0,0 +1,41 @@ +#!/sbin/openrc-run +# +# 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/cgred.initd-r1 b/dev-libs/libcgroup/files/cgred.initd-r1 new file mode 100644 index 000000000000..6aa697f2d0b7 --- /dev/null +++ b/dev-libs/libcgroup/files/cgred.initd-r1 @@ -0,0 +1,23 @@ +#!/sbin/openrc-run +# Copyright 1999-2015 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +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 $? +} 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-r4.ebuild b/dev-libs/libcgroup/libcgroup-0.41-r4.ebuild new file mode 100644 index 000000000000..67b609f2dfec --- /dev/null +++ b/dev-libs/libcgroup/libcgroup-0.41-r4.ebuild @@ -0,0 +1,95 @@ +# Copyright 1999-2018 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +EAPI=6 + +inherit autotools 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 +} + +PATCHES=( + "${FILESDIR}"/${P}-replace_DECLS.patch + "${FILESDIR}"/${P}-replace_INLCUDES.patch + "${FILESDIR}"/${P}-reorder-headers.patch +) + +src_prepare() { + default + # 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:/etc/cgconfig.conf:/etc/cgroup/cgconfig.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 static-libs static) \ + $(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() { + default + prune_libtool_files --all + + insinto /etc/cgroup + doins samples/*.conf || die + + if use tools; then + newconfd "${FILESDIR}"/cgconfig.confd-r1 cgconfig || die + newinitd "${FILESDIR}"/cgconfig.initd-r1 cgconfig || die + fi + + if use daemon; then + newconfd "${FILESDIR}"/cgred.confd-r2 cgred || die + newinitd "${FILESDIR}"/cgred.initd-r1 cgred || die + fi +} diff --git a/dev-libs/libcgroup/metadata.xml b/dev-libs/libcgroup/metadata.xml new file mode 100644 index 000000000000..c35d422f9d07 --- /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 type="person"> + <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> |