Merge changes I68fa51f8,Ia16aa041,Iba57f5cf into main am: 4c5b2303b9 am: 296446e368

Original change: https://android-review.googlesource.com/c/platform/system/core/+/3114672

Change-Id: Icd6644c5eb6890250209cd3066291c8b42b40455
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Treehugger Robot 2024-06-11 23:17:56 +00:00 committed by Automerger Merge Worker
commit 773220e50b
9 changed files with 22 additions and 35 deletions

View file

@ -18,33 +18,19 @@
#define LOG_TAG "libprocessgroup"
#include <errno.h>
#include <fcntl.h>
#include <grp.h>
#include <pwd.h>
#include <sys/mman.h>
#include <sys/mount.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <time.h>
#include <unistd.h>
#include <regex>
#include <android-base/file.h>
#include <android-base/logging.h>
#include <android-base/properties.h>
#include <android-base/stringprintf.h>
#include <android-base/strings.h>
#include <android-base/unique_fd.h>
#include <cgroup_map.h>
#include <json/reader.h>
#include <json/value.h>
#include <processgroup/processgroup.h>
using android::base::GetBoolProperty;
using android::base::StartsWith;
using android::base::StringPrintf;
using android::base::unique_fd;
using android::base::WriteStringToFile;
static constexpr const char* CGROUP_PROCS_FILE = "/cgroup.procs";

View file

@ -16,14 +16,9 @@
#pragma once
#include <sys/cdefs.h>
#include <sys/types.h>
#include <map>
#include <memory>
#include <mutex>
#include <string>
#include <vector>
#include <android/cgrouprc.h>
@ -32,7 +27,7 @@ class CgroupController {
public:
// Does not own controller
explicit CgroupController(const ACgroupController* controller)
: controller_(controller), state_(UNKNOWN) {}
: controller_(controller) {}
uint32_t version() const;
const char* name() const;
@ -53,7 +48,7 @@ class CgroupController {
};
const ACgroupController* controller_ = nullptr;
ControllerState state_;
ControllerState state_ = ControllerState::UNKNOWN;
};
class CgroupMap {

View file

@ -20,14 +20,9 @@ namespace android {
namespace cgrouprc {
namespace format {
CgroupController::CgroupController() : version_(0), flags_(0) {
memset(name_, 0, sizeof(name_));
memset(path_, 0, sizeof(path_));
}
CgroupController::CgroupController(uint32_t version, uint32_t flags, const std::string& name,
const std::string& path)
: CgroupController() {
{
// strlcpy isn't available on host. Although there is an implementation
// in licutils, libcutils itself depends on libcgrouprc_format, causing
// a circular dependency.

View file

@ -16,7 +16,8 @@
#pragma once
#include <stdint.h>
#include <cstddef>
#include <cstdint>
#include <string>
namespace android {
@ -26,7 +27,7 @@ namespace format {
// Minimal controller description to be mmapped into process address space
struct CgroupController {
public:
CgroupController();
CgroupController() = default;
CgroupController(uint32_t version, uint32_t flags, const std::string& name,
const std::string& path);
@ -41,10 +42,10 @@ struct CgroupController {
static constexpr size_t CGROUP_NAME_BUF_SZ = 16;
static constexpr size_t CGROUP_PATH_BUF_SZ = 32;
uint32_t version_;
uint32_t flags_;
char name_[CGROUP_NAME_BUF_SZ];
char path_[CGROUP_PATH_BUF_SZ];
uint32_t version_ = 0;
uint32_t flags_ = 0;
char name_[CGROUP_NAME_BUF_SZ] = {};
char path_[CGROUP_PATH_BUF_SZ] = {};
};
} // namespace format

View file

@ -16,6 +16,8 @@
#pragma once
#include <cstdint>
#include <processgroup/format/cgroup_controller.h>
namespace android {

View file

@ -19,6 +19,7 @@
#define LOG_TAG "SchedPolicy"
#include <errno.h>
#include <fcntl.h>
#include <unistd.h>
#include <android-base/logging.h>

View file

@ -16,6 +16,11 @@
#pragma once
#include <cstdint>
#include <string>
#include <sys/stat.h>
#include <processgroup/format/cgroup_controller.h>
namespace android {

View file

@ -17,7 +17,9 @@
//#define LOG_NDEBUG 0
#define LOG_TAG "libprocessgroup"
#include <dirent.h>
#include <fcntl.h>
#include <unistd.h>
#include <task_profiles.h>
#include <string>

View file

@ -16,10 +16,10 @@
#pragma once
#include <sys/cdefs.h>
#include <sys/types.h>
#include <functional>
#include <map>
#include <memory>
#include <mutex>
#include <span>
#include <string>