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.cpp b/libprocessgroup/task_profiles.cpp
index eb50f85..ec6cbbc 100644
--- a/libprocessgroup/task_profiles.cpp
+++ b/libprocessgroup/task_profiles.cpp
@@ -18,7 +18,6 @@
 #define LOG_TAG "libprocessgroup"
 
 #include <fcntl.h>
-#include <sys/prctl.h>
 #include <task_profiles.h>
 #include <string>
 
@@ -32,6 +31,11 @@
 #include <json/reader.h>
 #include <json/value.h>
 
+// To avoid issues in sdk_mac build
+#if defined(__ANDROID__)
+#include <sys/prctl.h>
+#endif
+
 using android::base::GetThreadId;
 using android::base::StringPrintf;
 using android::base::unique_fd;
@@ -69,6 +73,9 @@
     return false;
 }
 
+// To avoid issues in sdk_mac build
+#if defined(__ANDROID__)
+
 bool SetTimerSlackAction::IsTimerSlackSupported(int tid) {
     auto file = StringPrintf("/proc/%d/timerslack_ns", tid);
 
@@ -97,6 +104,8 @@
     return true;
 }
 
+#endif
+
 bool SetAttributeAction::ExecuteForProcess(uid_t, pid_t pid) const {
     return ExecuteForTask(pid);
 }