for (i = 0; i < 2; i++) {
snprintf(path, sizeof(path), "/proc/%d/ns/%s", pid, ns_strs[i]);
ns = open(path, O_RDONLY); if (ns < 0) return pr_err("Unable to open %s", path);
pns = ioctl(ns, NS_GET_PARENT); if (pns < 0) return pr_err("Unable to get a parent pidns");
snprintf(path, sizeof(path), "/proc/self/ns/%s", ns_strs[i]); if (stat(path, &st2)) return pr_err("Unable to stat %s", path); if (fstat(pns, &st1)) return pr_err("Unable to stat the parent pidns"); if (st1.st_ino != st2.st_ino) return pr_err("NS_GET_PARENT returned a wrong namespace");
if (ioctl(pns, NS_GET_PARENT) >= 0 || errno != EPERM) return pr_err("Don't get EPERM");
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.