root/orte/mca/state/base/state_base_frame.c

/* [<][>][^][v][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. orte_state_base_register
  2. orte_state_base_close
  3. orte_state_base_open
  4. orte_state_construct
  5. orte_state_caddy_construct
  6. orte_state_caddy_destruct

   1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
   2 /*
   3  * Copyright (c) 2011-2013 Los Alamos National Security, LLC.
   4  *                         All rights reserved.
   5  * Copyright (c) 2015      Research Organization for Information Science
   6  *                         and Technology (RIST). All rights reserved.
   7  * Copyright (c) 2017      Intel, Inc. All rights reserved.
   8  * $COPYRIGHT$
   9  *
  10  * Additional copyrights may follow
  11  *
  12  * $HEADER$
  13  */
  14 
  15 
  16 #include "orte_config.h"
  17 #include "orte/constants.h"
  18 
  19 #include <string.h>
  20 #ifdef HAVE_UNISTD_H
  21 #include <unistd.h>
  22 #endif
  23 #ifdef HAVE_SYS_TYPES_H
  24 #include <sys/types.h>
  25 #endif
  26 
  27 #include "orte/mca/mca.h"
  28 #include "opal/mca/base/base.h"
  29 
  30 #include "opal/class/opal_list.h"
  31 #include "opal/util/output.h"
  32 
  33 #include "orte/mca/plm/plm_types.h"
  34 #include "orte/runtime/orte_globals.h"
  35 
  36 #include "orte/mca/state/base/base.h"
  37 #include "orte/mca/state/base/state_private.h"
  38 
  39 #include "orte/mca/state/base/static-components.h"
  40 
  41 /*
  42  * Globals
  43  */
  44 orte_state_base_module_t orte_state = {0};
  45 bool orte_state_base_run_fdcheck = false;
  46 
  47 static int orte_state_base_register(mca_base_register_flag_t flags)
  48 {
  49     orte_state_base_run_fdcheck = false;
  50     mca_base_var_register("orte", "state", "base", "check_fds",
  51                           "Daemons should check fds for leaks after each job completes",
  52                           MCA_BASE_VAR_TYPE_BOOL, NULL, 0, 0,
  53                           OPAL_INFO_LVL_9,
  54                           MCA_BASE_VAR_SCOPE_READONLY,
  55                           &orte_state_base_run_fdcheck);
  56 
  57     return ORTE_SUCCESS;
  58 }
  59 
  60 static int orte_state_base_close(void)
  61 {
  62     /* Close selected component */
  63     if (NULL != orte_state.finalize) {
  64         orte_state.finalize();
  65     }
  66 
  67     return mca_base_framework_components_close(&orte_state_base_framework, NULL);
  68 }
  69 
  70 /**
  71  *  * Function for finding and opening either all MCA components, or the one
  72  *   * that was specifically requested via a MCA parameter.
  73  *    */
  74 static int orte_state_base_open(mca_base_open_flag_t flags)
  75 {
  76     /* Open up all available components */
  77     return mca_base_framework_components_open(&orte_state_base_framework, flags);
  78 }
  79 
  80 MCA_BASE_FRAMEWORK_DECLARE(orte, state, "ORTE State Machine",
  81                            orte_state_base_register,
  82                            orte_state_base_open, orte_state_base_close,
  83                            mca_state_base_static_components, 0);
  84 
  85 
  86 static void orte_state_construct(orte_state_t *state)
  87 {
  88     state->job_state = ORTE_JOB_STATE_UNDEF;
  89     state->proc_state = ORTE_PROC_STATE_UNDEF;
  90     state->cbfunc = NULL;
  91     state->priority = ORTE_INFO_PRI;
  92 }
  93 OBJ_CLASS_INSTANCE(orte_state_t,
  94                    opal_list_item_t,
  95                    orte_state_construct,
  96                    NULL);
  97 
  98 static void orte_state_caddy_construct(orte_state_caddy_t *caddy)
  99 {
 100     memset(&caddy->ev, 0, sizeof(opal_event_t));
 101     caddy->jdata = NULL;
 102 }
 103 static void orte_state_caddy_destruct(orte_state_caddy_t *caddy)
 104 {
 105     opal_event_del(&caddy->ev);
 106     if (NULL != caddy->jdata) {
 107         OBJ_RELEASE(caddy->jdata);
 108     }
 109 }
 110 OBJ_CLASS_INSTANCE(orte_state_caddy_t,
 111                    opal_object_t,
 112                    orte_state_caddy_construct,
 113                    orte_state_caddy_destruct);

/* [<][>][^][v][top][bottom][index][help] */