| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "base/process_util.h" | 5 #include "base/process_util.h" |
| 6 | 6 |
| 7 #include <ctype.h> | 7 #include <ctype.h> |
| 8 #include <dirent.h> | 8 #include <dirent.h> |
| 9 #include <dlfcn.h> | 9 #include <dlfcn.h> |
| 10 #include <errno.h> | 10 #include <errno.h> |
| 11 #include <fcntl.h> | 11 #include <fcntl.h> |
| 12 #include <sys/time.h> | 12 #include <sys/time.h> |
| 13 #include <sys/types.h> | 13 #include <sys/types.h> |
| 14 #include <sys/wait.h> | 14 #include <sys/wait.h> |
| 15 #include <time.h> | 15 #include <time.h> |
| 16 #include <unistd.h> | 16 #include <unistd.h> |
| 17 | 17 |
| 18 #include "base/file_util.h" | 18 #include "base/file_util.h" |
| 19 #include "base/logging.h" | 19 #include "base/logging.h" |
| 20 #include "base/string_number_conversions.h" | 20 #include "base/string_number_conversions.h" |
| 21 #include "base/string_split.h" | 21 #include "base/string_split.h" |
| 22 #include "base/string_tokenizer.h" | 22 #include "base/string_tokenizer.h" |
| 23 #include "base/string_util.h" | 23 #include "base/string_util.h" |
| 24 #include "base/sys_info.h" | 24 #include "base/sys_info.h" |
| 25 #include "base/thread_restrictions.h" | 25 #include "base/threading/thread_restrictions.h" |
| 26 | 26 |
| 27 namespace { | 27 namespace { |
| 28 | 28 |
| 29 enum ParsingState { | 29 enum ParsingState { |
| 30 KEY_NAME, | 30 KEY_NAME, |
| 31 KEY_VALUE | 31 KEY_VALUE |
| 32 }; | 32 }; |
| 33 | 33 |
| 34 // Reads /proc/<pid>/stat and populates |proc_stats| with the values split by | 34 // Reads /proc/<pid>/stat and populates |proc_stats| with the values split by |
| 35 // spaces. Returns true if successful. | 35 // spaces. Returns true if successful. |
| (...skipping 670 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 706 | 706 |
| 707 if (!file_util::PathExists(oom_adj)) | 707 if (!file_util::PathExists(oom_adj)) |
| 708 return false; | 708 return false; |
| 709 | 709 |
| 710 std::string score_str = base::IntToString(score); | 710 std::string score_str = base::IntToString(score); |
| 711 return (static_cast<int>(score_str.length()) == | 711 return (static_cast<int>(score_str.length()) == |
| 712 file_util::WriteFile(oom_adj, score_str.c_str(), score_str.length())); | 712 file_util::WriteFile(oom_adj, score_str.c_str(), score_str.length())); |
| 713 } | 713 } |
| 714 | 714 |
| 715 } // namespace base | 715 } // namespace base |
| OLD | NEW |