OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 {{generator_warning}} | 5 {{generator_warning}} |
6 | 6 |
7 #include "mojo/nacl/mojo_syscall.h" | 7 #include "mojo/nacl/mojo_syscall.h" |
8 | 8 |
9 #include <stdio.h> | 9 #include <stdio.h> |
10 | 10 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 } | 50 } |
51 | 51 |
52 struct NaClDesc* MakeMojoDesc(struct NaClApp* nap) { | 52 struct NaClDesc* MakeMojoDesc(struct NaClApp* nap) { |
53 struct NaClDescCustomFuncs funcs = NACL_DESC_CUSTOM_FUNCS_INITIALIZER; | 53 struct NaClDescCustomFuncs funcs = NACL_DESC_CUSTOM_FUNCS_INITIALIZER; |
54 funcs.Destroy = MojoDescDestroy; | 54 funcs.Destroy = MojoDescDestroy; |
55 funcs.SendMsg = MojoDescSendMsg; | 55 funcs.SendMsg = MojoDescSendMsg; |
56 funcs.RecvMsg = MojoDescRecvMsg; | 56 funcs.RecvMsg = MojoDescRecvMsg; |
57 return NaClDescMakeCustomDesc(nap, &funcs); | 57 return NaClDescMakeCustomDesc(nap, &funcs); |
58 } | 58 } |
59 | 59 |
| 60 void MojoDisabledDescDestroy(void* handle) { |
| 61 } |
| 62 |
| 63 ssize_t MojoDisabledDescSendMsg(void* handle, |
| 64 const struct NaClImcTypedMsgHdr* msg, |
| 65 int flags) { |
| 66 fprintf(stderr, "Mojo is not currently supported."); |
| 67 abort(); |
| 68 } |
| 69 |
| 70 ssize_t MojoDisabledDescRecvMsg(void* handle, |
| 71 struct NaClImcTypedMsgHdr* msg, |
| 72 int flags) { |
| 73 fprintf(stderr, "Mojo is not currently supported."); |
| 74 abort(); |
| 75 } |
| 76 |
| 77 struct NaClDesc* MakeDisabledMojoDesc(struct NaClApp* nap) { |
| 78 struct NaClDescCustomFuncs funcs = NACL_DESC_CUSTOM_FUNCS_INITIALIZER; |
| 79 funcs.Destroy = MojoDisabledDescDestroy; |
| 80 funcs.SendMsg = MojoDisabledDescSendMsg; |
| 81 funcs.RecvMsg = MojoDisabledDescRecvMsg; |
| 82 return NaClDescMakeCustomDesc(nap, &funcs); |
| 83 } |
| 84 |
60 } // namespace | 85 } // namespace |
61 | 86 |
62 #define NACL_MOJO_DESC (NACL_CHROME_DESC_BASE + 2) | 87 // The value for this FD must not conflict with uses inside Chromium. However, |
| 88 // mojo/nacl doesn't depend on any Chromium headers, so we can't use a #define |
| 89 // from there. |
| 90 #define NACL_MOJO_DESC (NACL_CHROME_DESC_BASE + 3) |
63 | 91 |
64 void InjectMojo(struct NaClApp* nap) { | 92 void InjectMojo(struct NaClApp* nap) { |
65 NaClAppSetDesc(nap, NACL_MOJO_DESC, MakeMojoDesc(nap)); | 93 NaClAppSetDesc(nap, NACL_MOJO_DESC, MakeMojoDesc(nap)); |
66 } | 94 } |
| 95 |
| 96 void InjectDisabledMojo(struct NaClApp* nap) { |
| 97 NaClAppSetDesc(nap, NACL_MOJO_DESC, MakeDisabledMojoDesc(nap)); |
| 98 } |
OLD | NEW |