/****** qmaster/sge_thread_scheduler/event_update_func() ************************** * NAME * event_update_func() -- * * SYNOPSIS * void event_update_func(lList **alpp, lList *event_list) * * FUNCTION * * INPUTS * lList **alpp - answer list * lList *event_list - a report list, the event are stored in REP_list * * RESULT * void - none * * NOTES * MT-NOTE: is MT safe. * *******************************************************************************/ void event_update_func(u_long32 ec_id, lList **alpp, lList *event_list) { DENTER(TOP_LAYER, "event_update_func"); sge_mutex_lock("event_control_mutex", SGE_FUNC, __LINE__, &Scheduler_Control.mutex); if (Scheduler_Control.new_events != NULL) { lList *events = NULL; lXchgList(lFirst(event_list), REP_list, &(events)); lAddList(Scheduler_Control.new_events, &events); } else { lXchgList(lFirst(event_list), REP_list, &(Scheduler_Control.new_events)); } Scheduler_Control.triggered = true; DPRINTF(("EVENT UPDATE FUNCTION event_update_func() HAS BEEN TRIGGERED\n")); pthread_cond_signal(&Scheduler_Control.cond_var); sge_mutex_unlock("event_control_mutex", SGE_FUNC, __LINE__, &Scheduler_Control.mutex); DRETURN_VOID; }
/*-------------------------------------------------------------------------*/ static void qmonLoadNamesSC( Widget w, XtPointer cld, XtPointer cad ) { lList *cl = NULL; lList *ehl = NULL; lList *entries = NULL; lListElem *hep = NULL; static lCondition *where = NULL; lList *alp = NULL; DENTER(GUI_LAYER, "qmonLoadNamesSC"); qmonMirrorMultiAnswer(CENTRY_T | EXECHOST_T, &alp); if (alp) { qmonMessageBox(w, alp, 0); lFreeList(&alp); DEXIT; return; } cl = qmonMirrorList(SGE_CE_LIST); ehl = qmonMirrorList(SGE_EH_LIST); for_each (hep, ehl) { lList *temp_entries = NULL; host_complexes2scheduler(&temp_entries, hep, ehl, cl); if (entries == NULL) { entries = temp_entries; } else { lAddList(entries, &temp_entries); } }
/****** sgeobj/var/var_list_copy_prefix_vars_undef() ************************** * NAME * var_list_copy_prefix_vars_undef() -- copy vars with certain prefix * * SYNOPSIS * void * var_list_copy_prefix_vars_undef(lList **varl, * const lList *src_varl, * const char *prefix, * const char *new_prefix) * * FUNCTION * Make a copy of all entries in "src_varl" * beginning with "prefix". "prefix" is replaced by "new_prefix" * for all created elements. The new elements will be added to * "varl" if it is undefined in "varl". * * INPUTS * lList **varl - VA_Type list * const char *prefix - prefix string (e.g. VAR_PREFIX_NR) * const char *new_prefix - new prefix string (e.g. "SGE_") * * EXAMPLE * "__SGE_PREFIX2__TASK_ID" ===> "SGE_TASK_ID * * SEE ALSO * sgeobj/var/var_list_remove_prefix_vars() ******************************************************************************/ void var_list_copy_prefix_vars_undef(lList **varl, const lList *src_varl, const char *prefix, const char *new_prefix) { int prefix_len = strlen(prefix); lListElem *var_elem = NULL; lList *var_list2 = NULL; DENTER(TOP_LAYER, "var_list_copy_prefix_vars"); for_each(var_elem, src_varl) { const char *prefix_name = lGetString(var_elem, VA_variable); if (!strncmp(prefix_name, prefix, prefix_len)) { char name[MAX_STRING_SIZE]; const char *value = lGetString(var_elem, VA_value); const char *name_without_prefix = &prefix_name[prefix_len]; lListElem *existing_variable; sprintf(name, "%s%s", new_prefix, name_without_prefix); existing_variable = lGetElemStr(*varl, VA_variable, name); if (existing_variable == NULL) { var_list_set_string(&var_list2, name, value); } } } if (*varl == NULL) { *varl = lCreateList("", VA_Type); } lAddList(*varl, &var_list2); DEXIT; }
/****** cull/db/lJoinSublist() ************************************************ * NAME * lJoinSublist() -- Join a list with one of its sublists * * SYNOPSIS * lList* lJoinSublist(const char *name, * int nm0, * const lList *lp, * const lCondition *cp0, * const lEnumeration *enp0, * const lDescr *sldp, * const lCondition *cp1, * const lEnumeration *enp1) * * FUNCTION * Joins a list and one of its sublists together. The other * parameters are equal to them from lJoin(). In the enumeration * 'enp0' the sublist field neither may be selected nor 'enp0' * may be NULL. * * INPUTS * const char *name - new list name * int nm0 - * const lList *lp - list * const lCondition *cp0 - selects rows within 'lp' * const lEnumeration *enp0 - selects columns within 'lp' * const lDescr *sldp - sublist descriptor pointer * const lCondition *cp1 - selects rows within 'sldp' * const lEnumeration *enp1 - selects columns within 'enp1' * * RESULT * lList* - Joined list ******************************************************************************/ lList *lJoinSublist(const char *name, int nm0, const lList *lp, const lCondition *cp0, const lEnumeration *enp0, const lDescr *sldp, const lCondition *cp1, const lEnumeration *enp1) { lList *dlp, *tlp, *joinedlist, *sublist; lListElem *ep; lDescr *dp; const lDescr *tdp; int i, pos; DENTER(CULL_LAYER, "lJoinSublist"); /* check different pointers */ if (!name || !lp || !enp0 || !sldp || !enp1) { LERROR(LENULLARGS); DEXIT; return NULL; } /* make sure that nm0 is a sublist field of lp */ if (!(tdp = lGetListDescr(lp))) { LERROR(LEDESCRNULL); DEXIT; return NULL; } if ((pos = lGetPosInDescr(tdp, nm0)) < 0) { LERROR(LENAMENOT); DEXIT; return NULL; } if (mt_get_type(tdp[pos].mt) != lListT) { LERROR(LEINCTYPE); DEXIT; return NULL; } /* is nm0 enumerated in enp0 ? */ if (enp0[0].pos == WHAT_ALL) { LERROR(LEFALSEFIELD); DEXIT; return NULL; } for (i = 0; enp0[i].nm != NoName; i++) if (enp0[i].nm == nm0) { LERROR(LEFALSEFIELD); DEXIT; return NULL; } /* create destination list */ if (!(dp = lJoinDescr(lGetListDescr(lp), sldp, enp0, enp1))) { LERROR(LEJOINDESCR); DEXIT; return NULL; } if (!(dlp = lCreateList(name, dp))) { sge_free(&dp); LERROR(LECREATELIST); DEXIT; return NULL; } /* free dp it has been copied in lCreateList */ sge_free(&dp); /* create a temporary list to be used by lJoin */ if (!(tlp = lCreateList("lJoinSublist: tlp", lGetListDescr(lp)))) { lFreeList(&dlp); LERROR(LECREATELIST); DEXIT; return NULL; } for_each_where(ep, lp, cp0) { /* is there a sublist for the join */ if ((sublist = lGetList(ep, nm0)) != NULL) { /* put each element in the tlp to be used by lJoin */ if (lAppendElem(tlp, lCopyElem(ep)) == -1) { lFreeList(&tlp); lFreeList(&dlp); LERROR(LEAPPENDELEM); DEXIT; return NULL; } /* join the tlp with one element together with its sublist */ joinedlist = lJoin("lJoinSublist: joinedlist", nm0, tlp, NULL, enp0, NoName, sublist, cp1, enp1); if (!joinedlist) { lFreeList(&tlp); lFreeList(&dlp); LERROR(LEJOIN); DEXIT; return NULL; } /* joinedlist is freed in lAddList */ if (joinedlist && lAddList(dlp, &joinedlist) == -1) { LERROR(LEADDLIST); lFreeList(&tlp); lFreeList(&dlp); DEXIT; return NULL; } /* dechain the only element from tlp and free it (copy) */ lRemoveElem(tlp, &(tlp->first)); } } /* temporary list has to be freed */ lFreeList(&tlp); /* RETURN AN EMPTY LIST OR NULL THAT'S THE QUESTION */ if (lGetNumberOfElem(dlp) == 0) { lFreeList(&dlp); } DEXIT; return dlp; }