Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 569db94f authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge changes Iae1cbfcc,I4466838c,I19c75e50,I2f49fab1 into main

* changes:
  libprocessgroup: Remove __BEGIN_DECLS and __END_DECLS
  libprocessgroup: Convert CGROUPV2_HIERARCHY_NAME to std::string
  libprocessgroup: Remove CGROUPV2_CONTROLLER_NAME
  libprocessgroup: Remove CGROUPS_RC_PATH
parents a0627e76 fdf44323
Loading
Loading
Loading
Loading
+1 −12
Original line number Diff line number Diff line
@@ -16,7 +16,6 @@

#pragma once

#include <sys/cdefs.h>
#include <sys/types.h>
#include <initializer_list>
#include <span>
@@ -24,10 +23,7 @@
#include <string_view>
#include <vector>

__BEGIN_DECLS

static constexpr const char* CGROUPV2_HIERARCHY_NAME = "cgroup2";
[[deprecated]] static constexpr const char* CGROUPV2_CONTROLLER_NAME = "cgroup2";
static constexpr std::string CGROUPV2_HIERARCHY_NAME = "cgroup2";

bool CgroupsAvailable();
bool CgroupGetControllerPath(const std::string& cgroup_name, std::string* path);
@@ -40,8 +36,6 @@ bool SetTaskProfiles(pid_t tid, const std::vector<std::string>& profiles,
bool SetProcessProfiles(uid_t uid, pid_t pid, const std::vector<std::string>& profiles);
bool SetUserProfiles(uid_t uid, const std::vector<std::string>& profiles);

__END_DECLS

bool SetTaskProfiles(pid_t tid, std::initializer_list<std::string_view> profiles,
                     bool use_fd_cache = false);
bool SetProcessProfiles(uid_t uid, pid_t pid, std::initializer_list<std::string_view> profiles);
@@ -51,14 +45,11 @@ bool SetTaskProfiles(pid_t tid, std::span<const std::string_view> profiles,
bool SetProcessProfiles(uid_t uid, pid_t pid, std::span<const std::string_view> profiles);
#endif

__BEGIN_DECLS

#ifndef __ANDROID_VNDK__

bool SetProcessProfilesCached(uid_t uid, pid_t pid, const std::vector<std::string>& profiles);

[[deprecated]] static constexpr const char* CGROUPS_RC_PATH = "/dev/cgroup_info/cgroup.rc";

bool UsePerAppMemcg();

// Drop the fd cache of cgroup path. It is used for when resource caching is enabled and a process
@@ -99,5 +90,3 @@ bool getAttributePathForTask(const std::string& attr_name, pid_t tid, std::strin
bool isProfileValidForProcess(const std::string& profile_name, uid_t uid, pid_t pid);

#endif // __ANDROID_VNDK__

__END_DECLS
+1 −1
Original line number Diff line number Diff line
@@ -222,7 +222,7 @@ static bool SetupCgroup(const CgroupDescriptor& descriptor) {
    const CgroupController* controller = descriptor.controller();

    if (controller->version() == 2) {
        if (!strcmp(controller->name(), CGROUPV2_HIERARCHY_NAME)) {
        if (controller->name() == CGROUPV2_HIERARCHY_NAME) {
            return MountV2CgroupController(descriptor);
        } else {
            return ActivateV2CgroupController(descriptor);