public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "William Hubbs" <williamh@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/openrc:master commit in: src/librc/, man/, etc/
Date: Wed,  2 Dec 2015 16:22:33 +0000 (UTC)	[thread overview]
Message-ID: <1449073215.9fedb3b40b5983372b2c2de29dfe321c6dfaadf4.williamh@OpenRC> (raw)

commit:     9fedb3b40b5983372b2c2de29dfe321c6dfaadf4
Author:     William Hubbs <w.d.hubbs <AT> gmail <DOT> com>
AuthorDate: Wed Dec  2 00:20:02 2015 +0000
Commit:     William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Wed Dec  2 16:20:15 2015 +0000
URL:        https://gitweb.gentoo.org/proj/openrc.git/commit/?id=9fedb3b4

Add detection for docker containers

 etc/rc.conf.Linux | 1 +
 man/openrc-run.8  | 2 ++
 src/librc/librc.c | 4 ++++
 src/librc/rc.h.in | 1 +
 4 files changed, 8 insertions(+)

diff --git a/etc/rc.conf.Linux b/etc/rc.conf.Linux
index f04f96e..0865075 100644
--- a/etc/rc.conf.Linux
+++ b/etc/rc.conf.Linux
@@ -3,6 +3,7 @@
 
 # This is the subsystem type. Valid options on Linux:
 # ""               - nothing special
+# "docker"         - Docker container manager
 # "lxc"            - Linux Containers
 # "openvz"         - Linux OpenVZ
 # "prefix"         - Prefix

diff --git a/man/openrc-run.8 b/man/openrc-run.8
index 12c1919..9e0e776 100644
--- a/man/openrc-run.8
+++ b/man/openrc-run.8
@@ -223,6 +223,8 @@ Same as -jail, but for VServer systems.
 Same as -jail, but for Xen DOM0 systems.
 .It Dv -xenu
 Same as -jail, but for Xen DOMU systems.
+.It Dv -docker
+Same as -jail, but for docker systems.
 .El
 .El
 .Pp

diff --git a/src/librc/librc.c b/src/librc/librc.c
index 5e5de8d..cad8033 100644
--- a/src/librc/librc.c
+++ b/src/librc/librc.c
@@ -269,6 +269,8 @@ rc_sys(void)
 			return RC_SYS_LXC;
 		if (strcmp(systype, RC_SYS_SYSTEMD_NSPAWN) == 0)
 				return RC_SYS_SYSTEMD_NSPAWN;
+		if (strcmp(systype, RC_SYS_DOCKER) == 0)
+				return RC_SYS_DOCKER;
 	}
 	if (exists("/proc/xen")) {
 		if (file_regex("/proc/xen/capabilities", "control_d"))
@@ -288,6 +290,8 @@ rc_sys(void)
 		return RC_SYS_LXC;
 	else if (file_regex("/proc/1/environ", "container=systemd-nspawn"))
 		return RC_SYS_SYSTEMD_NSPAWN;
+	else if (file_regex("/proc/1/environ", "container=docker"))
+		return RC_SYS_DOCKER;
 #endif
 
 	return NULL;

diff --git a/src/librc/rc.h.in b/src/librc/rc.h.in
index 141ecb9..360c26a 100644
--- a/src/librc/rc.h.in
+++ b/src/librc/rc.h.in
@@ -329,6 +329,7 @@ bool rc_service_daemons_crashed(const char *);
 /*! @name System types
  * OpenRC can support some special sub system types, normally virtualization.
  * Some services cannot work in these systems, or we do something else. */
+#define RC_SYS_DOCKER  "DOCKER"
 #define RC_SYS_JAIL    "JAIL"
 #define RC_SYS_OPENVZ  "OPENVZ"
 #define RC_SYS_LXC     "LXC"


                 reply	other threads:[~2015-12-02 16:22 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1449073215.9fedb3b40b5983372b2c2de29dfe321c6dfaadf4.williamh@OpenRC \
    --to=williamh@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox