Fix non-Android build targets
Non-Android build targets are missing sys/prctl.h header and functionality
should be disabled for them like it was done previously inside
sched_policy.cpp. Also make the set_sched_policy/get_sched_policy
functionality backward compatible by creating stubs for non-Android
targets.
Bug: 111307099
Test: built sdk_gphone_x86-sdk_addon_mac target using forrest
Change-Id: I1c195267e287a84a21c588bd61d7c452bff6cfbe
Merged-In: I1c195267e287a84a21c588bd61d7c452bff6cfbe
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
diff --git a/libprocessgroup/task_profiles.h b/libprocessgroup/task_profiles.h
index 684762a..886ead1 100644
--- a/libprocessgroup/task_profiles.h
+++ b/libprocessgroup/task_profiles.h
@@ -63,6 +63,9 @@
int clamp_;
};
+// To avoid issues in sdk_mac build
+#if defined(__ANDROID__)
+
class SetTimerSlackAction : public ProfileAction {
public:
SetTimerSlackAction(unsigned long slack) noexcept : slack_(slack) {}
@@ -75,6 +78,17 @@
static bool IsTimerSlackSupported(int tid);
};
+#else
+
+class SetTimerSlackAction : public ProfileAction {
+ public:
+ SetTimerSlackAction(unsigned long) noexcept {}
+
+ virtual bool ExecuteForTask(int) const { return true; }
+};
+
+#endif
+
// Set attribute profile element
class SetAttributeAction : public ProfileAction {
public: