/* * Called when the LFS module is activated. * Need to initialize APR ourselves */ int lfs_activate(void) { globus_extension_registry_add( GLOBUS_GFS_DSI_REGISTRY, "lfs", GlobusExtensionMyModule(globus_gridftp_server_lfs), &globus_l_gfs_lfs_dsi_iface); // See if we're configured to write to statsd char * local_host = globus_malloc(256); if (local_host) { memset(local_host, 0, 256); if (gethostname(local_host, 255)) { strcpy(local_host, "UNKNOWN"); } } char statsd_namespace_prefix [] = "lfs.gridftp."; char * statsd_namespace = globus_malloc(strlen(statsd_namespace_prefix)+ strlen(local_host)+1); strcpy(statsd_namespace, statsd_namespace_prefix); char * source = local_host; char * dest; for (dest = statsd_namespace + strlen(statsd_namespace_prefix); *source != '\0'; ++source, ++dest) { if (*source == '.') { *dest = '_'; } else { *dest = *source; } } *dest = '\0'; char * lfs_statsd_link_port = getenv("GRIDFTP_LFS_STATSD_PORT"); char * lfs_statsd_link_host = getenv("GRIDFTP_LFS_STATSD_HOST"); if (lfs_statsd_link_host) { int lfs_statsd_link_port_conv = 8125; if (lfs_statsd_link_port) { lfs_statsd_link_port_conv = atoi(lfs_statsd_link_port); } lfs_statsd_link = statsd_init_with_namespace(lfs_statsd_link_host, lfs_statsd_link_port_conv, statsd_namespace); globus_gfs_log_message(GLOBUS_GFS_LOG_INFO, "Sending log data to statsd %s:%i, namespace %s\n", lfs_statsd_link_host, lfs_statsd_link_port_conv, statsd_namespace); } else { globus_gfs_log_message(GLOBUS_GFS_LOG_INFO, "Not logging to statsd. Set $GRIDFTP_LFS_STATSD_HOST to enable\n"); lfs_statsd_link = NULL; } globus_free(statsd_namespace); globus_gfs_log_message(GLOBUS_GFS_LOG_INFO, "LFS DSI activated.\n"); STATSD_COUNT("activate",1); if (local_host) globus_free(local_host); return 0; }
static int globus_l_net_manager_null_activate(void) { int rc = globus_module_activate(GLOBUS_NET_MANAGER_MODULE); if (rc == 0) { rc = globus_net_manager_register(&globus_l_net_manager_null, GlobusExtensionMyModule(globus_net_manager_null)); } return rc; }
static int osg_activate(void) { GlobusGFSName(osg_activate); globus_result_t result = GLOBUS_SUCCESS; memset(&osg_dsi_iface, '\0', sizeof(globus_gfs_storage_iface_t)); char * dsi_name = getenv("OSG_EXTENSIONS_OVERRIDE_DSI"); dsi_name = dsi_name ? dsi_name : "file"; // Code adapted from globus_i_gfs_data.c in Globus Toolkit. void *new_dsi = (globus_gfs_storage_iface_t *) globus_extension_lookup( &osg_dsi_handle, GLOBUS_GFS_DSI_REGISTRY, dsi_name); if (new_dsi == NULL) { char module_name[1024]; snprintf(module_name, 1024, "globus_gridftp_server_%s", dsi_name); module_name[1023] = '\0'; result = globus_extension_activate(module_name); if (result != GLOBUS_SUCCESS) { result = GlobusGFSErrorWrapFailed("DSI activation", result); return result; } } new_dsi = (globus_gfs_storage_iface_t *) globus_extension_lookup( &osg_dsi_handle, GLOBUS_GFS_DSI_REGISTRY, dsi_name); if(new_dsi == NULL) { GlobusGFSErrorGenericStr(result, ("DSI '%s' is not available in the module.", dsi_name)); return result; } memcpy(&osg_dsi_iface, new_dsi, sizeof(globus_gfs_storage_iface_t)); original_command_function = osg_dsi_iface.command_func; original_init_function = osg_dsi_iface.init_func; osg_dsi_iface.command_func = osg_command; osg_dsi_iface.init_func = osg_extensions_init; globus_extension_registry_add( GLOBUS_GFS_DSI_REGISTRY, "osg", GlobusExtensionMyModule(globus_gridftp_server_osg), &osg_dsi_iface); return result; }
static int globus_l_net_manager_python_activate(void) { Py_Initialize(); globus_mutex_init(&globus_l_python_modules_lock, NULL); globus_hashtable_init( &globus_l_python_modules, 7, globus_hashtable_string_hash, globus_hashtable_string_keyeq); globus_module_activate(GLOBUS_NET_MANAGER_MODULE); return globus_net_manager_register( &globus_l_net_manager_python, GlobusExtensionMyModule(globus_net_manager_python)); }
int activate(void) { int rc = globus_module_activate(GLOBUS_COMMON_MODULE); if(rc != GLOBUS_SUCCESS) return rc; globus_extension_registry_add(GLOBUS_GFS_DSI_REGISTRY, "blackpearl", GlobusExtensionMyModule(globus_gridftp_server_blackpearl), &blackpearl_dsi_iface); GlobusDebugInit(GLOBUS_GRIDFTP_SERVER_BLACKPEARL, ERROR WARNING TRACE INTERNAL_TRACE INFO STATE INFO_VERBOSE); return 0; }
//! [Module Descriptor and Activation] static int globus_l_net_manager_logging_activate(void) { globus_hashtable_init( &globus_l_nm_logging_logfiles, 7, globus_hashtable_string_hash, globus_hashtable_string_keyeq); int rc = globus_module_activate(GLOBUS_NET_MANAGER_MODULE); if (rc == 0) { rc = globus_net_manager_register( &globus_l_net_manager_logging, GlobusExtensionMyModule(globus_net_manager_logging)); } return rc; }