void VerifyReportPromise(struct Promise *pp) { struct Attributes a = {{0}}; struct CfLock thislock; struct Rlist *rp; char unique_name[CF_EXPANDSIZE]; a = GetReportsAttributes(pp); if (strcmp(pp->classes,"any") == 0) { CfOut(cf_verbose,""," --> Reports promises may not be in class \"any\""); return; } snprintf(unique_name,CF_EXPANDSIZE-1,"%s_%d",pp->promiser,pp->lineno); thislock = AcquireLock(unique_name,VUQNAME,CFSTARTTIME,a,pp,false); if (thislock.lock == NULL) { return; } PromiseBanner(pp); cfPS(cf_verbose,CF_CHG,"",pp,a,"Report: %s", pp->promiser); if (a.report.to_file) { CfFOut(a.report.to_file,cf_error,"","%s",pp->promiser); } else { CfOut(cf_reporting,"","R: %s",pp->promiser); } if (a.report.haveprintfile) { PrintFile(a,pp); } if (a.report.showstate) { for (rp = a.report.showstate; rp != NULL; rp=rp->next) { ShowState(rp->item,a,pp); } } if (a.report.havelastseen) { FriendStatus(a,pp); } YieldCurrentLock(thislock); }
void VerifyReportPromise(Promise *pp) { Attributes a = { {0} }; CfLock thislock; Rlist *rp; char unique_name[CF_EXPANDSIZE]; a = GetReportsAttributes(pp); snprintf(unique_name, CF_EXPANDSIZE - 1, "%s_%zu", pp->promiser, pp->offset.line); thislock = AcquireLock(unique_name, VUQNAME, CFSTARTTIME, a, pp, false); if (thislock.lock == NULL) { return; } PromiseBanner(pp); cfPS(cf_verbose, CF_CHG, "", pp, a, "Report: %s", pp->promiser); if (a.report.to_file) { CfFOut(a.report.to_file, cf_error, "", "%s", pp->promiser); } else { CfOut(cf_reporting, "", "R: %s", pp->promiser); } if (a.report.haveprintfile) { PrintFile(a, pp); } if (a.report.showstate) { for (rp = a.report.showstate; rp != NULL; rp = rp->next) { ShowState(rp->item); } } if (a.report.havelastseen) { /* Do nothing. Deprecated. */ } YieldCurrentLock(thislock); }
void VerifyReportPromise(Promise *pp) { Attributes a = { {0} }; CfLock thislock; Rlist *rp; char unique_name[CF_EXPANDSIZE]; a = GetReportsAttributes(pp); snprintf(unique_name, CF_EXPANDSIZE - 1, "%s_%zu", pp->promiser, pp->offset.line); thislock = AcquireLock(unique_name, VUQNAME, CFSTARTTIME, a, pp, false); // Handle return values before locks, as we always do this if (a.report.result) { // User-unwritable value last-result contains the useresult if (strlen(a.report.result) > 0) { snprintf(unique_name, CF_BUFSIZE, "last-result[%s]", a.report.result); } else { snprintf(unique_name, CF_BUFSIZE, "last-result"); } NewScalar(pp->bundle, unique_name, pp->promiser, cf_str); return; } // Now do regular human reports if (thislock.lock == NULL) { return; } PromiseBanner(pp); cfPS(cf_verbose, CF_CHG, "", pp, a, "Report: %s", pp->promiser); if (a.report.to_file) { CfFOut(a.report.to_file, cf_error, "", "%s", pp->promiser); } else { CfOut(cf_reporting, "", "R: %s", pp->promiser); } if (a.report.haveprintfile) { PrintFile(a, pp); } if (a.report.showstate) { for (rp = a.report.showstate; rp != NULL; rp = rp->next) { ShowState(rp->item); } } if (a.report.havelastseen) { /* Do nothing. Deprecated. */ } YieldCurrentLock(thislock); }
void VerifyReportPromise(Promise *pp) { Attributes a = { {0} }; CfLock thislock; char unique_name[CF_EXPANDSIZE]; a = GetReportsAttributes(pp); snprintf(unique_name, CF_EXPANDSIZE - 1, "%s_%zu", pp->promiser, pp->offset.line); thislock = AcquireLock(unique_name, VUQNAME, CFSTARTTIME, a, pp, false); // Handle return values before locks, as we always do this if (a.report.result) { // User-unwritable value last-result contains the useresult if (strlen(a.report.result) > 0) { snprintf(unique_name, CF_BUFSIZE, "last-result[%s]", a.report.result); } else { snprintf(unique_name, CF_BUFSIZE, "last-result"); } NewScalar(pp->bundle, unique_name, pp->promiser, DATA_TYPE_STRING); return; } // Now do regular human reports if (thislock.lock == NULL) { return; } PromiseBanner(pp); cfPS(OUTPUT_LEVEL_VERBOSE, CF_CHG, "", pp, a, "Report: %s", pp->promiser); if (a.report.to_file) { CfFOut(a.report.to_file, OUTPUT_LEVEL_ERROR, "", "%s", pp->promiser); } else { CfOut(OUTPUT_LEVEL_REPORTING, "", "R: %s", pp->promiser); } if (a.report.haveprintfile) { PrintFile(a, pp); } if (a.report.showstate) { /* Do nothing. Deprecated. */ } if (a.report.havelastseen) { /* Do nothing. Deprecated. */ } YieldCurrentLock(thislock); }