From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id AFDC11381F3 for ; Tue, 16 Jul 2013 18:56:32 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 9A5BDE0A72; Tue, 16 Jul 2013 18:56:28 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id D8294E0A72 for ; Tue, 16 Jul 2013 18:56:27 +0000 (UTC) Received: from hornbill.gentoo.org (hornbill.gentoo.org [94.100.119.163]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id D9AA133E999 for ; Tue, 16 Jul 2013 18:56:26 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by hornbill.gentoo.org (Postfix) with ESMTP id 486EAE468F for ; Tue, 16 Jul 2013 18:56:25 +0000 (UTC) From: "William Hubbs" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "William Hubbs" Message-ID: <1372175907.2391ddff772ce541bc2237c89a2792a0b85e076c.WilliamH@OpenRC> Subject: [gentoo-commits] proj/openrc:master commit in: sh/ X-VCS-Repository: proj/openrc X-VCS-Files: sh/rc-cgroup.sh.in sh/runscript.sh.in X-VCS-Directories: sh/ X-VCS-Committer: WilliamH X-VCS-Committer-Name: William Hubbs X-VCS-Revision: 2391ddff772ce541bc2237c89a2792a0b85e076c X-VCS-Branch: master Date: Tue, 16 Jul 2013 18:56:25 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: a01efaae-5f01-47c6-b064-c7056db04a09 X-Archives-Hash: 11bbae769d7a4d8a88388e8aa11936f8 commit: 2391ddff772ce541bc2237c89a2792a0b85e076c Author: William Hubbs gmail com> AuthorDate: Tue Jun 25 15:50:13 2013 +0000 Commit: William Hubbs gentoo org> CommitDate: Tue Jun 25 15:58:27 2013 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=2391ddff cgroups: add support for systemd cgroup hierarchy The systemd cgroup hierarchy support is being added so we can run logind outside of systemd. This is needed because software that was using consolekit is now migrating to logind. We do not create this hierarchy, we just add services to it if it exists. --- sh/rc-cgroup.sh.in | 10 ++++++---- sh/runscript.sh.in | 4 ++++ 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/sh/rc-cgroup.sh.in b/sh/rc-cgroup.sh.in index d96aa16..afcbb03 100644 --- a/sh/rc-cgroup.sh.in +++ b/sh/rc-cgroup.sh.in @@ -70,15 +70,17 @@ cgroup_set_values() return 0 } -cgroup_set_limits() +cgroup_add_service() { - openrc_cgroup=/sys/fs/cgroup/openrc - if [ -d "$openrc_cgroup" ]; then - cgroup="$openrc_cgroup/$RC_SVCNAME" + if [ -d "$1" ]; then + cgroup="$1/$RC_SVCNAME" mkdir -p "$cgroup" [ -f "$cgroup/tasks" ] && echo 0 > "$cgroup/tasks" fi +} +cgroup_set_limits() +{ local blkio="${rc_cgroup_blkio:-$RC_CGROUP_BLKIO}" [ -n "$blkio" ] && cgroup_set_values blkio "$blkio" diff --git a/sh/runscript.sh.in b/sh/runscript.sh.in index 58e8eac..a1ed9c6 100644 --- a/sh/runscript.sh.in +++ b/sh/runscript.sh.in @@ -209,6 +209,10 @@ sourcex -e "@SYSCONFDIR@/rc.conf" [ -n "${rc_ulimit:-$RC_ULIMIT}" ] && ulimit ${rc_ulimit:-$RC_ULIMIT} # Apply cgroups settings if defined +if [ "$(command -v cgroup_add_service)" = "cgroup_add_service" ]; then + cgroup_add_service /sys/fs/cgroup/openrc + cgroup_add_service /sys/fs/cgroup/systemd/system +fi [ "$(command -v cgroup_set_limits)" = "cgroup_set_limits" ] && \ cgroup_set_limits