summaryrefslogtreecommitdiff
path: root/ischroot.c
diff options
context:
space:
mode:
Diffstat (limited to 'ischroot.c')
-rw-r--r--ischroot.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/ischroot.c b/ischroot.c
index bed67f9..7da07a8 100644
--- a/ischroot.c
+++ b/ischroot.c
@@ -152,6 +152,26 @@ static int ischroot()
return 0;
}
+#elif defined (__sun__)
+
+/* Similar to Linux
+ * XXX: check zone?
+ * XXX: illumos kernel automatically mounts /proc on boot
+ */
+
+static int ischroot()
+{
+ struct stat st1, st2;
+
+ if (stat("/", &st1))
+ return 2;
+ if (stat("/proc/1/root", &st2))
+ return 2;
+ if ((st1.st_dev == st2.st_dev) && (st1.st_ino == st2.st_ino))
+ return 1;
+ return 0;
+}
+
#else
static int ischroot()