Index: mojo/nacl/generator/mojo_syscall.cc.tmpl |
diff --git a/mojo/nacl/generator/mojo_syscall.cc.tmpl b/mojo/nacl/generator/mojo_syscall.cc.tmpl |
index 136e672311fbcc41f993e80ec3a16c1b90b51608..8ba76656a8ec64d289c33290544749a8af8f42cb 100644 |
--- a/mojo/nacl/generator/mojo_syscall.cc.tmpl |
+++ b/mojo/nacl/generator/mojo_syscall.cc.tmpl |
@@ -57,10 +57,42 @@ struct NaClDesc* MakeMojoDesc(struct NaClApp* nap) { |
return NaClDescMakeCustomDesc(nap, &funcs); |
} |
+void MojoDisabledDescDestroy(void* handle) { |
+} |
+ |
+ssize_t MojoDisabledDescSendMsg(void* handle, |
+ const struct NaClImcTypedMsgHdr* msg, |
+ int flags) { |
+ fprintf(stderr, "Mojo is not currently supported."); |
+ abort(); |
+} |
+ |
+ssize_t MojoDisabledDescRecvMsg(void* handle, |
+ struct NaClImcTypedMsgHdr* msg, |
+ int flags) { |
+ fprintf(stderr, "Mojo is not currently supported."); |
+ abort(); |
+} |
+ |
+struct NaClDesc* MakeDisabledMojoDesc(struct NaClApp* nap) { |
+ struct NaClDescCustomFuncs funcs = NACL_DESC_CUSTOM_FUNCS_INITIALIZER; |
+ funcs.Destroy = MojoDisabledDescDestroy; |
+ funcs.SendMsg = MojoDisabledDescSendMsg; |
+ funcs.RecvMsg = MojoDisabledDescRecvMsg; |
+ return NaClDescMakeCustomDesc(nap, &funcs); |
+} |
+ |
} // namespace |
-#define NACL_MOJO_DESC (NACL_CHROME_DESC_BASE + 2) |
+// The value for this FD must not conflict with uses inside Chromium. However, |
+// mojo/nacl doesn't depend on any Chromium headers, so we can't use a #define |
+// from there. |
+#define NACL_MOJO_DESC (NACL_CHROME_DESC_BASE + 3) |
void InjectMojo(struct NaClApp* nap) { |
NaClAppSetDesc(nap, NACL_MOJO_DESC, MakeMojoDesc(nap)); |
} |
+ |
+void InjectDisabledMojo(struct NaClApp* nap) { |
+ NaClAppSetDesc(nap, NACL_MOJO_DESC, MakeDisabledMojoDesc(nap)); |
+} |