| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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> |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 } else { | 100 } else { |
| 101 // Got the list, just make sure we're sized exactly right | 101 // Got the list, just make sure we're sized exactly right |
| 102 size_t num_of_kinfo_proc = len / sizeof(struct kinfo_proc); | 102 size_t num_of_kinfo_proc = len / sizeof(struct kinfo_proc); |
| 103 kinfo_procs_.resize(num_of_kinfo_proc); | 103 kinfo_procs_.resize(num_of_kinfo_proc); |
| 104 done = true; | 104 done = true; |
| 105 } | 105 } |
| 106 } | 106 } |
| 107 } while (!done && (try_num++ < max_tries)); | 107 } while (!done && (try_num++ < max_tries)); |
| 108 | 108 |
| 109 if (!done) { | 109 if (!done) { |
| 110 DDLOG(ERROR) << "failed to collect the process list in a few tries"; | 110 DLOG(ERROR) << "failed to collect the process list in a few tries"; |
| 111 kinfo_procs_.resize(0); | 111 kinfo_procs_.resize(0); |
| 112 } | 112 } |
| 113 } | 113 } |
| 114 | 114 |
| 115 ProcessIterator::~ProcessIterator() { | 115 ProcessIterator::~ProcessIterator() { |
| 116 } | 116 } |
| 117 | 117 |
| 118 bool ProcessIterator::CheckForNextProcess() { | 118 bool ProcessIterator::CheckForNextProcess() { |
| 119 std::string data; | 119 std::string data; |
| 120 for (; index_of_kinfo_proc_ < kinfo_procs_.size(); ++index_of_kinfo_proc_) { | 120 for (; index_of_kinfo_proc_ < kinfo_procs_.size(); ++index_of_kinfo_proc_) { |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 337 return mem_total - (mem_free*pagesize) - (mem_inactive*pagesize); | 337 return mem_total - (mem_free*pagesize) - (mem_inactive*pagesize); |
| 338 } | 338 } |
| 339 | 339 |
| 340 void EnableTerminationOnOutOfMemory() { | 340 void EnableTerminationOnOutOfMemory() { |
| 341 } | 341 } |
| 342 | 342 |
| 343 void EnableTerminationOnHeapCorruption() { | 343 void EnableTerminationOnHeapCorruption() { |
| 344 } | 344 } |
| 345 | 345 |
| 346 } // namespace base | 346 } // namespace base |
| OLD | NEW |