OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 <stdint.h> | 5 #include <stdint.h> |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/process/process_handle.h" | 8 #include "base/process/process_handle.h" |
9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
10 | 10 |
(...skipping 21 matching lines...) Loading... |
32 return MangleProcessId(GetCurrentProcId()); | 32 return MangleProcessId(GetCurrentProcId()); |
33 } | 33 } |
34 | 34 |
35 // Make sure we are the same process that set |g_procid|. This check may have | 35 // Make sure we are the same process that set |g_procid|. This check may have |
36 // false negatives (if a process ID was reused) but should have no false | 36 // false negatives (if a process ID was reused) but should have no false |
37 // positives. | 37 // positives. |
38 DCHECK_EQ(GetCurrentProcId(), g_procid); | 38 DCHECK_EQ(GetCurrentProcId(), g_procid); |
39 return g_unique_id; | 39 return g_unique_id; |
40 } | 40 } |
41 | 41 |
42 #if defined(OS_LINUX) | 42 #if defined(OS_LINUX) || defined(OS_AIX) |
43 | 43 |
44 void InitUniqueIdForProcessInPidNamespace(ProcessId pid_outside_of_namespace) { | 44 void InitUniqueIdForProcessInPidNamespace(ProcessId pid_outside_of_namespace) { |
45 g_unique_id = MangleProcessId(pid_outside_of_namespace); | 45 g_unique_id = MangleProcessId(pid_outside_of_namespace); |
46 g_procid = GetCurrentProcId(); | 46 g_procid = GetCurrentProcId(); |
47 g_have_unique_id = true; | 47 g_have_unique_id = true; |
48 } | 48 } |
49 | 49 |
50 #endif | 50 #endif |
51 | 51 |
52 } // namespace base | 52 } // namespace base |
OLD | NEW |