root/opal/mca/event/external/event_external_component.c

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

DEFINITIONS

This source file includes following definitions.
  1. event_external_open
  2. event_external_register

   1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
   2 /*
   3  * Copyright (c) 2011      Cisco Systems, Inc.  All rights reserved.
   4  * Copyright (c) 2013-2015 Los Alamos National Security, LLC. All rights
   5  *                         reserved.
   6  * Copyright (c) 2017      IBM Corporation.  All rights reserved.
   7  *
   8  * Copyright (c) 2017      Intel, Inc. All rights reserved.
   9  * Copyright (c) 2018      Amazon.com, Inc. or its affiliates.  All Rights reserved.
  10  * $COPYRIGHT$
  11  *
  12  * Additional copyrights may follow
  13  *
  14  * $HEADER$
  15  */
  16 
  17 #include "opal_config.h"
  18 #include "opal/constants.h"
  19 
  20 #include "opal/mca/event/event.h"
  21 
  22 #include "event.h"
  23 
  24 #include "opal/util/argv.h"
  25 #include "opal/util/printf.h"
  26 
  27 /*
  28  * Public string showing the sysinfo ompi_linux component version number
  29  */
  30 const char *opal_event_external_component_version_string =
  31     "OPAL event_external event MCA component version " OPAL_VERSION;
  32 
  33 
  34 /*
  35  * Local function
  36  */
  37 static int event_external_open(void);
  38 static int event_external_register (void);
  39 
  40 char *ompi_event_module_include = NULL;
  41 
  42 /*
  43  * Instantiate the public struct with all of our public information
  44  * and pointers to our public functions in it
  45  */
  46 
  47 const opal_event_component_t mca_event_external_component = {
  48 
  49     /* First, the mca_component_t struct containing meta information
  50        about the component itself */
  51 
  52     .base_version = {
  53         OPAL_EVENT_BASE_VERSION_2_0_0,
  54 
  55         /* Component name and version */
  56         .mca_component_name = "external",
  57         MCA_BASE_MAKE_VERSION(component, OPAL_MAJOR_VERSION, OPAL_MINOR_VERSION,
  58                               OPAL_RELEASE_VERSION),
  59 
  60         /* Component open and close functions */
  61         .mca_open_component = event_external_open,
  62         .mca_register_component_params = event_external_register
  63     },
  64     .base_data = {
  65         /* The component is checkpoint ready */
  66         MCA_BASE_METADATA_PARAM_CHECKPOINT
  67     }
  68 };
  69 
  70 static int event_external_open(void)
  71 {
  72     /* Must have some code in this file, or the OS X linker may
  73        eliminate the whole file */
  74     return OPAL_SUCCESS;
  75 }
  76 
  77 static int event_external_register (void) {
  78     const char **all_available_eventops;
  79     char *avail = NULL;
  80     char *help_msg = NULL;
  81     int ret;
  82 
  83     // Get supported methods
  84     all_available_eventops = event_get_supported_methods();
  85 
  86 #ifdef __APPLE__
  87     ompi_event_module_include ="select";
  88 #else
  89     ompi_event_module_include = "poll";
  90 #endif
  91 
  92     avail = opal_argv_join((char**)all_available_eventops, ',');
  93     opal_asprintf( &help_msg,
  94               "Comma-delimited list of libevent subsystems "
  95               "to use (%s -- available on your platform)",
  96               avail );
  97 
  98     ret = mca_base_component_var_register (&mca_event_external_component.base_version,
  99                                            "event_include", help_msg,
 100                                            MCA_BASE_VAR_TYPE_STRING, NULL, 0,
 101                                            MCA_BASE_VAR_FLAG_SETTABLE,
 102                                            OPAL_INFO_LVL_3,
 103                                            MCA_BASE_VAR_SCOPE_LOCAL,
 104                                            &ompi_event_module_include);
 105     free(help_msg);  /* release the help message */
 106     free(avail);
 107     avail = NULL;
 108 
 109     if (0 > ret) {
 110         return ret;
 111     }
 112 
 113     ret = mca_base_var_register_synonym (ret, "opal", "opal", "event", "include", 0);
 114     if (0 > ret) {
 115         return ret;
 116     }
 117 
 118     return OPAL_SUCCESS;
 119 }

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