static inline bool cgm_init(struct lxc_handler *handler) { if (!collect_subsytems()) return false; if (geteuid()) return true; // root; try to escape to root cgroup return lxc_cgmanager_escape(); }
/* * called during cgroup.c:cgroup_ops_init(), at startup. No threads. * We check whether we can talk to cgmanager, escape to root cgroup if * we are root, then close the connection. */ struct cgroup_ops *cgm_ops_init(void) { if (!collect_subsytems()) return NULL; if (!cgm_dbus_connect()) goto err1; // root; try to escape to root cgroup if (geteuid() == 0 && !lxc_cgmanager_escape()) goto err2; cgm_dbus_disconnect(); return &cgmanager_ops; err2: cgm_dbus_disconnect(); err1: free_subsystems(); return NULL; }