Index: utils.cc |
diff --git a/utils.cc b/utils.cc |
index 05acc1545dbf1eb2d0c70d90a73b5a40921a1c10..134ad80a116d17713a92f39cf090414859382854 100644 |
--- a/utils.cc |
+++ b/utils.cc |
@@ -5,6 +5,7 @@ |
#include "update_engine/utils.h" |
#include <sys/mount.h> |
+#include <sys/resource.h> |
#include <sys/stat.h> |
#include <sys/types.h> |
#include <dirent.h> |
@@ -444,6 +445,18 @@ bool Reboot() { |
return true; |
} |
+bool SetProcessPriority(ProcessPriority priority) { |
+ int prio = static_cast<int>(priority); |
+ LOG(INFO) << "Setting process priority to " << prio; |
+ TEST_AND_RETURN_FALSE(setpriority(PRIO_PROCESS, 0, prio) == 0); |
+ return true; |
+} |
+ |
+int ComparePriorities(ProcessPriority priority_lhs, |
+ ProcessPriority priority_rhs) { |
+ return static_cast<int>(priority_rhs) - static_cast<int>(priority_lhs); |
+} |
+ |
const char* const kStatefulPartition = "/mnt/stateful_partition"; |
} // namespace utils |