[PATCH v1] procd: Adding support to detect Pantavisor Container Platform

Gaurav Pathak gaurav.pathak at pantacor.com
Sun Mar 21 13:14:33 GMT 2021


Modified container.h to detect the pantavisor container platform,
as it runs a custom modified version of LXC. container.h is modified
to check if procd is running in a pantavisor container environment by
detecting the presence of pantavisor directory under /.

Signed-off-by: Gaurav Pathak <gaurav.pathak at pantacor.com>
---
 container.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/container.h b/container.h
index 903e3e8..dede696 100644
--- a/container.h
+++ b/container.h
@@ -21,7 +21,8 @@
 static inline bool is_container() {
 	struct stat s;
 	int r = stat("/.dockerenv", &s);
-	return !!getenv("container") || r == 0;
+	int pv_r = stat("/pantavisor", &s);
+	return !!getenv("container") || r == 0 || pv_r == 0;
 }
 
 #endif
-- 
2.25.1




More information about the openwrt-devel mailing list