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

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

Issue 10392176: Zygote: create variables for magic fd numbers (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Minor comment update Created 8 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « content/common/zygote_commands_linux.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <string.h> 7 #include <string.h>
8 #include <sys/socket.h> 8 #include <sys/socket.h>
9 #include <sys/types.h> 9 #include <sys/types.h>
10 #include <sys/wait.h> 10 #include <sys/wait.h>
(...skipping 17 matching lines...) Expand all
28 #include "content/public/common/zygote_fork_delegate_linux.h" 28 #include "content/public/common/zygote_fork_delegate_linux.h"
29 #include "content/common/sandbox_methods_linux.h" 29 #include "content/common/sandbox_methods_linux.h"
30 #include "content/common/zygote_commands_linux.h" 30 #include "content/common/zygote_commands_linux.h"
31 31
32 // See http://code.google.com/p/chromium/wiki/LinuxZygote 32 // See http://code.google.com/p/chromium/wiki/LinuxZygote
33 33
34 namespace content { 34 namespace content {
35 35
36 namespace { 36 namespace {
37 37
38 const int kZygoteIdDescriptor = 7;
39
40 // NOP function. See below where this handler is installed. 38 // NOP function. See below where this handler is installed.
41 void SIGCHLDHandler(int signal) { 39 void SIGCHLDHandler(int signal) {
42 } 40 }
43 41
44 } // namespace 42 } // namespace
45 43
46 Zygote::Zygote(int sandbox_flags, 44 Zygote::Zygote(int sandbox_flags,
47 ZygoteForkDelegate* helper, 45 ZygoteForkDelegate* helper,
48 int proc_fd_for_seccomp) 46 int proc_fd_for_seccomp)
49 : sandbox_flags_(sandbox_flags), 47 : sandbox_flags_(sandbox_flags),
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after
406 } else { 404 } else {
407 PLOG(ERROR) << "openat(/proc/self/maps)"; 405 PLOG(ERROR) << "openat(/proc/self/maps)";
408 } 406 }
409 close(proc_fd_for_seccomp_); 407 close(proc_fd_for_seccomp_);
410 proc_fd_for_seccomp_ = -1; 408 proc_fd_for_seccomp_ = -1;
411 } 409 }
412 #endif 410 #endif
413 411
414 close(kBrowserDescriptor); // Our socket from the browser. 412 close(kBrowserDescriptor); // Our socket from the browser.
415 if (UsingSUIDSandbox()) 413 if (UsingSUIDSandbox())
416 close(kZygoteIdDescriptor); // Another socket from the browser. 414 close(content::kZygoteIdFd); // Another socket from the browser.
brettw 2012/05/21 17:52:05 You're already in content, so remove "content::".
417 base::GlobalDescriptors::GetInstance()->Reset(mapping); 415 base::GlobalDescriptors::GetInstance()->Reset(mapping);
418 416
419 #if defined(CHROMIUM_SELINUX) 417 #if defined(CHROMIUM_SELINUX)
420 SELinuxTransitionToTypeOrDie("chromium_renderer_t"); 418 SELinuxTransitionToTypeOrDie("chromium_renderer_t");
421 #endif 419 #endif
422 420
423 // Reset the process-wide command line to our new command line. 421 // Reset the process-wide command line to our new command line.
424 CommandLine::Reset(); 422 CommandLine::Reset();
425 CommandLine::Init(0, NULL); 423 CommandLine::Init(0, NULL);
426 CommandLine::ForCurrentProcess()->InitFromArgv(args); 424 CommandLine::ForCurrentProcess()->InitFromArgv(args);
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
479 PickleIterator iter) { 477 PickleIterator iter) {
480 if (HANDLE_EINTR(write(fd, &sandbox_flags_, sizeof(sandbox_flags_))) != 478 if (HANDLE_EINTR(write(fd, &sandbox_flags_, sizeof(sandbox_flags_))) !=
481 sizeof(sandbox_flags_)) { 479 sizeof(sandbox_flags_)) {
482 PLOG(ERROR) << "write"; 480 PLOG(ERROR) << "write";
483 } 481 }
484 482
485 return false; 483 return false;
486 } 484 }
487 485
488 } // namespace content 486 } // namespace content
OLDNEW
« no previous file with comments | « content/common/zygote_commands_linux.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698