mirror of
https://git.proxmox.com/git/mirror_corosync
synced 2025-08-14 21:22:36 +00:00
Call initializer directly for broken platforms which don't honor ctors in the shared object on dlopen.
This could probably be more tidy to detect those OS platforms which don't do this instead of hardcoding to a specific platform we intend to port to. git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@2221 fd59a12c-fef9-0310-b244-a6a79926bd2f
This commit is contained in:
parent
6fd822c485
commit
ae5895c3f7
@ -318,8 +318,13 @@ struct lcr_comp aisparser_comp_ver0 = {
|
||||
.ifaces = corosync_aisparser_ver0
|
||||
};
|
||||
|
||||
#ifdef COROSYNC_SOLARIS
|
||||
void corosync_lcr_component_register (void);
|
||||
|
||||
__attribute__ ((constructor)) static void aisparser_comp_register (void) {
|
||||
void corosync_lcr_component_register (void) {
|
||||
#else
|
||||
__attribute__ ((constructor)) static void corosync_lcr_component_register (void) {
|
||||
#endif
|
||||
lcr_interfaces_set (&corosync_aisparser_ver0[0], &aisparser_iface_ver0);
|
||||
lcr_component_register (&aisparser_comp_ver0);
|
||||
}
|
||||
|
@ -1601,9 +1601,13 @@ struct lcr_comp objdb_comp_ver0 = {
|
||||
.ifaces = objdb_iface_ver0
|
||||
};
|
||||
|
||||
#ifdef COROSYNC_SOLARIS
|
||||
void corosync_lcr_component_register (void);
|
||||
|
||||
|
||||
__attribute__ ((constructor)) static void objdb_comp_register (void) {
|
||||
void corosync_lcr_component_register (void) {
|
||||
#else
|
||||
__attribute__ ((constructor)) static void corosync_lcr_component_register (void) {
|
||||
#endif
|
||||
lcr_interfaces_set (&objdb_iface_ver0[0], &objdb_iface);
|
||||
|
||||
lcr_component_register (&objdb_comp_ver0);
|
||||
|
@ -191,7 +191,13 @@ static struct corosync_service_engine_iface_ver0 quorum_service_handler_iface =
|
||||
.corosync_get_service_engine_ver0 = quorum_get_service_handler_ver0
|
||||
};
|
||||
|
||||
__attribute__ ((constructor)) static void quorum_comp_register (void) {
|
||||
#ifdef COROSYNC_SOLARIS
|
||||
void corosync_lcr_component_register (void);
|
||||
|
||||
void corosync_lcr_component_register (void) {
|
||||
#else
|
||||
__attribute__ ((constructor)) static void corosync_lcr_component_register (void) {
|
||||
#endif
|
||||
lcr_component_register (&quorum_comp_ver0);
|
||||
lcr_interfaces_set (&corosync_quorum_ver0[0], &quorum_service_handler_iface);
|
||||
}
|
||||
|
@ -545,6 +545,12 @@ static struct lcr_comp vsf_ykd_comp_ver0 = {
|
||||
.ifaces = corosync_vsf_ykd_ver0
|
||||
};
|
||||
|
||||
__attribute__ ((constructor)) static void vsf_ykd_comp_register (void) {
|
||||
#ifdef COROSYNC_SOLARIS
|
||||
void corosync_lcr_component_register (void);
|
||||
|
||||
void corosync_lcr_component_register (void) {
|
||||
#else
|
||||
__attribute__ ((constructor)) static void corosync_lcr_component_register (void) {
|
||||
#endif
|
||||
lcr_component_register (&vsf_ykd_comp_ver0);
|
||||
}
|
||||
|
@ -99,8 +99,7 @@ static int lcr_select_so (struct dirent *dirent)
|
||||
return (0);
|
||||
}
|
||||
|
||||
#ifndef COROSYNC_SOLARIS
|
||||
#ifdef COROSYNC_LINUX
|
||||
#if defined(COROSYNC_LINUX) || defined(COROSYNC_SOLARIS)
|
||||
static int pathlist_select (const struct dirent *dirent)
|
||||
#else
|
||||
static int pathlist_select (struct dirent *dirent)
|
||||
@ -112,7 +111,6 @@ static int pathlist_select (struct dirent *dirent)
|
||||
|
||||
return (0);
|
||||
}
|
||||
#endif
|
||||
|
||||
static inline struct lcr_component_instance *lcr_comp_find (
|
||||
const char *iface_name,
|
||||
@ -219,7 +217,6 @@ static void ld_library_path_build (void)
|
||||
|
||||
static int ldso_path_build (const char *path, const char *filename)
|
||||
{
|
||||
#ifndef COROSYNC_SOLARIS
|
||||
FILE *fp;
|
||||
char string[1024];
|
||||
char filename_cat[1024];
|
||||
@ -278,7 +275,6 @@ static int ldso_path_build (const char *path, const char *filename)
|
||||
}
|
||||
}
|
||||
fclose(fp);
|
||||
#endif
|
||||
return (0);
|
||||
}
|
||||
|
||||
@ -369,6 +365,7 @@ static int interface_find_and_load (
|
||||
int scandir_entries;
|
||||
unsigned int libs_to_scan;
|
||||
char dl_name[1024];
|
||||
void (*comp_reg)(void);
|
||||
|
||||
scandir_entries = scandir (path, &scandir_list, lcr_select_so, alphasort);
|
||||
if (scandir_entries > 0)
|
||||
@ -387,12 +384,20 @@ static int interface_find_and_load (
|
||||
if (lcr_lib_loaded (dl_name)) {
|
||||
continue;
|
||||
}
|
||||
dl_handle = dlopen (dl_name, RTLD_LAZY);
|
||||
dl_handle = dlopen (dl_name, RTLD_NOW);
|
||||
if (dl_handle == NULL) {
|
||||
fprintf(stderr, "%s: open failed: %s\n",
|
||||
dl_name, dlerror());
|
||||
continue;
|
||||
}
|
||||
/*
|
||||
* constructors don't work in Solaris dlopen, so we have to specifically call
|
||||
* a function to register the component
|
||||
*/
|
||||
#ifdef COROSYNC_SOLARIS
|
||||
comp_reg = dlsym (dl_handle, "corosync_lcr_component_register");
|
||||
comp_reg ();
|
||||
#endif
|
||||
instance = lcr_comp_find (iface_name, version, iface_number);
|
||||
if (instance) {
|
||||
instance->dl_handle = dl_handle;
|
||||
|
@ -314,7 +314,13 @@ static struct corosync_service_engine *cfg_get_service_engine_ver0 (void)
|
||||
return (&cfg_service_engine);
|
||||
}
|
||||
|
||||
__attribute__ ((constructor)) static void register_this_component (void) {
|
||||
#ifdef COROSYNC_SOLARIS
|
||||
void corosync_lcr_component_register (void);
|
||||
|
||||
void corosync_lcr_component_register (void) {
|
||||
#else
|
||||
__attribute__ ((constructor)) static void corosync_lcr_component_register (void) {
|
||||
#endif
|
||||
lcr_interfaces_set (&corosync_cfg_ver0[0], &cfg_service_engine_iface);
|
||||
|
||||
lcr_component_register (&cfg_comp_ver0);
|
||||
|
@ -254,7 +254,13 @@ static struct corosync_service_engine *confdb_get_service_engine_ver0 (void)
|
||||
return (&confdb_service_engine);
|
||||
}
|
||||
|
||||
__attribute__ ((constructor)) static void confdb_comp_register (void) {
|
||||
#ifdef COROSYNC_SOLARIS
|
||||
void corosync_lcr_component_register (void);
|
||||
|
||||
void corosync_lcr_component_register (void) {
|
||||
#else
|
||||
__attribute__ ((constructor)) static void corosync_lcr_component_register (void) {
|
||||
#endif
|
||||
lcr_interfaces_set (&corosync_confdb_ver0[0], &confdb_service_engine_iface);
|
||||
|
||||
lcr_component_register (&confdb_comp_ver0);
|
||||
|
@ -316,7 +316,13 @@ static struct corosync_service_engine *cpg_get_service_engine_ver0 (void)
|
||||
return (&cpg_service_engine);
|
||||
}
|
||||
|
||||
__attribute__ ((constructor)) static void cpg_comp_register (void) {
|
||||
#ifdef COROSYNC_SOLARIS
|
||||
void corosync_lcr_component_register (void);
|
||||
|
||||
void corosync_lcr_component_register (void) {
|
||||
#else
|
||||
__attribute__ ((constructor)) static void corosync_lcr_component_register (void) {
|
||||
#endif
|
||||
lcr_interfaces_set (&corosync_cpg_ver0[0], &cpg_service_engine_iface);
|
||||
|
||||
lcr_component_register (&cpg_comp_ver0);
|
||||
|
@ -188,7 +188,13 @@ static struct corosync_service_engine *evs_get_service_engine_ver0 (void)
|
||||
return (&evs_service_engine);
|
||||
}
|
||||
|
||||
__attribute__ ((constructor)) static void evs_comp_register (void) {
|
||||
#ifdef COROSYNC_SOLARIS
|
||||
void corosync_lcr_component_register (void);
|
||||
|
||||
void corosync_lcr_component_register (void) {
|
||||
#else
|
||||
__attribute__ ((constructor)) static void corosync_lcr_component_register (void) {
|
||||
#endif
|
||||
lcr_interfaces_set (&corosync_evs_ver0[0], &evs_service_engine_iface);
|
||||
|
||||
lcr_component_register (&evs_comp_ver0);
|
||||
|
@ -198,7 +198,13 @@ static struct corosync_service_engine *pload_get_service_engine_ver0 (void)
|
||||
return (&pload_service_engine);
|
||||
}
|
||||
|
||||
__attribute__ ((constructor)) static void pload_comp_register (void) {
|
||||
#ifdef COROSYNC_SOLARIS
|
||||
void corosync_lcr_component_register (void);
|
||||
|
||||
void corosync_lcr_component_register (void) {
|
||||
#else
|
||||
__attribute__ ((constructor)) static void corosync_lcr_component_register (void) {
|
||||
#endif
|
||||
lcr_interfaces_set (&corosync_pload_ver0[0], &pload_service_engine_iface);
|
||||
|
||||
lcr_component_register (&pload_comp_ver0);
|
||||
|
@ -95,7 +95,13 @@ static struct lcr_comp test_quorum_comp_ver0 = {
|
||||
.ifaces = corosync_test_quorum_ver0
|
||||
};
|
||||
|
||||
__attribute__ ((constructor)) static void test_quorum_comp_register (void) {
|
||||
#ifdef COROSYNC_SOLARIS
|
||||
void corosync_lcr_component_register (void);
|
||||
|
||||
void corosync_lcr_component_register (void) {
|
||||
#else
|
||||
__attribute__ ((constructor)) static void corosync_lcr_component_register (void) {
|
||||
#endif
|
||||
lcr_interfaces_set (&corosync_test_quorum_ver0[0], &test_quorum_iface_ver0);
|
||||
lcr_component_register (&test_quorum_comp_ver0);
|
||||
}
|
||||
|
@ -363,7 +363,13 @@ static struct corosync_service_engine *quorum_get_service_handler_ver0 (void)
|
||||
return (&quorum_service_handler);
|
||||
}
|
||||
|
||||
__attribute__ ((constructor)) static void quorum_comp_register (void) {
|
||||
#ifdef COROSYNC_SOLARIS
|
||||
void corosync_lcr_component_register (void);
|
||||
|
||||
void corosync_lcr_component_register (void) {
|
||||
#else
|
||||
__attribute__ ((constructor)) static void corosync_lcr_component_register (void) {
|
||||
#endif
|
||||
lcr_interfaces_set (&corosync_quorum_ver0[0], &votequorum_iface_ver0);
|
||||
lcr_interfaces_set (&corosync_quorum_ver0[1], &quorum_service_handler_iface);
|
||||
lcr_component_register (&quorum_comp_ver0);
|
||||
|
Loading…
Reference in New Issue
Block a user