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

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

Issue 7800026: Fix nacl_helper argv bug, re-enable, build on linux except ARM (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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/chrome_exe.gypi ('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) 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 #include "chrome/common/nacl_fork_delegate_linux.h" 5 #include "chrome/common/nacl_fork_delegate_linux.h"
6 6
7 #include <signal.h> 7 #include <signal.h>
8 #include <stdlib.h> 8 #include <stdlib.h>
9 #include <sys/socket.h> 9 #include <sys/socket.h>
10 10
(...skipping 28 matching lines...) Expand all
39 // Confirm a couple hard-wired assumptions. 39 // Confirm a couple hard-wired assumptions.
40 // The NaCl constants are from chrome/nacl/nacl_linux_helper.h 40 // The NaCl constants are from chrome/nacl/nacl_linux_helper.h
41 DCHECK(kNaClBrowserDescriptor == browserdesc); 41 DCHECK(kNaClBrowserDescriptor == browserdesc);
42 DCHECK(kNaClSandboxDescriptor == sandboxdesc); 42 DCHECK(kNaClSandboxDescriptor == sandboxdesc);
43 43
44 CHECK(socketpair(PF_UNIX, SOCK_SEQPACKET, 0, fds) == 0); 44 CHECK(socketpair(PF_UNIX, SOCK_SEQPACKET, 0, fds) == 0);
45 base::file_handle_mapping_vector fds_to_map; 45 base::file_handle_mapping_vector fds_to_map;
46 fds_to_map.push_back(std::make_pair(fds[1], kNaClZygoteDescriptor)); 46 fds_to_map.push_back(std::make_pair(fds[1], kNaClZygoteDescriptor));
47 fds_to_map.push_back(std::make_pair(sandboxdesc, kNaClSandboxDescriptor)); 47 fds_to_map.push_back(std::make_pair(sandboxdesc, kNaClSandboxDescriptor));
48 ready_ = false; 48 ready_ = false;
49 return; // Disable nacl_helper while fixing some issues.
50
51 FilePath helper_exe; 49 FilePath helper_exe;
52 FilePath helper_bootstrap_exe; 50 FilePath helper_bootstrap_exe;
53 if (PathService::Get(chrome::FILE_NACL_HELPER, &helper_exe) && 51 if (PathService::Get(chrome::FILE_NACL_HELPER, &helper_exe) &&
54 PathService::Get(chrome::FILE_NACL_HELPER_BOOTSTRAP, 52 PathService::Get(chrome::FILE_NACL_HELPER_BOOTSTRAP,
55 &helper_bootstrap_exe) && 53 &helper_bootstrap_exe) &&
56 !RunningOnValgrind()) { 54 !RunningOnValgrind()) {
57 CommandLine::StringVector argv = CommandLine::ForCurrentProcess()->argv(); 55 CommandLine cmd_line(helper_bootstrap_exe);
58 argv[0] = helper_bootstrap_exe.value(); 56 cmd_line.AppendArgPath(helper_exe);
59 argv[1] = helper_exe.value(); 57 cmd_line.AppendArgNative(kNaClHelperAtZero);
60 argv[2] = kNaClHelperAtZero;
61 base::LaunchOptions options; 58 base::LaunchOptions options;
62 options.fds_to_remap = &fds_to_map; 59 options.fds_to_remap = &fds_to_map;
63 options.clone_flags = CLONE_FS | SIGCHLD; 60 options.clone_flags = CLONE_FS | SIGCHLD;
64 ready_ = base::LaunchProcess(argv, options, NULL); 61 ready_ = base::LaunchProcess(cmd_line.argv(), options, NULL);
65 // parent and error cases are handled below 62 // parent and error cases are handled below
66 } 63 }
67 if (HANDLE_EINTR(close(fds[1])) != 0) 64 if (HANDLE_EINTR(close(fds[1])) != 0)
68 LOG(ERROR) << "close(fds[1]) failed"; 65 LOG(ERROR) << "close(fds[1]) failed";
69 if (ready_) { 66 if (ready_) {
70 const ssize_t kExpectedLength = strlen(kNaClHelperStartupAck); 67 const ssize_t kExpectedLength = strlen(kNaClHelperStartupAck);
71 char buf[kExpectedLength]; 68 char buf[kExpectedLength];
72 69
73 // Wait for ack from nacl_helper, indicating it is ready to help 70 // Wait for ack from nacl_helper, indicating it is ready to help
74 const ssize_t nread = HANDLE_EINTR(read(fds[0], buf, sizeof(buf))); 71 const ssize_t nread = HANDLE_EINTR(read(fds[0], buf, sizeof(buf)));
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 118
122 bool NaClForkDelegate::AckChild(const int fd, 119 bool NaClForkDelegate::AckChild(const int fd,
123 const std::string& channel_switch) { 120 const std::string& channel_switch) {
124 int nwritten = HANDLE_EINTR(write(fd, channel_switch.c_str(), 121 int nwritten = HANDLE_EINTR(write(fd, channel_switch.c_str(),
125 channel_switch.length())); 122 channel_switch.length()));
126 if (nwritten != static_cast<int>(channel_switch.length())) { 123 if (nwritten != static_cast<int>(channel_switch.length())) {
127 return false; 124 return false;
128 } 125 }
129 return true; 126 return true;
130 } 127 }
OLDNEW
« no previous file with comments | « chrome/chrome_exe.gypi ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698