summaryrefslogtreecommitdiff
path: root/src/basic/virt.c
diff options
context:
space:
mode:
authorTom Gundersen <teg@jklm.no>2015-10-27 16:55:16 +0100
committerTom Gundersen <teg@jklm.no>2015-10-27 16:55:16 +0100
commit0d0696812980d8f41c54739ad73716a233a2fa7c (patch)
tree217d98308a3039e106efde5fd6a7b6a657916950 /src/basic/virt.c
parentf47fc3ffc4b69a00083a76308f777b52afb8efbf (diff)
parent7760171904ef007f19e8f46aa240a00e382d5b74 (diff)
Merge pull request #1691 from poettering/util-lib-3
split up util.h and macro.h into even more bits
Diffstat (limited to 'src/basic/virt.c')
-rw-r--r--src/basic/virt.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/basic/virt.c b/src/basic/virt.c
index 9267a2730b..fb181e5b55 100644
--- a/src/basic/virt.c
+++ b/src/basic/virt.c
@@ -23,8 +23,11 @@
#include <string.h>
#include <unistd.h>
+#include "alloc-util.h"
#include "fileio.h"
#include "process-util.h"
+#include "stat-util.h"
+#include "string-table.h"
#include "string-util.h"
#include "util.h"
#include "virt.h"
@@ -411,6 +414,16 @@ int detect_virtualization(void) {
return detect_vm();
}
+int running_in_chroot(void) {
+ int ret;
+
+ ret = files_same("/proc/1/root", "/");
+ if (ret < 0)
+ return ret;
+
+ return ret == 0;
+}
+
static const char *const virtualization_table[_VIRTUALIZATION_MAX] = {
[VIRTUALIZATION_NONE] = "none",
[VIRTUALIZATION_KVM] = "kvm",