sym = symEach(sysSymTbl, (FUNCPTR) &findWellKnownSymbolCB,
(int) &info);
/* If sym is NULL, failed to find symbol -- should not happen. */
if (sym == NULL) {
return CVM_FALSE;
}
if ((!strcmp(name, info->name)) &&
(info->group == group)) {
/* Found the symbol we're looking for. Returning FALSE from
this callback will cause symEach() to return the current
symbol to its caller. */
info->val = (void *) val;
return FALSE;
}
return TRUE;
}
#ifdef CVM_DYNLINKSYM_PREPEND_UNDERSCORE
/*
* %comment: mam051
* It might be nice if we could modify nameArg in place.
*/
char *buf = malloc(strlen(nameArg) + 1 + 1);
if (buf == NULL) {
return NULL;
}
strcpy(buf, "_");
strcat(buf, nameArg);
name = buf;
#endif
assert(handle != NULL);
if (handle->isGlobal) {
/* Look up a well-known CVM symbol and match its group
ID. This protects us whether cvm.o is dynamically loaded,
or statically linked into the kernel. */
if (getWellKnownSymbolGroupId(&info.group) == CVM_FALSE) {
value = NULL;
goto done;
}
} else {
MODULE_ID mid;
MODULE_INFO mInfo;
mid = handle->id;
if (moduleInfoGet(mid, &mInfo) == ERROR) {
value = NULL;
goto done;
}
info.group = (UINT16) mInfo.group;
}
info.name = (char*)name;
sym = symEach(sysSymTbl, (FUNCPTR) &findSymbolCB, (int) &info);
if (sym == NULL) {
value = NULL;
} else {
value = info.val;
}