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

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

Issue 7671011: Revert 97056 - Gyp fix for release build. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 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 | Annotate | Revision Log
« no previous file with comments | « chrome/nacl/nacl_helper_exports.txt ('k') | tools/ld_bfd/ld » ('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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 // Now tell childpid to the Chrome zygote. 109 // Now tell childpid to the Chrome zygote.
110 if (HANDLE_EINTR(send(kNaClZygoteDescriptor, 110 if (HANDLE_EINTR(send(kNaClZygoteDescriptor,
111 &childpid, sizeof(childpid), MSG_EOR)) 111 &childpid, sizeof(childpid), MSG_EOR))
112 != sizeof(childpid)) { 112 != sizeof(childpid)) {
113 LOG(ERROR) << "*** send() to zygote failed"; 113 LOG(ERROR) << "*** send() to zygote failed";
114 } 114 }
115 } 115 }
116 116
117 } // namespace 117 } // namespace
118 118
119 static const void* g_nacl_reserved_space = NULL; 119 int main(int argc, char *argv[]) {
120 extern "C" __attribute__((visibility("default")))
121 const void* nacl_helper_get_1G_address() {
122 return g_nacl_reserved_space;
123 }
124
125 // nacl_helper_init does the real work of this module. It is invoked as
126 // a static constructor and never returns, preventing main() from the
127 // nacl_helper_bootstrap program from being called.
128 //
129 // NOTE This routine must not return.
130 extern "C" __attribute__((visibility("default")))
131 void nacl_helper_init(int argc, char *argv[],
132 const char *nacl_reserved_space) {
133 CommandLine::Init(argc, argv); 120 CommandLine::Init(argc, argv);
134 base::AtExitManager exit_manager; 121 base::AtExitManager exit_manager;
135 base::RandUint64(); // acquire /dev/urandom fd before sandbox is raised 122 base::RandUint64(); // acquire /dev/urandom fd before sandbox is raised
136 std::vector<int> empty; // for SendMsg() calls 123 std::vector<int> empty; // for SendMsg() calls
137 124
138 g_suid_sandbox_active = (NULL != getenv("SBX_D")); 125 g_suid_sandbox_active = (NULL != getenv("SBX_D"));
139 g_nacl_reserved_space = nacl_reserved_space; 126
140 if (!nacl_reserved_space) {
141 VLOG(1) << "nacl_reserved_space is NULL";
142 } else {
143 VLOG(1) << "nacl_reserved_space is at "
144 << (void *)nacl_reserved_space;
145 }
146 // Send the zygote a message to let it know we are ready to help 127 // Send the zygote a message to let it know we are ready to help
147 if (!UnixDomainSocket::SendMsg(kNaClZygoteDescriptor, 128 if (!UnixDomainSocket::SendMsg(kNaClZygoteDescriptor,
148 kNaClHelperStartupAck, 129 kNaClHelperStartupAck,
149 sizeof(kNaClHelperStartupAck), empty)) { 130 sizeof(kNaClHelperStartupAck), empty)) {
150 LOG(ERROR) << "*** send() to zygote failed"; 131 LOG(ERROR) << "*** send() to zygote failed";
151 } 132 }
152 133
153 while (true) { 134 while (true) {
154 int badpid = -1; 135 int badpid = -1;
155 std::vector<int> fds; 136 std::vector<int> fds;
(...skipping 19 matching lines...) Expand all
175 LOG(ERROR) << "nacl_helper unrecognized request: %s"; 156 LOG(ERROR) << "nacl_helper unrecognized request: %s";
176 _exit(-1); 157 _exit(-1);
177 } 158 }
178 } 159 }
179 // if fork fails, send PID=-1 to zygote 160 // if fork fails, send PID=-1 to zygote
180 if (!UnixDomainSocket::SendMsg(kNaClZygoteDescriptor, &badpid, 161 if (!UnixDomainSocket::SendMsg(kNaClZygoteDescriptor, &badpid,
181 sizeof(badpid), empty)) { 162 sizeof(badpid), empty)) {
182 LOG(ERROR) << "*** send() to zygote failed"; 163 LOG(ERROR) << "*** send() to zygote failed";
183 } 164 }
184 } 165 }
185 CHECK(false); // This routine must not return
186 } 166 }
OLDNEW
« no previous file with comments | « chrome/nacl/nacl_helper_exports.txt ('k') | tools/ld_bfd/ld » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698