| 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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 119     return MACH_PORT_NULL; | 119     return MACH_PORT_NULL; | 
| 120   } | 120   } | 
| 121 | 121 | 
| 122   if (!LoggingWriteFD(pipe_write, service_name.c_str(), service_name_length)) { | 122   if (!LoggingWriteFD(pipe_write, service_name.c_str(), service_name_length)) { | 
| 123     LOG(WARNING) << "no client check-in"; | 123     LOG(WARNING) << "no client check-in"; | 
| 124     return MACH_PORT_NULL; | 124     return MACH_PORT_NULL; | 
| 125   } | 125   } | 
| 126 | 126 | 
| 127   // A kqueue cannot monitor a raw Mach receive right with EVFILT_MACHPORT. It | 127   // A kqueue cannot monitor a raw Mach receive right with EVFILT_MACHPORT. It | 
| 128   // requires a port set. Create a new port set and add the receive right to it. | 128   // requires a port set. Create a new port set and add the receive right to it. | 
| 129   mach_port_t server_port_set; | 129   base::mac::ScopedMachPortSet server_port_set( | 
| 130   kr = mach_port_allocate( | 130       NewMachPort(MACH_PORT_RIGHT_PORT_SET)); | 
| 131       mach_task_self(), MACH_PORT_RIGHT_PORT_SET, &server_port_set); | 131   CHECK_NE(server_port_set, kMachPortNull); | 
| 132   MACH_CHECK(kr == KERN_SUCCESS, kr) << "mach_port_allocate"; |  | 
| 133   base::mac::ScopedMachPortSet server_port_set_owner(server_port_set); |  | 
| 134 | 132 | 
| 135   kr = mach_port_insert_member(mach_task_self(), server_port, server_port_set); | 133   kr = mach_port_insert_member(mach_task_self(), server_port, server_port_set); | 
| 136   MACH_CHECK(kr == KERN_SUCCESS, kr) << "mach_port_insert_member"; | 134   MACH_CHECK(kr == KERN_SUCCESS, kr) << "mach_port_insert_member"; | 
| 137 | 135 | 
| 138   // Set up a kqueue to monitor both the server’s receive right and the write | 136   // Set up a kqueue to monitor both the server’s receive right and the write | 
| 139   // side of the pipe. Messages from the client will be received via the receive | 137   // side of the pipe. Messages from the client will be received via the receive | 
| 140   // right, and the pipe will show EOF if the client closes its read side | 138   // right, and the pipe will show EOF if the client closes its read side | 
| 141   // prematurely. | 139   // prematurely. | 
| 142   base::ScopedFD kq(kqueue()); | 140   base::ScopedFD kq(kqueue()); | 
| 143   PCHECK(kq != -1) << "kqueue"; | 141   PCHECK(kq != -1) << "kqueue"; | 
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 339       bootstrap_look_up(bootstrap_port, service_name.c_str(), &server_port); | 337       bootstrap_look_up(bootstrap_port, service_name.c_str(), &server_port); | 
| 340   BOOTSTRAP_CHECK(kr == BOOTSTRAP_SUCCESS, kr) << "bootstrap_look_up"; | 338   BOOTSTRAP_CHECK(kr == BOOTSTRAP_SUCCESS, kr) << "bootstrap_look_up"; | 
| 341   base::mac::ScopedMachSendRight server_port_owner(server_port); | 339   base::mac::ScopedMachSendRight server_port_owner(server_port); | 
| 342 | 340 | 
| 343   // Check in with the server. | 341   // Check in with the server. | 
| 344   kr = child_port_check_in(server_port, token, port, right_type); | 342   kr = child_port_check_in(server_port, token, port, right_type); | 
| 345   MACH_CHECK(kr == KERN_SUCCESS, kr) << "child_port_check_in"; | 343   MACH_CHECK(kr == KERN_SUCCESS, kr) << "child_port_check_in"; | 
| 346 } | 344 } | 
| 347 | 345 | 
| 348 }  // namespace crashpad | 346 }  // namespace crashpad | 
| OLD | NEW | 
|---|