return access_nofollow(cpath, root ? W_OK : F_OK);
}
-int cg_get_path_and_check(const char *controller, const char *path, const char *suffix, char **ret) {
- int r;
-
- assert(controller);
- assert(ret);
-
- if (!cg_controller_is_valid(controller))
- return -EINVAL;
-
- r = cg_all_unified();
- if (r < 0)
- return r;
- if (r > 0) {
- /* In the unified hierarchy all controllers are considered accessible,
- * except for the named hierarchies */
- if (startswith(controller, "name="))
- return -EOPNOTSUPP;
- } else {
- /* Check if the specified controller is actually accessible */
- r = controller_is_v1_accessible(NULL, controller);
- if (r < 0)
- return r;
- }
-
- return cg_get_path(controller, path, suffix, ret);
-}
-
int cg_set_xattr(const char *path, const char *name, const void *value, size_t size, int flags) {
_cleanup_free_ char *fs = NULL;
int r;
int cg_mangle_path(const char *path, char **ret);
int cg_get_path(const char *controller, const char *path, const char *suffix, char **ret);
-int cg_get_path_and_check(const char *controller, const char *path, const char *suffix, char **ret);
int cg_pid_get_path(pid_t pid, char **ret);
int cg_pidref_get_path(const PidRef *pidref, char **ret);
if (cgroup && have_clone_into_cgroup) {
_cleanup_free_ char *resolved_cgroup = NULL;
- r = cg_get_path_and_check(
- SYSTEMD_CGROUP_CONTROLLER,
- cgroup,
- /* suffix= */ NULL,
- &resolved_cgroup);
+ r = cg_get_path(SYSTEMD_CGROUP_CONTROLLER, cgroup, /* suffix= */ NULL, &resolved_cgroup);
if (r < 0)
return r;
_cleanup_free_ char *fs = NULL;
int r;
- r = cg_get_path_and_check(SYSTEMD_CGROUP_CONTROLLER, path, NULL, &fs);
+ r = cg_get_path(SYSTEMD_CGROUP_CONTROLLER, path, NULL, &fs);
if (r < 0)
return r;
assert(path);
assert(pid >= 0);
- r = cg_get_path_and_check(SYSTEMD_CGROUP_CONTROLLER, path, "cgroup.procs", &fs);
+ r = cg_get_path(SYSTEMD_CGROUP_CONTROLLER, path, "cgroup.procs", &fs);
if (r < 0)
return r;