Lines Matching defs:pcb
68 * First one record is retreived from each pcb. As they are retreived
74 * .arg pcbr - ptr to pcb for this process.
85 register audit_pcb_t *pcb;
98 pcb = &(pcbr->pcb_below[i]); /* get next PCB */
99 while (pcb->pcb_time < 0) { /* while no active record ... */
100 if ((ret = get_file(pcb)) == -1)
104 if (get_recs(pcb, &nrecs) == 0)
105 asort(pcb); /* got a rec - put in list */
111 while ((pcb = aget()) != NULL) { /* get oldest record */
112 if (write_recs(pcbr, pcb, &nprecs))
114 while (pcb->pcb_time < 0) { /* while we don't have a rec */
115 if (pcb->pcb_fpr == NULL) { /* no active file ... */
116 if ((ret = get_file(pcb)) == -1)
117 break; /* no files - finished pcb */
121 if (get_recs(pcb, &nrecs) == 0)
122 asort(pcb); /* put record in list */
135 pcb = &(pcbr->pcb_below[0]); /* any old PCB will do */
136 pcb->pcb_rec = empty_file_token;
137 if (write_recs(pcbr, pcb, &junk))
164 * .desc Place a pcb in the list sorted by time - oldest first.
165 * .call asort(pcb);
166 * .arg pcb - ptr to pcb to install in list.
170 asort(pcb)
171 register audit_pcb_t *pcb;
176 pcb->pcb_next = NULL;
178 pcbls = pcb; /* empty list */
181 pcbc = pcbls; /* current pcb */
182 pcbp = pcbls; /* previous pcb */
184 if (pcb->pcb_time < pcbc->pcb_time) {
186 pcb->pcb_next = pcbls; /* new -> 1st in list */
187 pcbls = pcb;
190 pcbp->pcb_next = pcb;
191 pcb->pcb_next = pcbc; /* new in the inside */
197 pcbp->pcb_next = pcb; /* new -> last */
203 * .desc Get the first pcb from the list. Pcb is removed from list, too.
204 * .call pcb = aget().
206 * .ret pcb - ptr to pcb that was the first.
224 * .desc Get the next file from the pcb's list. Check the header to see
229 * .call ret = get_file(pcb).
230 * .arg pcb - pcb holding the fcb's (files).
232 * .ret -1 - no more files - pcb finished.
236 get_file(pcb)
237 register audit_pcb_t *pcb;
245 while (pcb->pcb_fpr == NULL) {
246 if ((fcb = pcb->pcb_first) == NULL) {
247 pcb->pcb_time = -1;
248 return (-1); /* pcb is all done */
269 pcb->pcb_first = fcb->fcb_next;
294 pcb->pcb_first = fcb->fcb_next;
299 * Initalize pcb for processing.
301 pcb->pcb_first = fcb->fcb_next;
302 pcb->pcb_cur = fcb;
303 pcb->pcb_fpr = fp;
304 pcb->pcb_nrecs = 0;
305 pcb->pcb_nprecs = 0;
306 pcb->pcb_otime = -1;
317 * .call ret = write_recs(pcbr, pcb, nprecs).
318 * .arg pcbr - ptr to node pcb.
319 * .arg pcb - ptr to pcb holding the stream.
325 write_recs(pcbr, pcb, nprecs)
326 register audit_pcb_t *pcbr, *pcb;
333 adrm_start(&adr, pcb->pcb_rec);
344 f_start = pcb->pcb_time; /* save start time */
349 f_end = pcb->pcb_time; /* find last record's time */
350 pcb->pcb_time = -1; /* disable just written rec */
352 if ((fwrite(pcb->pcb_rec, sizeof (char), size, pcbr->pcb_fpw)) !=
364 free(pcb->pcb_rec);
372 * .call ret = get_recs(pcb, nr).
373 * .arg pcb - ptr to pcb that holds this stream.
379 get_recs(pcb, nr)
380 register audit_pcb_t *pcb;
398 ret = get_record(pcb->pcb_fpr, &pcb->pcb_rec,
399 pcb->pcb_cur->fcb_name);
401 adrm_start(&adr, pcb->pcb_rec);
477 pcb->pcb_procno, ret, pcb->pcb_nrecs + 1);
484 if (pcb->pcb_nrecs == 0 && (pcb->pcb_flags & PF_USEFILE)) {
490 (pcb->pcb_cur)->fcb_start = secs;
491 if (!f_all && (m_before <= (pcb->pcb_cur)->fcb_start)) {
492 (void) fclose(pcb->pcb_fpr); /* ignore file */
493 pcb->pcb_fpr = NULL;
494 pcb->pcb_time = -1;
501 ar, (pcb->pcb_cur)->fcb_file);
507 pcb->pcb_time = secs; /* time of record */
508 pcb->pcb_nrecs++; /* # of read recs from stream */
511 if (pcb->pcb_flags & PF_USEFILE) {
512 check_order(pcb); /* check time sequence */
513 if ((ret2 = check_rec(pcb)) == 0) {
514 pcb->pcb_nprecs++;
520 free(pcb->pcb_rec);
523 free(pcb->pcb_rec);
526 pcb->pcb_nprecs++;
537 get_trace(pcb);
541 pcb->pcb_nrecs++; /* # of read records */
543 if (pcb->pcb_flags & PF_USEFILE) {
545 if (!strstr((pcb->pcb_cur)->fcb_file,
548 (pcb->pcb_cur)->fcb_file, pcb->pcb_nrecs);
552 pcb->pcb_nrecs);
560 if (pcb->pcb_flags & PF_USEFILE)
561 (pcb->pcb_cur)->fcb_flags |= FF_DELETE;
563 if (fclose(pcb->pcb_fpr) == EOF) {
565 if (pcb->pcb_flags & PF_USEFILE) {
566 str = (pcb->pcb_cur)->fcb_file;
575 pcb->pcb_fpr = NULL;
576 pcb->pcb_time = -1;
591 * .call get_trace(pcb).
592 * .arg pcb - ptr to pcb holding file/pipe.
596 get_trace(pcb)
597 audit_pcb_t *pcb;
602 if (pcb->pcb_flags & PF_USEFILE) {
604 %d record written.\n", ar, (pcb->pcb_cur)->fcb_file,
605 pcb->pcb_nrecs, pcb->pcb_nprecs);
608 %d records written .\n", ar, pcb->pcb_nrecs,
609 pcb->pcb_nprecs);
618 * .call ret = check_rec(pcb).
619 * .arg pcb - ptr to pcb holding the record.
625 check_rec(pcb)
626 register audit_pcb_t *pcb;
637 adrm_start(&adr, pcb->pcb_rec);
658 pcb->pcb_procno, pcb->pcb_nrecs, tokenid);
771 pcb->pcb_otime = pcb->pcb_time;
801 "file %s\n"), tokenid, (pcb->pcb_cur)->fcb_file);
820 * .call check_order(pcb).
821 * .arg pcb - ptr to audit_pcb_t.
828 * .call check_order(pcb).
829 * .arg pcb - ptr to pcb holding the records.
833 check_order(pcb)
834 register audit_pcb_t *pcb;
841 if (pcb->pcb_otime > pcb->pcb_time) {
844 (void *)ctime(&pcb->pcb_otime), 26);
847 (void *)ctime(&pcb->pcb_time), 26);
851 ar, (pcb->pcb_cur)->fcb_file, cptr1, cptr2);