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

Side by Side Diff: chrome/nacl/nacl_helper_linux.cc

Issue 7863024: Make the NaCl windows 64 bit binaries not depend on chrome targets. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: simplify chrome_exe.gypi Created 9 years, 3 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 | « chrome/nacl/nacl_exe_win_64.cc ('k') | chrome/nacl/nacl_listener.h » ('j') | 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 // A mini-zygote specifically for Native Client. 5 // A mini-zygote specifically for Native Client.
6 6
7 #include "chrome/common/nacl_helper_linux.h" 7 #include "chrome/common/nacl_helper_linux.h"
8 8
9 #include <errno.h> 9 #include <errno.h>
10 #include <stdlib.h> 10 #include <stdlib.h>
(...skipping 29 matching lines...) Expand all
40 LOG(ERROR) << "close(kNaClZygoteDescriptor) failed."; 40 LOG(ERROR) << "close(kNaClZygoteDescriptor) failed.";
41 // Set up browser descriptor as expected by Chrome on fd 3 41 // Set up browser descriptor as expected by Chrome on fd 3
42 // The zygote takes care of putting the sandbox IPC channel on fd 5 42 // The zygote takes care of putting the sandbox IPC channel on fd 5
43 int zfd = dup2(child_fds[kNaClBrowserFDIndex], kNaClBrowserDescriptor); 43 int zfd = dup2(child_fds[kNaClBrowserFDIndex], kNaClBrowserDescriptor);
44 if (zfd != kNaClBrowserDescriptor) { 44 if (zfd != kNaClBrowserDescriptor) {
45 LOG(ERROR) << "Could not initialize kNaClBrowserDescriptor"; 45 LOG(ERROR) << "Could not initialize kNaClBrowserDescriptor";
46 _exit(-1); 46 _exit(-1);
47 } 47 }
48 48
49 MessageLoopForIO main_message_loop; 49 MessageLoopForIO main_message_loop;
50 NaClListener *listener = new NaClListener(); 50 NaClListener listener;
51 listener->Listen(); 51 listener.Listen();
52 _exit(0); 52 _exit(0);
53 } 53 }
54 54
55 // Some of this code was lifted from 55 // Some of this code was lifted from
56 // content/browser/zygote_main_linux.cc:ForkWithRealPid() 56 // content/browser/zygote_main_linux.cc:ForkWithRealPid()
57 void HandleForkRequest(const std::vector<int>& child_fds) { 57 void HandleForkRequest(const std::vector<int>& child_fds) {
58 VLOG(1) << "nacl_helper: forking"; 58 VLOG(1) << "nacl_helper: forking";
59 pid_t childpid = fork(); 59 pid_t childpid = fork();
60 if (childpid < 0) { 60 if (childpid < 0) {
61 perror("fork"); 61 perror("fork");
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 } 165 }
166 } 166 }
167 // if fork fails, send PID=-1 to zygote 167 // if fork fails, send PID=-1 to zygote
168 if (!UnixDomainSocket::SendMsg(kNaClZygoteDescriptor, &badpid, 168 if (!UnixDomainSocket::SendMsg(kNaClZygoteDescriptor, &badpid,
169 sizeof(badpid), empty)) { 169 sizeof(badpid), empty)) {
170 LOG(ERROR) << "*** send() to zygote failed"; 170 LOG(ERROR) << "*** send() to zygote failed";
171 } 171 }
172 } 172 }
173 CHECK(false); // This routine must not return 173 CHECK(false); // This routine must not return
174 } 174 }
OLDNEW
« no previous file with comments | « chrome/nacl/nacl_exe_win_64.cc ('k') | chrome/nacl/nacl_listener.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698