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

Side by Side Diff: src/trusted/service_runtime/sel_main_chrome.c

Issue 9307024: Make IRT load failure fatal under Chrome (Closed) Base URL: svn://svn.chromium.org/native_client/trunk/src/native_client
Patch Set: Created 8 years, 10 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 | « no previous file | 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 /* 1 /*
2 * Copyright (c) 2011 The Native Client Authors. All rights reserved. 2 * Copyright (c) 2012 The Native Client Authors. All rights reserved.
3 * Use of this source code is governed by a BSD-style license that can be 3 * Use of this source code is governed by a BSD-style license that can be
4 * found in the LICENSE file. 4 * found in the LICENSE file.
5 */ 5 */
6 6
7 #include "native_client/src/include/portability.h" 7 #include "native_client/src/include/portability.h"
8 #include "native_client/src/include/portability_io.h" 8 #include "native_client/src/include/portability_io.h"
9 9
10 #if NACL_OSX 10 #if NACL_OSX
11 #include <crt_externs.h> 11 #include <crt_externs.h>
12 #endif 12 #endif
(...skipping 27 matching lines...) Expand all
40 void NaClSetIrtFileDesc(int fd) { 40 void NaClSetIrtFileDesc(int fd) {
41 CHECK(g_irt_file_desc == -1); 41 CHECK(g_irt_file_desc == -1);
42 g_irt_file_desc = fd; 42 g_irt_file_desc = fd;
43 } 43 }
44 44
45 static void NaClLoadIrt(struct NaClApp *nap) { 45 static void NaClLoadIrt(struct NaClApp *nap) {
46 int file_desc; 46 int file_desc;
47 struct GioPio gio_pio; 47 struct GioPio gio_pio;
48 struct Gio *gio_desc; 48 struct Gio *gio_desc;
49 49
50 /*
51 * TODO(mseaborn): Eventually we should make the two warnings below
52 * into errors, and require use of the IRT.
53 * See http://code.google.com/p/nativeclient/issues/detail?id=1691
54 */
55 if (g_irt_file_desc == -1) { 50 if (g_irt_file_desc == -1) {
56 NaClLog(0, "NaClLoadIrt: Integrated runtime (IRT) not present. " 51 NaClLog(LOG_FATAL, "NaClLoadIrt: Integrated runtime (IRT) not present.\n");
57 "Continuing anyway.\n");
58 return;
59 } 52 }
60 53
61 file_desc = DUP(g_irt_file_desc); 54 file_desc = DUP(g_irt_file_desc);
62 if (file_desc < 0) { 55 if (file_desc < 0) {
63 NaClLog(LOG_FATAL, "NaClLoadIrt: Failed to dup() file descriptor\n"); 56 NaClLog(LOG_FATAL, "NaClLoadIrt: Failed to dup() file descriptor\n");
64 } 57 }
65 58
66 /* 59 /*
67 * The GioPio type is safe to use when this file descriptor is shared 60 * The GioPio type is safe to use when this file descriptor is shared
68 * with other processes, because it does not use the shared file position. 61 * with other processes, because it does not use the shared file position.
69 */ 62 */
70 if (!GioPioCtor(&gio_pio, file_desc)) { 63 if (!GioPioCtor(&gio_pio, file_desc)) {
71 NaClLog(LOG_FATAL, "NaClLoadIrt: Failed to create Gio wrapper\n"); 64 NaClLog(LOG_FATAL, "NaClLoadIrt: Failed to create Gio wrapper\n");
72 } 65 }
73 gio_desc = (struct Gio *) &gio_pio; 66 gio_desc = (struct Gio *) &gio_pio;
74 67
75 if (NaClAppLoadFileDynamically(nap, gio_desc) != LOAD_OK) { 68 if (NaClAppLoadFileDynamically(nap, gio_desc) != LOAD_OK) {
76 NaClLog(0, "NaClLoadIrt: Failed to load the integrated runtime (IRT). " 69 NaClLog(LOG_FATAL,
77 "The user executable was probably not built to use the IRT. " 70 "NaClLoadIrt: Failed to load the integrated runtime (IRT). "
78 "Continuing anyway.\n"); 71 "The user executable was probably not built to use the IRT.\n");
79 } 72 }
80 73
81 (*NACL_VTBL(Gio, gio_desc)->Close)(gio_desc); 74 (*NACL_VTBL(Gio, gio_desc)->Close)(gio_desc);
82 (*NACL_VTBL(Gio, gio_desc)->Dtor)(gio_desc); 75 (*NACL_VTBL(Gio, gio_desc)->Dtor)(gio_desc);
83 } 76 }
84 77
85 void NaClMainForChromium(int handle_count, const NaClHandle *handles, 78 void NaClMainForChromium(int handle_count, const NaClHandle *handles,
86 int debug) { 79 int debug) {
87 char *av[1]; 80 char *av[1];
88 int ac = 1; 81 int ac = 1;
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 if (LOAD_OK != errcode) { 294 if (LOAD_OK != errcode) {
302 NaClBlockIfCommandChannelExists(nap); 295 NaClBlockIfCommandChannelExists(nap);
303 } 296 }
304 297
305 done_ctor: 298 done_ctor:
306 299
307 NaClAllModulesFini(); 300 NaClAllModulesFini();
308 301
309 NaClExit(ret_code); 302 NaClExit(ret_code);
310 } 303 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698