use env for dl_debug
This commit is contained in:
parent
cca0fde837
commit
fb7a499219
|
@ -130,12 +130,16 @@ int vmcontrol_wrapper_api_init(const char *lib)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
char *api;
|
char *api;
|
||||||
|
int dl_debug = getenv("VMCONTROL_DEBUG") != NULL;
|
||||||
|
|
||||||
if (vmcontrol_api) {
|
if (vmcontrol_api) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!lib) { /* sanity check */
|
if (!lib) { /* sanity check */
|
||||||
|
if (dl_debug) {
|
||||||
|
fprintf(stderr, "[vmcontrol_init] lib==NULL\n");
|
||||||
|
}
|
||||||
return DL_ENOENT;
|
return DL_ENOENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -160,25 +164,27 @@ int vmcontrol_wrapper_api_init(const char *lib)
|
||||||
(any_function_t)DL_SYM(vmcontrol_api->handle,
|
(any_function_t)DL_SYM(vmcontrol_api->handle,
|
||||||
vmcontrol_entries[i].alias);
|
vmcontrol_entries[i].alias);
|
||||||
|
|
||||||
#ifdef DL_DEBUG
|
if (dl_debug) {
|
||||||
printf("%s -> %s\n",
|
fprintf(stderr, "[vmcontrol_init] alias %s -> %s\n",
|
||||||
vmcontrol_entries[i].name,
|
vmcontrol_entries[i].name,
|
||||||
vmcontrol_entries[i].alias);
|
vmcontrol_entries[i].alias);
|
||||||
#endif
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!*ptr) {
|
if (!*ptr) {
|
||||||
#ifdef DL_DEBUG
|
if (dl_debug) {
|
||||||
printf("%s -> UNDEFINED\n", vmcontrol_entries[i].name);
|
fprintf(stderr, "[vmcontrol_init] %s -> UNDEFINED\n",
|
||||||
#endif
|
vmcontrol_entries[i].name);
|
||||||
|
}
|
||||||
*ptr = (any_function_t)unsupported_function;
|
*ptr = (any_function_t)unsupported_function;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((void *)vmcontrol_api->xVMControl_VMInit == (void *)&unsupported_function) {
|
if ((void *)vmcontrol_api->xVMControl_VMInit == (void *)&unsupported_function) {
|
||||||
#ifdef DL_DEBUG
|
if (dl_debug) {
|
||||||
printf("%s unuseable\n", lib);
|
fprintf(stderr, "[vmcontrol_init] %s unuseable\n", lib);
|
||||||
#endif
|
}
|
||||||
|
|
||||||
vmcontrol_wrapper_api_shutdown();
|
vmcontrol_wrapper_api_shutdown();
|
||||||
return DL_ENOENT;
|
return DL_ENOENT;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue