STATUS symFindByNameAndTypeEPICS( SYMTAB_ID symTblId, char *name, char **ppvalue, SYM_TYPE *pType, SYM_TYPE sType, SYM_TYPE mask ) { static int leadingUnderscore = 1; static int init = 0; STATUS status = ERROR; if (!init) { char *pSymValue; SYM_TYPE type; status = symFindByName (symTblId, "symFindByNameAndTypeEPICS", &pSymValue, &type ); if (status==OK) { leadingUnderscore = 0; } init = 1; } if (name[0] != '_' || leadingUnderscore) { status = symFindByNameAndType ( symTblId, name, ppvalue, pType, sType, mask ); } else if (leadingUnderscore) { status = symFindByNameAndType ( symTblId, (name+1), ppvalue, pType, sType, mask ); } return status; }
/* * Global initialization of the reclaim data structures, mainly * the max_files variable. This HAS to be called by some task before * the first task that utilizes this exit's, preferrably before any * task makes the first use of this library. */ STATUS reclaim_init(void) { int *mp; SYM_TYPE type; struct task_data *tdp; int i; if (!hook_added) { /* race condition */ ++hook_added; /* Try to find the maxFiles value */ if (symFindByNameAndType(sysSymTbl, MAX_FILES_SYM_NAME, (char **)&mp, &type, N_EXT | N_BSS, N_EXT | N_BSS) == OK || symFindByNameAndType(sysSymTbl, MAX_FILES_SYM_NAME, (char **)&mp, &type, N_EXT | N_DATA, N_EXT | N_DATA) == OK) { #ifdef DEBUG fdprintf(2, "Found maxFiles=%d\n", *mp); #endif if (*mp <= FD_SETSIZE) max_files = *mp; else max_files = FD_SETSIZE; } if (task_data != NULL && task_data->max_files != max_files) { /* fix our own iff we have one */ if ((tdp = (struct task_data *) realloc(task_data, sizeof(struct task_data) + max_files*sizeof(FILE *))) != NULL) { task_data = tdp; for (i = task_data->max_files; i < max_files; i++) task_data->open_fps[i] = NULL; task_data->max_files = max_files; } } /* Make sure taskVariables are deleted AFTER our hook is run. */ taskVarInit(); if(taskDeleteHookAdd((FUNCPTR)save_reclaim) != OK) { fprintf(stderr, "Panic: taskDeleteHook cannot be added for reclaim.\n"); return ERROR; } return OK; } else return ERROR; }
STATUS symFindByNameAndTypeEPICS(SYMTAB_ID symTblId, char *name, char **ppvalue, SYM_TYPE *pType, SYM_TYPE sType, SYM_TYPE mask) { if (name[0] == '_' && symNoUnderscore(symTblId)) name++; return symFindByNameAndType(symTblId, name, ppvalue, pType, sType, mask); }
static FUNCPTR lookup(char *sym) { FUNCPTR entry; SYM_TYPE type; if (symFindByNameAndType(sysSymTbl, sym, (char **)&entry, &type, N_EXT | N_TEXT, N_EXT | N_TEXT) != OK) { return NULL ; } return entry; }