diff options
author | Igor Pashev <pashev.igor@gmail.com> | 2013-04-30 03:56:44 +0400 |
---|---|---|
committer | Igor Pashev <pashev.igor@gmail.com> | 2013-04-30 03:56:44 +0400 |
commit | da037d7196537768294130227dc0515392d97211 (patch) | |
tree | c8bc673263463921d9fd5f1946dabb180e3f254f /ischroot.c | |
parent | 8fb496f15292ac92beeab0057329442e3d443052 (diff) | |
download | debianutils-master.tar.gz |
* Package for Dyson
* ischroot() now supports illumos/solaris (like on linux)
Diffstat (limited to 'ischroot.c')
-rw-r--r-- | ischroot.c | 20 |
1 files changed, 20 insertions, 0 deletions
@@ -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() |