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 // This file/namespace contains utility functions for enumerating, ending and | 5 // This file/namespace contains utility functions for enumerating, ending and |
6 // computing statistics of processes. | 6 // computing statistics of processes. |
7 | 7 |
8 #ifndef BASE_PROCESS_UTIL_H_ | 8 #ifndef BASE_PROCESS_UTIL_H_ |
9 #define BASE_PROCESS_UTIL_H_ | 9 #define BASE_PROCESS_UTIL_H_ |
10 | 10 |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 | 104 |
105 static const char kAdjustOOMScoreSwitch[] = "--adjust-oom-score"; | 105 static const char kAdjustOOMScoreSwitch[] = "--adjust-oom-score"; |
106 | 106 |
107 // This adjusts /proc/process/oom_adj so the Linux OOM killer will prefer | 107 // This adjusts /proc/process/oom_adj so the Linux OOM killer will prefer |
108 // certain process types over others. The range for the adjustment is | 108 // certain process types over others. The range for the adjustment is |
109 // [-17,15], with [0,15] being user accessible. | 109 // [-17,15], with [0,15] being user accessible. |
110 bool AdjustOOMScore(ProcessId process, int score); | 110 bool AdjustOOMScore(ProcessId process, int score); |
111 #endif | 111 #endif |
112 | 112 |
113 #if defined(OS_POSIX) | 113 #if defined(OS_POSIX) |
114 // Sets all file descriptors to close on exec except for stdin, stdout | |
115 // and stderr. | |
116 // TODO(agl): remove this function | |
117 // WARNING: do not use. It's inherently race-prone in the face of | |
118 // multi-threading. | |
119 void SetAllFDsToCloseOnExec(); | |
120 // Close all file descriptors, expect those which are a destination in the | 114 // Close all file descriptors, expect those which are a destination in the |
121 // given multimap. Only call this function in a child process where you know | 115 // given multimap. Only call this function in a child process where you know |
122 // that there aren't any other threads. | 116 // that there aren't any other threads. |
123 void CloseSuperfluousFds(const base::InjectiveMultimap& saved_map); | 117 void CloseSuperfluousFds(const base::InjectiveMultimap& saved_map); |
124 #endif | 118 #endif |
125 | 119 |
126 #if defined(OS_WIN) | 120 #if defined(OS_WIN) |
127 // Runs the given application name with the given command line. Normally, the | 121 // Runs the given application name with the given command line. Normally, the |
128 // first command line argument should be the path to the process, and don't | 122 // first command line argument should be the path to the process, and don't |
129 // forget to quote it. | 123 // forget to quote it. |
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
533 // instance running inside the parent. The parent's Breakpad instance should | 527 // instance running inside the parent. The parent's Breakpad instance should |
534 // not handle the child's exceptions. Calling RestoreDefaultExceptionHandler | 528 // not handle the child's exceptions. Calling RestoreDefaultExceptionHandler |
535 // in the child after forking will restore the standard exception handler. | 529 // in the child after forking will restore the standard exception handler. |
536 // See http://crbug.com/20371/ for more details. | 530 // See http://crbug.com/20371/ for more details. |
537 void RestoreDefaultExceptionHandler(); | 531 void RestoreDefaultExceptionHandler(); |
538 #endif | 532 #endif |
539 | 533 |
540 } // namespace base | 534 } // namespace base |
541 | 535 |
542 #endif // BASE_PROCESS_UTIL_H_ | 536 #endif // BASE_PROCESS_UTIL_H_ |
OLD | NEW |