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 <stdint.h> |
8 #include <string.h> | 9 #include <string.h> |
9 #include <sys/socket.h> | 10 #include <sys/socket.h> |
10 #include <sys/types.h> | 11 #include <sys/types.h> |
11 #include <sys/wait.h> | 12 #include <sys/wait.h> |
12 | 13 |
13 #include "base/command_line.h" | 14 #include "base/command_line.h" |
14 #include "base/files/file_util.h" | 15 #include "base/files/file_util.h" |
15 #include "base/linux_util.h" | 16 #include "base/linux_util.h" |
16 #include "base/logging.h" | 17 #include "base/logging.h" |
17 #include "base/macros.h" | 18 #include "base/macros.h" |
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
423 LOG(FATAL) << "Invalid pid from parent zygote"; | 424 LOG(FATAL) << "Invalid pid from parent zygote"; |
424 } | 425 } |
425 #if defined(OS_LINUX) | 426 #if defined(OS_LINUX) |
426 // Sandboxed processes need to send the global, non-namespaced PID when | 427 // Sandboxed processes need to send the global, non-namespaced PID when |
427 // setting up an IPC channel to their parent. | 428 // setting up an IPC channel to their parent. |
428 IPC::Channel::SetGlobalPid(real_pid); | 429 IPC::Channel::SetGlobalPid(real_pid); |
429 // Force the real PID so chrome event data have a PID that corresponds | 430 // Force the real PID so chrome event data have a PID that corresponds |
430 // to system trace event data. | 431 // to system trace event data. |
431 base::trace_event::TraceLog::GetInstance()->SetProcessID( | 432 base::trace_event::TraceLog::GetInstance()->SetProcessID( |
432 static_cast<int>(real_pid)); | 433 static_cast<int>(real_pid)); |
| 434 base::InitUniqueIdForProcessInPidNamespace(real_pid); |
433 #endif | 435 #endif |
434 return 0; | 436 return 0; |
435 } | 437 } |
436 | 438 |
437 // In the parent process. | 439 // In the parent process. |
438 read_pipe.reset(); | 440 read_pipe.reset(); |
439 pid_oracle.reset(); | 441 pid_oracle.reset(); |
440 | 442 |
441 // Always receive a real PID from the zygote host, though it might | 443 // Always receive a real PID from the zygote host, though it might |
442 // be invalid (see below). | 444 // be invalid (see below). |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
609 bool Zygote::HandleGetSandboxStatus(int fd, base::PickleIterator iter) { | 611 bool Zygote::HandleGetSandboxStatus(int fd, base::PickleIterator iter) { |
610 if (HANDLE_EINTR(write(fd, &sandbox_flags_, sizeof(sandbox_flags_))) != | 612 if (HANDLE_EINTR(write(fd, &sandbox_flags_, sizeof(sandbox_flags_))) != |
611 sizeof(sandbox_flags_)) { | 613 sizeof(sandbox_flags_)) { |
612 PLOG(ERROR) << "write"; | 614 PLOG(ERROR) << "write"; |
613 } | 615 } |
614 | 616 |
615 return false; | 617 return false; |
616 } | 618 } |
617 | 619 |
618 } // namespace content | 620 } // namespace content |
OLD | NEW |