| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/zygote/zygote_linux.h" | 5 #include "content/zygote/zygote_linux.h" |
| 6 | 6 |
| 7 #include <fcntl.h> | 7 #include <fcntl.h> |
| 8 #include <string.h> | 8 #include <string.h> |
| 9 #include <sys/socket.h> | 9 #include <sys/socket.h> |
| 10 #include <sys/types.h> | 10 #include <sys/types.h> |
| (...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 388 base::ProcessId real_pid; | 388 base::ProcessId real_pid; |
| 389 if (!base::ReadFromFD(read_pipe.get(), | 389 if (!base::ReadFromFD(read_pipe.get(), |
| 390 reinterpret_cast<char*>(&real_pid), | 390 reinterpret_cast<char*>(&real_pid), |
| 391 sizeof(real_pid))) { | 391 sizeof(real_pid))) { |
| 392 LOG(FATAL) << "Failed to synchronise with parent zygote process"; | 392 LOG(FATAL) << "Failed to synchronise with parent zygote process"; |
| 393 } | 393 } |
| 394 if (real_pid <= 0) { | 394 if (real_pid <= 0) { |
| 395 LOG(FATAL) << "Invalid pid from parent zygote"; | 395 LOG(FATAL) << "Invalid pid from parent zygote"; |
| 396 } | 396 } |
| 397 #if defined(OS_LINUX) | 397 #if defined(OS_LINUX) |
| 398 // Sandboxed processes need to send the global, non-namespaced PID when | |
| 399 // setting up an IPC channel to their parent. | |
| 400 IPC::Channel::SetGlobalPid(real_pid); | |
| 401 // Force the real PID so chrome event data have a PID that corresponds | 398 // Force the real PID so chrome event data have a PID that corresponds |
| 402 // to system trace event data. | 399 // to system trace event data. |
| 403 base::debug::TraceLog::GetInstance()->SetProcessID( | 400 base::debug::TraceLog::GetInstance()->SetProcessID( |
| 404 static_cast<int>(real_pid)); | 401 static_cast<int>(real_pid)); |
| 405 #endif | 402 #endif |
| 406 return 0; | 403 return 0; |
| 407 } | 404 } |
| 408 | 405 |
| 409 // In the parent process. | 406 // In the parent process. |
| 410 read_pipe.reset(); | 407 read_pipe.reset(); |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 585 PickleIterator iter) { | 582 PickleIterator iter) { |
| 586 if (HANDLE_EINTR(write(fd, &sandbox_flags_, sizeof(sandbox_flags_))) != | 583 if (HANDLE_EINTR(write(fd, &sandbox_flags_, sizeof(sandbox_flags_))) != |
| 587 sizeof(sandbox_flags_)) { | 584 sizeof(sandbox_flags_)) { |
| 588 PLOG(ERROR) << "write"; | 585 PLOG(ERROR) << "write"; |
| 589 } | 586 } |
| 590 | 587 |
| 591 return false; | 588 return false; |
| 592 } | 589 } |
| 593 | 590 |
| 594 } // namespace content | 591 } // namespace content |
| OLD | NEW |