Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(28)

Unified Diff: utils.cc

Issue 3053049: Nice automatic updates up to a point, then renice if necessary. (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/update_engine.git
Patch Set: better documentation Created 10 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « utils.h ('k') | utils_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « utils.h ('k') | utils_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698