Ejemplo n.º 1
0
lagopus_result_t
lagopus_module_start_all(void) {
  lagopus_result_t ret = LAGOPUS_RESULT_ANY_FAILURES;

  s_lock();
  {
    if (s_n_modules > 0) {
      size_t i;
      a_module *mptr;

      for (ret = LAGOPUS_RESULT_OK, i = 0;
           ret == LAGOPUS_RESULT_OK && i < s_n_modules;
           i++) {
        mptr = &(s_modules[i]);
        ret = s_start_module(mptr);
        if (ret != LAGOPUS_RESULT_OK) {
          lagopus_perror(ret);
          lagopus_msg_error("can't start module \"%s\".\n",
                            mptr->m_name);
        }
      }
    } else {
      ret = LAGOPUS_RESULT_OK;
    }
  }
  s_unlock();

  return ret;
}
Ejemplo n.º 2
0
gallus_result_t
gallus_module_start_all(void) {
  gallus_result_t ret = GALLUS_RESULT_ANY_FAILURES;

  s_lock();
  {

    s_gstate = MODULE_GLOBAL_STATE_STARTING;

    if (s_n_modules > 0) {
      size_t i;
      a_module *mptr;

      for (ret = GALLUS_RESULT_OK, i = 0;
           ret == GALLUS_RESULT_OK && i < s_n_modules;
           i++) {
        mptr = &(s_modules[i]);
        ret = s_start_module(mptr);
        if (ret != GALLUS_RESULT_OK) {
          gallus_perror(ret);
          gallus_msg_error("can't start module \"%s\".\n",
                            mptr->m_name);
        }
      }
    } else {
      ret = GALLUS_RESULT_OK;
    }

    if (ret == GALLUS_RESULT_OK) {
      s_gstate = MODULE_GLOBAL_STATE_STARTED;
    }

  }
  s_unlock();

  return ret;
}