OLD | NEW |
1 // Copyright 2014 The Crashpad Authors. All rights reserved. | 1 // Copyright 2014 The Crashpad Authors. All rights reserved. |
2 // | 2 // |
3 // Licensed under the Apache License, Version 2.0 (the "License"); | 3 // Licensed under the Apache License, Version 2.0 (the "License"); |
4 // you may not use this file except in compliance with the License. | 4 // you may not use this file except in compliance with the License. |
5 // You may obtain a copy of the License at | 5 // You may obtain a copy of the License at |
6 // | 6 // |
7 // http://www.apache.org/licenses/LICENSE-2.0 | 7 // http://www.apache.org/licenses/LICENSE-2.0 |
8 // | 8 // |
9 // Unless required by applicable law or agreed to in writing, software | 9 // Unless required by applicable law or agreed to in writing, software |
10 // distributed under the License is distributed on an "AS IS" BASIS, | 10 // distributed under the License is distributed on an "AS IS" BASIS, |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 return MACH_PORT_NULL; | 90 return MACH_PORT_NULL; |
91 } | 91 } |
92 | 92 |
93 // Create a unique name for the bootstrap service mapping. Make it unguessable | 93 // Create a unique name for the bootstrap service mapping. Make it unguessable |
94 // to prevent outsiders from grabbing the name first, which would cause | 94 // to prevent outsiders from grabbing the name first, which would cause |
95 // bootstrap_check_in() to fail. | 95 // bootstrap_check_in() to fail. |
96 uint64_t thread_id; | 96 uint64_t thread_id; |
97 errno = pthread_threadid_np(pthread_self(), &thread_id); | 97 errno = pthread_threadid_np(pthread_self(), &thread_id); |
98 PCHECK(errno == 0) << "pthread_threadid_np"; | 98 PCHECK(errno == 0) << "pthread_threadid_np"; |
99 std::string service_name = base::StringPrintf( | 99 std::string service_name = base::StringPrintf( |
100 "com.googlecode.crashpad.child_port_handshake.%d.%llu.%016llx", | 100 "org.chromium.crashpad.child_port_handshake.%d.%llu.%016llx", |
101 getpid(), | 101 getpid(), |
102 thread_id, | 102 thread_id, |
103 base::RandUint64()); | 103 base::RandUint64()); |
104 | 104 |
105 // Check the new service in with the bootstrap server, obtaining a receive | 105 // Check the new service in with the bootstrap server, obtaining a receive |
106 // right for it. | 106 // right for it. |
107 base::mac::ScopedMachReceiveRight server_port(BootstrapCheckIn(service_name)); | 107 base::mac::ScopedMachReceiveRight server_port(BootstrapCheckIn(service_name)); |
108 CHECK(server_port.is_valid()); | 108 CHECK(server_port.is_valid()); |
109 | 109 |
110 // Share the service name with the client via the pipe. | 110 // Share the service name with the client via the pipe. |
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
439 server_port.get(), token, port, right_type); | 439 server_port.get(), token, port, right_type); |
440 if (kr != KERN_SUCCESS) { | 440 if (kr != KERN_SUCCESS) { |
441 MACH_LOG(ERROR, kr) << "child_port_check_in"; | 441 MACH_LOG(ERROR, kr) << "child_port_check_in"; |
442 return false; | 442 return false; |
443 } | 443 } |
444 | 444 |
445 return true; | 445 return true; |
446 } | 446 } |
447 | 447 |
448 } // namespace crashpad | 448 } // namespace crashpad |
OLD | NEW |