void sptrace_log_free(PsmPartition trace, unsigned long addr, char *fileName, int lineNbr) { PsmAddress elt; TraceItem *item; TraceItem *refitem; if (!trace) return; logEvent(trace, OP_FREE, addr, -1, NULL, fileName, lineNbr, &elt); if (elt) /* Event was logged. */ { item = (TraceItem *) psp(trace, sm_list_data(trace, elt)); /* Find matching allocation, close it out. */ elt = sm_list_prev(trace, elt); while (elt) { refitem = (TraceItem *) psp(trace, sm_list_data(trace, elt)); CHKVOID(refitem); if (refitem->objectAddress != item->objectAddress) { elt = sm_list_prev(trace, elt); continue; } /* Found match. */ switch (refitem->opType) { case OP_MEMO: /* Ignore it. */ elt = sm_list_prev(trace, elt); continue; case OP_FREE: /* Duplicate free. */ return; } /* Found most recent open allocation. */ item->refTaskId = refitem->taskId; item->refFileName = refitem->fileName; item->refLineNbr = refitem->lineNbr; item->refOpNbr = refitem->opNbr; item->objectSize = refitem->objectSize; refitem->refTaskId = item->taskId; refitem->refFileName = item->fileName; refitem->refLineNbr = item->lineNbr; refitem->refOpNbr = item->opNbr; return; } } }
PsmAddress postProbeEvent(IonNode *node, Embargo *embargo) { PsmPartition ionwm = getIonwm(); PsmAddress addr; IonProbe *probe; IonVdb *ionvdb; IonNeighbor *neighbor; PsmAddress nextElt; unsigned int rtlt; /* Round-trip light time. */ int interval = 6; /* Minimum 6-sec interval. */ PsmAddress elt; IonProbe *pr; CHKZERO(node); CHKZERO(embargo); addr = psm_zalloc(ionwm, sizeof(IonProbe)); if (addr == 0) { putErrmsg("Can't create probe event.", NULL); return 0; } probe = (IonProbe *) psp(ionwm, addr); CHKZERO(probe); probe->time = getUTCTime(); probe->destNodeNbr = node->nodeNbr; probe->neighborNodeNbr = embargo->nodeNbr; /* Schedule next probe of this embargoed neighbor for the * time that is the current time plus 2x the round-trip * light time from the local node to the neighbor (but * at least 6 seconds). */ ionvdb = getIonVdb(); neighbor = findNeighbor(ionvdb, embargo->nodeNbr, &nextElt); if (neighbor) { rtlt = (neighbor->owltOutbound + neighbor->owltInbound) << 1; if (rtlt > interval) { interval = rtlt; } } probe->time += interval; for (elt = sm_list_last(ionwm, ionvdb->probes); elt; elt = sm_list_prev(ionwm, elt)) { pr = (IonProbe *) psp(ionwm, sm_list_data(ionwm, elt)); CHKZERO(pr); if (pr->time <= probe->time) { return sm_list_insert_after(ionwm, elt, addr); } } return sm_list_insert_first(ionwm, ionvdb->probes, addr); }
Object sdr_list_prev(Sdr sdrv, Object elt) { //TODO stub //SdrListElt eltBuffer; //CHKZERO(sdrFetchSafe(sdrv)); CHKZERO(elt); //sdrFetch(eltBuffer, (Address) elt); //return eltBuffer.prev; return sm_list_prev(sdrv, elt); }