src/linux/cgroups.cpp
// Create a cgroup in a given hierarchy. To create a cgroup, one just need to
// create a directory in the cgroups virtual file system. The given cgroup is a
// relative path to the given hierarchy. This function assumes the given
// hierarchy is valid and is currently mounted with a cgroup virtual file
// system. The function also assumes the given cgroup is valid. This function
// will not create directories recursively, which means it will return error if
// any of the parent cgroups does not exist.
// @param   hierarchy   Path to the hierarchy root.
// @param   cgroup      Path to the cgroup relative to the hierarchy root.
// @return  Some if the operation succeeds.
//          Error if the operation fails.
Create a cgroup in a given hierarchy. To create a cgroup, one just need to
create a directory in the cgroups virtual file system. The given cgroup is a
relative path to the given hierarchy. This function assumes the given
hierarchy is valid and is currently mounted with a cgroup virtual file
system. The function also assumes the given cgroup is valid. This function
will not create directories recursively, which means it will return error if
any of the parent cgroups does not exist.
Create a cgroup in a given hierarchy . To create a cgroup one just need to create a directory in the cgroups virtual file system . The given cgroup is a relative path to the given hierarchy . This function assumes the given hierarchy is valid and is currently mounted with a cgroup virtual file system . The function also assumes the given cgroup is valid . This function will not create directories recursively which means it will return error if any of the parent cgroups does not exist .
static Try<Nothing> createCgroup(const std::string& hierarchy,
                                 const std::string& cgroup)
{
  std::string path = hierarchy + "/" + cgroup;
  Try<Nothing> mkdir = os::mkdir(path);
  if (mkdir.isError()) {
    return Try<Nothing>::error(
        "Failed to create cgroup at " + path + ": " + mkdir.error());
  }
  return mkdir;
}
static Try < Nothing > createCgroup ( const std :: string & hierarchy , const std :: string & cgroup ) { std :: string path = hierarchy + " " + cgroup ; Try < Nothing > mkdir = os :: mkdir ( path ) ; if ( mkdir . isError ( ) ) { return Try < Nothing > :: error ( " " + path + " " + mkdir . error ( ) ) ; } return mkdir ; }
Create a cgroup in a given hierarchy.
Create a cgroup in a given hierarchy .