• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ NACL_VTBL函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中NACL_VTBL函数的典型用法代码示例。如果您正苦于以下问题:C++ NACL_VTBL函数的具体用法?C++ NACL_VTBL怎么用?C++ NACL_VTBL使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了NACL_VTBL函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: NaClNameServiceCtor

int NaClNameServiceCtor(struct NaClNameService      *self,
                        NaClThreadIfFactoryFunction thread_factory_fn,
                        void                        *thread_factory_data) {
  int     retval = 0;  /* fail */

  NaClLog(4, "Entered NaClNameServiceCtor\n");
  if (!NaClSimpleLtdServiceCtor(&self->base,
                                kNaClNameServiceHandlers,
                                NACL_NAME_SERVICE_CONNECTION_MAX,
                                thread_factory_fn,
                                thread_factory_data)) {
    NaClLog(4, "NaClSimpleLtdServiceCtor failed\n");
    goto done;
  }
  if (!NaClMutexCtor(&self->mu)) {
    NaClLog(4, "NaClMutexCtor failed\n");
    goto abort_mu;
  }
  NACL_VTBL(NaClRefCount, self) = (struct NaClRefCountVtbl *)
      &kNaClNameServiceVtbl;
  /* success return path */
  self->head = (struct NaClNameServiceEntry *) NULL;
  retval = 1;
  goto done;

  /* cleanup unwind */
 abort_mu:  /* mutex ctor failed */
  (*NACL_VTBL(NaClRefCount, self)->Dtor)((struct NaClRefCount *) self);
 done:
  return retval;
}
开发者ID:davidbrazdil,项目名称:nacl,代码行数:31,代码来源:name_service.c


示例2: NaClManifestProxyConnectionDtor

static void NaClManifestProxyConnectionDtor(struct NaClRefCount *vself) {
  struct NaClManifestProxyConnection *self =
      (struct NaClManifestProxyConnection *) vself;
  NaClLog(4,
          "Entered NaClManifestProxyConnectionDtor: self 0x%"NACL_PRIxPTR"\n",
          (uintptr_t) self);
  NaClXMutexLock(&self->mu);
  while (!self->channel_initialized) {
    NaClLog(4,
            "NaClManifestProxyConnectionDtor:"
            " waiting for connection initialization\n");
    NaClXCondVarWait(&self->cv, &self->mu);
  }
  NaClXMutexUnlock(&self->mu);

  NaClLog(4, "NaClManifestProxyConnectionDtor: dtoring\n");

  NaClCondVarDtor(&self->cv);
  NaClMutexDtor(&self->mu);

  NaClSrpcDtor(&self->client_channel);
  NACL_VTBL(NaClSimpleServiceConnection, self) =
      &kNaClSimpleServiceConnectionVtbl;
  (*NACL_VTBL(NaClRefCount, self)->Dtor)(vself);
}
开发者ID:wilsonianb,项目名称:nacl_contracts,代码行数:25,代码来源:manifest_proxy.c


示例3: NaClReverseThreadIfCtor_protected

int NaClReverseThreadIfCtor_protected(
    struct NaClReverseCountingThreadInterface   *self,
    void                                        *factory_data,
    NaClThreadIfStartFunction                   fn_ptr,
    void                                        *thread_data,
    size_t                                      thread_stack_size) {
  struct NaClReverseService *nrsp = (struct NaClReverseService *) factory_data;

  NaClLog(3, "Entered NaClReverseThreadIfCtor_protected\n");
  if (!NaClThreadInterfaceCtor_protected(
          (struct NaClThreadInterface *) self,
          NaClReverseThreadIfFactoryFn,
          NaClRefCountRef((struct NaClRefCount *) nrsp),
          fn_ptr,
          thread_data,
          thread_stack_size)) {
    NaClLog(4, "NaClThreadInterfaceCtor_protected failed\n");
    NaClRefCountUnref((struct NaClRefCount *) nrsp);
    return 0;
  }

  self->reverse_service = nrsp;
  (*NACL_VTBL(NaClReverseService, nrsp)->ThreadCountIncr)(nrsp);

  NACL_VTBL(NaClRefCount, self) =
      (struct NaClRefCountVtbl *) &kNaClReverseThreadInterfaceVtbl;

  NaClLog(3, "Leaving NaClAddrSpSquattingThreadIfCtor_protected\n");
  return 1;
}
开发者ID:Lind-Project,项目名称:native_client,代码行数:30,代码来源:reverse_service_c.c


示例4: NaClGetFileOriginInfo

int NaClGetFileOriginInfo(struct NaClDesc *desc,
                          struct NaClRichFileInfo *info) {
  int32_t metadata_type;
  uint8_t *buffer = NULL;
  uint32_t buffer_length = 0;
  int status;

  /* Get the buffer length. */
  metadata_type = NACL_VTBL(NaClDesc, desc)->GetMetadata(
      desc,
      &buffer_length,
      NULL);
  if (metadata_type != NACL_DESC_METADATA_ORIGIN_INFO_TYPE)
    return 1;

  buffer = (uint8_t *) malloc(buffer_length);
  if (NULL == buffer)
    return 1;

  metadata_type = NACL_VTBL(NaClDesc, desc)->GetMetadata(
      desc,
      &buffer_length,
      buffer);
  if (metadata_type != NACL_DESC_METADATA_ORIGIN_INFO_TYPE)
    return 1;

  status = NaClDeserializeNaClDescMetadata(buffer, buffer_length, info);
  free(buffer);
  return status;
}
开发者ID:Lind-Project,项目名称:native_client,代码行数:30,代码来源:validation_cache.c


示例5: NaClReverseInterfaceDtor

void NaClReverseInterfaceDtor(struct NaClRefCount *vself) {
  struct NaClReverseInterface *self =
      (struct NaClReverseInterface *) vself;

  NACL_VTBL(NaClRefCount, self) = &kNaClRefCountVtbl;
  (*NACL_VTBL(NaClRefCount, self)->Dtor)(vself);
}
开发者ID:Lind-Project,项目名称:native_client,代码行数:7,代码来源:reverse_service_c.c


示例6: NaClDescRngDtor

static void NaClDescRngDtor(struct NaClRefCount *vself) {
  struct NaClDescRng *self = (struct NaClDescRng *) vself;

  (*NACL_VTBL(NaClSecureRngIf, &self->rng)->Dtor)(
      (struct NaClSecureRngIf *) &self->rng);
  NACL_VTBL(NaClDesc, self) = &kNaClDescVtbl;
  (*NACL_VTBL(NaClRefCount, self)->Dtor)((struct NaClRefCount *) self);
}
开发者ID:bortoq,项目名称:zerovm,代码行数:8,代码来源:nacl_desc_rng.c


示例7: NaClDescQuotaPWrite

ssize_t NaClDescQuotaPWrite(struct NaClDesc *vself,
                            void const *buf,
                            size_t len,
                            nacl_off64_t offset) {
  struct NaClDescQuota  *self = (struct NaClDescQuota *) vself;
  uint64_t              len_u64;
  int64_t               allowed;
  ssize_t               rv;

  if (0 == len) {
    allowed = 0;
  } else {
    NACL_COMPILE_TIME_ASSERT(SIZE_T_MAX <= NACL_UMAX_VAL(uint64_t));
    /*
     * Write can always return a short, non-zero transfer count.
     */
    len_u64 = (uint64_t) len;
    /* get rid of the always-true/always-false comparison warning */
    if (len_u64 > NACL_MAX_VAL(int64_t)) {
      len = (size_t) NACL_MAX_VAL(int64_t);
    }

    if (NULL == self->quota_interface) {
      /* If there is no quota_interface, do not allow writes. */
      allowed = 0;
    } else {
      allowed = (*NACL_VTBL(NaClDescQuotaInterface, self->quota_interface)->
                 WriteRequest)(self->quota_interface,
                               self->file_id, offset, len);
    }
    if (allowed <= 0) {
      rv = -NACL_ABI_EDQUOT;
      goto abort;
    }
    /*
     * allowed <= len should be a post-condition, but we check for
     * it anyway.
     */
    if ((uint64_t) allowed > len) {
      NaClLog(LOG_WARNING,
              ("NaClDescQuotaPWrite: WriteRequest returned an allowed quota"
               " that is larger than that requested; reducing to original"
               " request amount.\n"));
      allowed = len;
    }
  }

  /*
   * It is possible for Write to write fewer than bytes than the quota
   * that was granted, in which case quota will leak.
   * TODO(sehr,bsy): eliminate quota leakage.
   */
  rv = (*NACL_VTBL(NaClDesc, self->desc)->PWrite)(self->desc,
                                                  buf, (size_t) allowed,
                                                  offset);
abort:
  return rv;
}
开发者ID:Lind-Project,项目名称:native_client,代码行数:58,代码来源:nacl_desc_quota.c


示例8: NaClSimpleServiceDtor

void NaClSimpleServiceDtor(struct NaClRefCount *vself) {
  struct NaClSimpleService *self = (struct NaClSimpleService *) vself;

  NaClRefCountSafeUnref((struct NaClRefCount *) self->bound_and_cap[0]);
  NaClRefCountSafeUnref((struct NaClRefCount *) self->bound_and_cap[1]);

  NACL_VTBL(NaClRefCount, self) = &kNaClRefCountVtbl;
  (*NACL_VTBL(NaClRefCount, self)->Dtor)(vself);
}
开发者ID:ClarkWang-2013,项目名称:native_client,代码行数:9,代码来源:nacl_simple_service.c


示例9: NaClReverseHostInterfaceDtor

void NaClReverseHostInterfaceDtor(struct NaClRefCount *vself) {
  struct NaClReverseHostInterface *self =
      (struct NaClReverseHostInterface *) vself;

  NaClRefCountUnref((struct NaClRefCount *) self->server);

  NACL_VTBL(NaClRefCount, self) = &kNaClRefCountVtbl;
  (*NACL_VTBL(NaClRefCount, self)->Dtor)(vself);
}
开发者ID:Lind-Project,项目名称:native_client,代码行数:9,代码来源:nacl_reverse_host_interface.c


示例10: NaClKernelServiceDtor

void NaClKernelServiceDtor(struct NaClRefCount *vself) {
  struct NaClKernelService *self = (struct NaClKernelService *) vself;

  NaClRefCountUnref((struct NaClRefCount *) self->runtime_host);

  NACL_VTBL(NaClRefCount, self) =
      (struct NaClRefCountVtbl *) &kNaClSimpleServiceVtbl;
  (*NACL_VTBL(NaClRefCount, self)->Dtor)(vself);
}
开发者ID:Lind-Project,项目名称:native_client,代码行数:9,代码来源:nacl_kernel_service.c


示例11: NaClReverseThreadIfDtor

void NaClReverseThreadIfDtor(struct NaClRefCount *vself) {
  struct NaClReverseCountingThreadInterface *self =
      (struct NaClReverseCountingThreadInterface *) vself;

  NaClRefCountUnref((struct NaClRefCount *) self->reverse_service);
  self->reverse_service = NULL;
  NACL_VTBL(NaClRefCount, self) = &kNaClRefCountVtbl;
  (*NACL_VTBL(NaClRefCount, self)->Dtor)(vself);
}
开发者ID:Lind-Project,项目名称:native_client,代码行数:9,代码来源:reverse_service_c.c


示例12: NaClDescPostMessageDtor

static void NaClDescPostMessageDtor(struct NaClRefCount *vself) {
  struct NaClDescPostMessage  *self = (struct NaClDescPostMessage *) vself;

  NaClLog(4, "Entered NaClDescPostMessageDtor\n");
  self->nap = NULL;
  NACL_VTBL(NaClRefCount, vself) =
      (struct NaClRefCountVtbl const *) &kNaClDescVtbl;
  (*NACL_VTBL(NaClRefCount, vself)->Dtor)(vself);
  NaClLog(4, "Leaving NaClDescPostMessageDtor\n");
}
开发者ID:ClarkWang-2013,项目名称:native_client,代码行数:10,代码来源:nacl_desc_postmessage.c


示例13: NaClSimpleServiceConnectionDtor

void NaClSimpleServiceConnectionDtor(struct NaClRefCount *vself) {
  struct NaClSimpleServiceConnection *self =
      (struct NaClSimpleServiceConnection *) vself;

  NaClRefCountUnref((struct NaClRefCount *) self->server);
  NaClRefCountUnref((struct NaClRefCount *) self->connected_socket);

  NACL_VTBL(NaClRefCount, self) = &kNaClRefCountVtbl;
  (*NACL_VTBL(NaClRefCount, self)->Dtor)(vself);
}
开发者ID:ClarkWang-2013,项目名称:native_client,代码行数:10,代码来源:nacl_simple_service.c


示例14: NaClManifestProxyDtor

static void NaClManifestProxyDtor(struct NaClRefCount *vself) {
  struct NaClManifestProxy *self =
      (struct NaClManifestProxy *) vself;

  NaClRefCountUnref((struct NaClRefCount *) self->server);

  NACL_VTBL(NaClRefCount, self) =
      (struct NaClRefCountVtbl *) &kNaClSimpleServiceVtbl;
  (*NACL_VTBL(NaClRefCount, self)->Dtor)(vself);
}
开发者ID:wilsonianb,项目名称:nacl_contracts,代码行数:10,代码来源:manifest_proxy.c


示例15: NaClSimpleLtdServiceDtor

void NaClSimpleLtdServiceDtor(struct NaClRefCount *vself) {
  struct NaClSimpleLtdService *self =
      (struct NaClSimpleLtdService *) vself;

  CHECK(0 == self->num_clients);
  NaClCondVarDtor(&self->cv);
  NaClMutexDtor(&self->mu);
  NACL_VTBL(NaClRefCount, self) =
      (struct NaClRefCountVtbl *) &kNaClSimpleServiceVtbl;
  (*NACL_VTBL(NaClRefCount, self)->Dtor)((struct NaClRefCount *) self);
}
开发者ID:ClarkWang-2013,项目名称:native_client,代码行数:11,代码来源:nacl_simple_ltd_service.c


示例16: NaClDescQuotaDtor

void NaClDescQuotaDtor(struct NaClRefCount *vself) {
  struct NaClDescQuota *self = (struct NaClDescQuota *) vself;

  NaClRefCountSafeUnref((struct NaClRefCount *) self->quota_interface);
  NaClRefCountUnref((struct NaClRefCount *) self->desc);
  self->desc = NULL;
  NaClMutexDtor(&self->mu);

  NACL_VTBL(NaClDesc, self) = &kNaClDescVtbl;
  (*NACL_VTBL(NaClRefCount, self)->Dtor)(vself);
}
开发者ID:Lind-Project,项目名称:native_client,代码行数:11,代码来源:nacl_desc_quota.c


示例17: NaClSimpleServiceAcceptConnection

int NaClSimpleServiceAcceptConnection(
    struct NaClSimpleService            *self,
    struct NaClSimpleServiceConnection  **out) {
  int                                 status = -NACL_ABI_EINVAL;
  struct NaClSimpleServiceConnection  *conn = NULL;
  struct NaClDesc                     *connected_desc = NULL;

  NaClLog(4, "Entered NaClSimpleServiceAcceptConnection\n");
  conn = malloc(sizeof *conn);
  if (NULL == conn) {
    return -NACL_ABI_ENOMEM;
  }
  /* NB: conn is allocated but not constructed */
  status = (*NACL_VTBL(NaClDesc, self->bound_and_cap[0])->
            AcceptConn)(self->bound_and_cap[0], &connected_desc);
  if (0 != status) {
    NaClLog(4, "Accept failed\n");
    free(conn);
    conn = NULL;
    goto cleanup;
  }

  NaClLog(4,
          "connected_desc is 0x%"NACL_PRIxPTR"\n",
          (uintptr_t) connected_desc);

  status = (*NACL_VTBL(NaClSimpleService, self)->ConnectionFactory)(
      self,
      connected_desc,
      &conn);
  if (0 != status) {
    NaClLog(4, "ConnectionFactory failed\n");
    goto cleanup;
  }
  /* all okay! */

  NaClLog(4,
          "NaClSimpleServiceAcceptConnection: conn is 0x%"NACL_PRIxPTR"\n",
          (uintptr_t) conn);
  NaClLog(4,
          "NaClSimpleServiceAcceptConnection: out  is 0x%"NACL_PRIxPTR"\n",
          (uintptr_t) out);
  *out = conn;
  status = 0;
cleanup:
  NaClRefCountSafeUnref((struct NaClRefCount *) connected_desc);
  NaClLog(4, "Leaving NaClSimpleServiceAcceptConnection, status %d\n", status);
  return status;
}
开发者ID:ClarkWang-2013,项目名称:native_client,代码行数:49,代码来源:nacl_simple_service.c


示例18: NaClDescQuotaSendMsg

ssize_t NaClDescQuotaSendMsg(struct NaClDesc                 *vself,
                             const struct NaClImcTypedMsgHdr *nitmhp,
                             int                             flags) {
  struct NaClDescQuota  *self = (struct NaClDescQuota *) vself;

  return (*NACL_VTBL(NaClDesc, self->desc)->SendMsg)(self->desc, nitmhp, flags);
}
开发者ID:Lind-Project,项目名称:native_client,代码行数:7,代码来源:nacl_desc_quota.c


示例19: NaClVmmapEntryMaxProt

int NaClVmmapEntryMaxProt(struct NaClVmmapEntry *entry) {
  int flags = PROT_NONE;

  if (entry->desc != NULL && 0 == (entry->flags & NACL_ABI_MAP_PRIVATE)) {
    int o_flags = (*NACL_VTBL(NaClDesc, entry->desc)->GetFlags)(entry->desc);
    switch (o_flags & NACL_ABI_O_ACCMODE) {
      case NACL_ABI_O_RDONLY:
        flags = NACL_ABI_PROT_READ;
        break;
      case NACL_ABI_O_WRONLY:
        flags = NACL_ABI_PROT_WRITE;
        break;
      case NACL_ABI_O_RDWR:
        flags = NACL_ABI_PROT_READ | NACL_ABI_PROT_WRITE;
        break;
      default:
        NaClLog(LOG_FATAL, "Internal error: illegal O_ACCMODE\n");
        break;
    }
  } else {
    flags = NACL_ABI_PROT_READ | NACL_ABI_PROT_WRITE;
  }

  return flags;
}
开发者ID:Lind-Project,项目名称:native_client,代码行数:25,代码来源:sel_mem.c


示例20: NaClReverseServiceManifestListRpc

/*
 * Enumerate all names in the manifest.
 */
static void NaClReverseServiceManifestListRpc(
    struct NaClSrpcRpc      *rpc,
    struct NaClSrpcArg      **in_args,
    struct NaClSrpcArg      **out_args,
    struct NaClSrpcClosure  *done_cls) {
  struct NaClReverseService *nrsp =
    (struct NaClReverseService *) rpc->channel->server_instance_data;
  char                      *buffer = out_args[0]->arrays.carr;
  nacl_abi_size_t           buffer_bytes = out_args[0]->u.count;
  size_t                    size;
  UNREFERENCED_PARAMETER(in_args);

  NaClLog(4, "Entered ManifestListRpc: 0x%08"NACL_PRIxPTR"\n",
          (uintptr_t) nrsp);
  if ((size = (*NACL_VTBL(NaClReverseInterface, nrsp->iface)->
               EnumerateManifestKeys)(nrsp->iface, buffer, buffer_bytes))
      > NACL_ABI_SIZE_T_MAX) {
    NaClLog(LOG_FATAL,
            ("ManifestListRpc: buffer size required is too large"
             ", %08"NACL_PRIdS"\n"),
            size);
  }
  out_args[0]->u.count = (nacl_abi_size_t) size;
  rpc->result = NACL_SRPC_RESULT_OK;
  (*done_cls->Run)(done_cls);
}
开发者ID:Lind-Project,项目名称:native_client,代码行数:29,代码来源:reverse_service_c.c



注:本文中的NACL_VTBL函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ NADELETEBASIC函数代码示例发布时间:2022-05-30
下一篇:
C++ NACL_SYSCALL函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap