| OLD | NEW |
| (Empty) | |
| 1 /* |
| 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 |
| 4 * found in the LICENSE file. |
| 5 */ |
| 6 |
| 7 #include "native_client/src/trusted/service_runtime/nacl_secure_service.h" |
| 8 |
| 9 #include "native_client/src/shared/platform/nacl_exit.h" |
| 10 #include "native_client/src/shared/platform/nacl_log.h" |
| 11 #include "native_client/src/shared/platform/nacl_sync.h" |
| 12 #include "native_client/src/shared/platform/nacl_sync_checked.h" |
| 13 #include "native_client/src/shared/srpc/nacl_srpc.h" |
| 14 |
| 15 #include "native_client/src/trusted/fault_injection/fault_injection.h" |
| 16 #include "native_client/src/trusted/simple_service/nacl_simple_service.h" |
| 17 #include "native_client/src/trusted/service_runtime/sel_ldr.h" |
| 18 |
| 19 |
| 20 int NaClCommandServiceCtor(struct NaClCommandService *self, |
| 21 struct NaClSrpcHandlerDesc const *srpc_handlers, |
| 22 struct NaClApp *nap) { |
| 23 NaClLog(4, |
| 24 "Entered NaClCommandServiceCtor: self 0x%"NACL_PRIxPTR"\n", |
| 25 (uintptr_t) self); |
| 26 if (NACL_FI_ERROR_COND( |
| 27 "NaClCommandServiceCtor__NaClSimpleService", |
| 28 !NaClSimpleServiceCtor( |
| 29 &self->base, |
| 30 srpc_handlers, |
| 31 NaClThreadInterfaceThreadFactory, |
| 32 (void *) NULL))) { |
| 33 goto failure_simple_ctor; |
| 34 } |
| 35 self->nap = nap; |
| 36 |
| 37 NACL_VTBL(NaClRefCount, self) = |
| 38 (struct NaClRefCountVtbl *) &kNaClCommandServiceVtbl; |
| 39 return 1; |
| 40 failure_simple_ctor: |
| 41 return 0; |
| 42 } |
| 43 |
| 44 void NaClCommandServiceDtor(struct NaClRefCount *vself) { |
| 45 struct NaClCommandService *self = (struct NaClCommandService *) vself; |
| 46 |
| 47 NACL_VTBL(NaClRefCount, self) = (struct NaClRefCountVtbl const *) |
| 48 &kNaClSimpleServiceVtbl; |
| 49 (*NACL_VTBL(NaClRefCount, self)->Dtor)(vself); |
| 50 } |
| 51 |
| 52 int NaClCommandServiceConnectionFactory( |
| 53 struct NaClSimpleService *vself, |
| 54 struct NaClDesc *conn, |
| 55 struct NaClSimpleServiceConnection **out) { |
| 56 struct NaClCommandService *self = |
| 57 (struct NaClCommandService *) vself; |
| 58 |
| 59 /* our instance_data is not connection specific */ |
| 60 return NaClSimpleServiceConnectionFactoryWithInstanceData( |
| 61 vself, conn, (void *) self->nap, out); |
| 62 } |
| 63 |
| 64 struct NaClSimpleServiceVtbl const kNaClCommandServiceVtbl = { |
| 65 { |
| 66 NaClCommandServiceDtor, |
| 67 }, |
| 68 NaClCommandServiceConnectionFactory, |
| 69 NaClSimpleServiceAcceptConnection, |
| 70 NaClSimpleServiceAcceptAndSpawnHandler, |
| 71 NaClSimpleServiceRpcHandler, |
| 72 }; |
| OLD | NEW |