void NaClFileLockManagerCtor(struct NaClFileLockManager *self) {
  NaClXMutexCtor(&self->mu);
  self->head = NULL;
  self->set_file_identity_data = NaClFileLockManagerSetFileIdentityData;
  self->take_file_lock = NaClFileLockManagerTakeLock;
  self->drop_file_lock = NaClFileLockManagerDropLock;
}
void NaClGlobalSecureRngInit(void) {
    NaClXMutexCtor(&nacl_global_rng_mu);
    if (!NaClSecureRngCtor(nacl_grngp)) {
        NaClLog(LOG_FATAL,
                "Could not construct global random number generator.\n");
    }
}
void AlarmerStateCtor(struct AlarmerState *sp,
                      uint64_t            sleep_usec,
                      uint64_t            cond_timeout_usec) {
  NaClXMutexCtor(&sp->mu);
  sp->abort_on_wake = 1;
  sp->sleep_usec = sleep_usec;
  sp->cond_timeout_usec = cond_timeout_usec;
}
Exemple #4
0
void NaClLogModuleInitExtended(int        initial_verbosity,
                               struct Gio *log_gio) {
  if (!g_initialized) {
    NaClXMutexCtor(&log_mu);
    g_initialized = 1;
  }
  NaClLogSetVerbosity(initial_verbosity);
  NaClLogSetGio(log_gio);
}
static struct NaClFileLockEntry *NaClFileLockManagerEntryFactory(
    struct NaClFileLockManager *self,
    int desc) {
  struct NaClFileLockEntry *result;

  result = malloc(sizeof *result);
  CHECK(NULL != result);
  (*self->set_file_identity_data)(result, desc);
  result->next = NULL;
  NaClXMutexCtor(&result->mu);
  NaClXCondVarCtor(&result->cv);
  result->holding_lock = 1;  /* caller is creating to hold the lock */
  result->num_waiting = 0;
  return result;
}
Exemple #6
0
static void NaClFaultInjectAllocGlobalCounters(void) {
  size_t ix;

  gNaClFaultInjectCallSites = (struct NaClFaultInjectCallSiteCount *)
      malloc(gNaClNumFaultInjectInfo * sizeof *gNaClFaultInjectCallSites);
  CHECK(NULL != gNaClFaultInjectCallSites);
  gNaClFaultInjectMu = (struct NaClMutex *) malloc(
      gNaClNumFaultInjectInfo * sizeof *gNaClFaultInjectMu);
  CHECK(NULL != gNaClFaultInjectMu);
  for (ix = 0; ix < gNaClNumFaultInjectInfo; ++ix) {
    gNaClFaultInjectCallSites[ix].expr_ix = 0;
    gNaClFaultInjectCallSites[ix].count_in_expr = 0;

    NaClXMutexCtor(&gNaClFaultInjectMu[ix]);
  }
}
int NaClManifestProxyConnectionCtor(struct NaClManifestProxyConnection  *self,
                                    struct NaClManifestProxy            *server,
                                    struct NaClDesc                     *conn) {
  NaClLog(4,
          "Entered NaClManifestProxyConnectionCtor, self 0x%"NACL_PRIxPTR"\n",
          (uintptr_t) self);
  if (!NaClSimpleServiceConnectionCtor(
          &self->base,
          (struct NaClSimpleService *) server,
          conn,
          (void *) self)) {
    NaClLog(4,
            ("NaClManifestProxyConnectionCtor: base class ctor"
             " NaClSimpleServiceConnectionCtor failed\n"));
    return 0;
  }
  NaClXMutexCtor(&self->mu);
  NaClXCondVarCtor(&self->cv);
  self->channel_initialized = 0;
  NACL_VTBL(NaClRefCount, self) =
      (struct NaClRefCountVtbl *) &kNaClManifestProxyConnectionVtbl;
  return 1;
}
void TestInit(void) {
  NaClXMutexCtor(&gMu);
  NaClXCondVarCtor(&gCv);
}
Exemple #9
0
void NaClGlobalModuleInit(void) {
  NaClXMutexCtor(&nacl_thread_mu);
}
void NaClBootstrapChannelErrorReporterInit(void) {
  NaClXMutexCtor(&g_nacl_bootstrap_mu);
}