return -EIO;
cgroup = find_cgroup_in_path(path);
if (!cgroup) {
-empty:
/* this is just /cgroup/controller, return it as a dir */
sb->st_mode = S_IFDIR | 00755;
sb->st_nlink = 2;
* cgroup, or cgdir if fpath is a file */
if (is_child_cgroup(controller, path1, path2)) {
- if (!caller_is_in_ancestor(fc->pid, controller, cgroup, NULL))
- goto empty;
+ if (!caller_is_in_ancestor(fc->pid, controller, cgroup, NULL)) {
+ /* this is just /cgroup/controller, return it as a dir */
+ sb->st_mode = S_IFDIR | 00555;
+ sb->st_nlink = 2;
+ return 0;
+ }
if (!fc_may_access(fc, controller, cgroup, NULL, O_RDONLY))
- return -EPERM;
+ return -EACCES;
// get uid, gid, from '/tasks' file and make up a mode
// That is a hack, until cgmanager gains a GetCgroupPerms fn.
if (!caller_is_in_ancestor(fc->pid, controller, path1, NULL))
return -ENOENT;
if (!fc_may_access(fc, controller, path1, path2, O_RDONLY))
- return -EPERM;
+ return -EACCES;
sb->st_mode = S_IFREG | k->mode;
sb->st_nlink = 1;
}
if (!fc_may_access(fc, controller, cgroup, NULL, O_RDONLY))
- return -EPERM;
+ return -EACCES;
if (!cgm_list_keys(controller, cgroup, &list))
// not a valid cgroup
if ((k = get_cgroup_key(controller, path1, path2)) != NULL) {
if (!fc_may_access(fc, controller, path1, path2, fi->flags))
- return -EPERM;
+ // should never get here
+ return -EACCES;
/* TODO - we want to cache this info for read/write */
return 0;
controller = pick_controller_from_path(fc, path);
if (!controller)
- return -EIO;
+ return -EINVAL;
cgroup = find_cgroup_in_path(path);
if (!cgroup)
return -EINVAL;
int s;
if (!fc_may_access(fc, controller, path1, path2, O_RDONLY))
- return -EPERM;
+ // should never get here
+ return -EACCES;
if (!cgm_get_value(controller, path1, path2, &data))
return -EINVAL;
nih_local struct cgm_keys *k = NULL;
if (offset)
- return -EIO;
+ return -EINVAL;
if (!fc)
return -EIO;
controller = pick_controller_from_path(fc, path);
if (!controller)
- return -EIO;
+ return -EINVAL;
cgroup = find_cgroup_in_path(path);
if (!cgroup)
return -EINVAL;
if ((k = get_cgroup_key(controller, path1, path2)) != NULL) {
if (!fc_may_access(fc, controller, path1, path2, O_WRONLY))
- return -EPERM;
+ return -EACCES;
if (!cgm_set_value(controller, path1, path2, buf))
return -EINVAL;
controller = pick_controller_from_path(fc, path);
if (!controller)
- return -EIO;
+ return -EINVAL;
cgroup = find_cgroup_in_path(path);
if (!cgroup)
/* this is just /cgroup/controller */
* over the file's current owner.
*/
if (!is_privileged_over(fc->pid, fc->uid, k->uid, NS_ROOT_REQD))
- return -EPERM;
+ return -EACCES;
if (!cgm_chown_file(controller, cgroup, uid, gid))
return -EINVAL;
controller = pick_controller_from_path(fc, path);
if (!controller)
- return -EIO;
+ return -EINVAL;
cgroup = find_cgroup_in_path(path);
if (!cgroup)
/* this is just /cgroup/controller */
controller = pick_controller_from_path(fc, path);
if (!controller)
- return -EIO;
+ return -EINVAL;
cgroup = find_cgroup_in_path(path);
if (!cgroup)
- return -EIO;
+ return -EINVAL;
get_cgdir_and_path(cgroup, &cgdir, &fpath);
if (!fpath)
path1 = cgdir;
if (!fc_may_access(fc, controller, path1, NULL, O_RDWR))
- return -EPERM;
+ return -EACCES;
if (!cgm_create(controller, cgroup, fc->uid, fc->gid))
controller = pick_controller_from_path(fc, path);
if (!controller)
- return -EIO;
+ return -EINVAL;
cgroup = find_cgroup_in_path(path);
if (!cgroup)
- return -EIO;
+ return -EINVAL;
get_cgdir_and_path(cgroup, &cgdir, &fpath);
if (!fpath)
return -EINVAL;
if (!fc_may_access(fc, controller, cgdir, NULL, O_WRONLY))
- return -EPERM;
+ return -EACCES;
if (!cgm_remove(controller, cgroup))
return -EINVAL;