src/linux/cgroups.cpp
// Remove a cgroup in a given hierarchy. To remove a cgroup, one needs to remove
// the corresponding directory in the cgroups virtual file system. A cgroup
// cannot be removed if it has processes or sub-cgroups inside. This function
// does nothing but tries to remove the corresponding directory of the given
// cgroup. It will return error if the remove operation fails because it has
// either processes or sub-cgroups inside.
// @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.
Remove a cgroup in a given hierarchy. To remove a cgroup, one needs to remove
the corresponding directory in the cgroups virtual file system. A cgroup
cannot be removed if it has processes or sub-cgroups inside. This function
does nothing but tries to remove the corresponding directory of the given
cgroup. It will return error if the remove operation fails because it has
either processes or sub-cgroups inside.
Remove a cgroup in a given hierarchy . To remove a cgroup one needs to remove the corresponding directory in the cgroups virtual file system . A cgroup cannot be removed if it has processes or sub - cgroups inside . This function does nothing but tries to remove the corresponding directory of the given cgroup . It will return error if the remove operation fails because it has either processes or sub - cgroups inside .
static Try<Nothing> removeCgroup(const std::string& hierarchy,
                                 const std::string& cgroup)
{
  std::string path = hierarchy + "/" + cgroup;
  Try<Nothing> rmdir = os::rmdir(path);
  if (rmdir.isError()) {
    return Try<Nothing>::error(
        "Failed to remove cgroup at " + path + ": " + rmdir.error());
  }
  return rmdir;
}
static Try < Nothing > removeCgroup ( const std :: string & hierarchy , const std :: string & cgroup ) { std :: string path = hierarchy + " " + cgroup ; Try < Nothing > rmdir = os :: rmdir ( path ) ; if ( rmdir . isError ( ) ) { return Try < Nothing > :: error ( " " + path + " " + rmdir . error ( ) ) ; } return rmdir ; }
Remove a cgroup in a given hierarchy.
Remove a cgroup in a given hierarchy .