Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(105)

Side by Side Diff: content/zygote/zygote_linux.cc

Issue 1186873006: Add Get/SetUniqueIdForProcess. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 412 matching lines...) Expand 10 before | Expand all | Expand 10 after
423 LOG(FATAL) << "Invalid pid from parent zygote"; 423 LOG(FATAL) << "Invalid pid from parent zygote";
424 } 424 }
425 #if defined(OS_LINUX) 425 #if defined(OS_LINUX)
426 // Sandboxed processes need to send the global, non-namespaced PID when 426 // Sandboxed processes need to send the global, non-namespaced PID when
427 // setting up an IPC channel to their parent. 427 // setting up an IPC channel to their parent.
428 IPC::Channel::SetGlobalPid(real_pid); 428 IPC::Channel::SetGlobalPid(real_pid);
429 // Force the real PID so chrome event data have a PID that corresponds 429 // Force the real PID so chrome event data have a PID that corresponds
430 // to system trace event data. 430 // to system trace event data.
431 base::trace_event::TraceLog::GetInstance()->SetProcessID( 431 base::trace_event::TraceLog::GetInstance()->SetProcessID(
432 static_cast<int>(real_pid)); 432 static_cast<int>(real_pid));
433 base::SetUniqueIdForProcess(static_cast<uint32>(real_pid));
Lei Zhang 2015/07/28 21:54:23 base/basictypes.h says to use uint32_t instead, di
rickyz (no longer on Chrome) 2015/07/28 22:39:37 Done.
433 #endif 434 #endif
434 return 0; 435 return 0;
435 } 436 }
436 437
437 // In the parent process. 438 // In the parent process.
438 read_pipe.reset(); 439 read_pipe.reset();
439 pid_oracle.reset(); 440 pid_oracle.reset();
440 441
441 // Always receive a real PID from the zygote host, though it might 442 // Always receive a real PID from the zygote host, though it might
442 // be invalid (see below). 443 // be invalid (see below).
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
609 bool Zygote::HandleGetSandboxStatus(int fd, base::PickleIterator iter) { 610 bool Zygote::HandleGetSandboxStatus(int fd, base::PickleIterator iter) {
610 if (HANDLE_EINTR(write(fd, &sandbox_flags_, sizeof(sandbox_flags_))) != 611 if (HANDLE_EINTR(write(fd, &sandbox_flags_, sizeof(sandbox_flags_))) !=
611 sizeof(sandbox_flags_)) { 612 sizeof(sandbox_flags_)) {
612 PLOG(ERROR) << "write"; 613 PLOG(ERROR) << "write";
613 } 614 }
614 615
615 return false; 616 return false;
616 } 617 }
617 618
618 } // namespace content 619 } // namespace content
OLDNEW
« base/process/process_handle.cc ('K') | « base/process/process_handle.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698