proc.c (d0fa49b78d1f40d84ec76c363cdc38cf128511dd) proc.c (406d62731eff92f06723c04de94992d94a293145)
1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE

--- 9 unchanged lines hidden (view full) ---

18 *
19 * CDDL HEADER END
20 */
21/*
22 * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
24 */
25
1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE

--- 9 unchanged lines hidden (view full) ---

18 *
19 * CDDL HEADER END
20 */
21/*
22 * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
24 */
25
26
27/*
28 * Main processor for auditreduce.
29 * Mproc() is the entry point for this module. It is the only visible
30 * function in this module.
31 */
32
33#include <sys/types.h>
34#include <locale.h>

--- 442 unchanged lines hidden (view full) ---

477 (void) fprintf(stderr, "get_recs: %d ret %d recno %d\n",
478 pcb->pcb_procno, ret, pcb->pcb_nrecs + 1);
479#endif
480 /*
481 * See if entire file is after the time window specified.
482 * Must be check here because the start time of the file name
483 * may be after the first record(s).
484 */
26/*
27 * Main processor for auditreduce.
28 * Mproc() is the entry point for this module. It is the only visible
29 * function in this module.
30 */
31
32#include <sys/types.h>
33#include <locale.h>

--- 442 unchanged lines hidden (view full) ---

476 (void) fprintf(stderr, "get_recs: %d ret %d recno %d\n",
477 pcb->pcb_procno, ret, pcb->pcb_nrecs + 1);
478#endif
479 /*
480 * See if entire file is after the time window specified.
481 * Must be check here because the start time of the file name
482 * may be after the first record(s).
483 */
485 if (pcb->pcb_nrecs == 0 && (pcb->pcb_flags & PF_FILE)) {
484 if (pcb->pcb_nrecs == 0 && (pcb->pcb_flags & PF_USEFILE)) {
486 /*
487 * If the first record read failed then use the time
488 * that was in the filename to judge.
489 */
490 if (ret > 0)
491 (pcb->pcb_cur)->fcb_start = secs;
492 if (!f_all && (m_before <= (pcb->pcb_cur)->fcb_start)) {
493 (void) fclose(pcb->pcb_fpr); /* ignore file */

--- 10 unchanged lines hidden (view full) ---

504 }
505 }
506 /* Succesful acquisition of a record. */
507 if (ret > 0) {
508 pcb->pcb_time = secs; /* time of record */
509 pcb->pcb_nrecs++; /* # of read recs from stream */
510 nrecs++; /* # of recs read this call */
511 /* Only check record if at bottom of process tree. */
485 /*
486 * If the first record read failed then use the time
487 * that was in the filename to judge.
488 */
489 if (ret > 0)
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 */

--- 10 unchanged lines hidden (view full) ---

503 }
504 }
505 /* Succesful acquisition of a record. */
506 if (ret > 0) {
507 pcb->pcb_time = secs; /* time of record */
508 pcb->pcb_nrecs++; /* # of read recs from stream */
509 nrecs++; /* # of recs read this call */
510 /* Only check record if at bottom of process tree. */
512 if (pcb->pcb_flags & PF_FILE) {
511 if (pcb->pcb_flags & PF_USEFILE) {
513 check_order(pcb); /* check time sequence */
514 if ((ret2 = check_rec(pcb)) == 0) {
515 pcb->pcb_nprecs++;
516 getrec = FALSE;
517 } else if (ret2 == -2) {
518 /* error */
519 getrec = FALSE; /* get no more recs */
520 alldone = TRUE; /* quit this file */

--- 15 unchanged lines hidden (view full) ---

536 if (alldone == TRUE) {
537#if AUDIT_FILE
538 get_trace(pcb);
539#endif
540 /* Error in record read. Display messages. */
541 if (ret < 0 || ret2 == -2) {
542 pcb->pcb_nrecs++; /* # of read records */
543 if (!f_quiet) {
512 check_order(pcb); /* check time sequence */
513 if ((ret2 = check_rec(pcb)) == 0) {
514 pcb->pcb_nprecs++;
515 getrec = FALSE;
516 } else if (ret2 == -2) {
517 /* error */
518 getrec = FALSE; /* get no more recs */
519 alldone = TRUE; /* quit this file */

--- 15 unchanged lines hidden (view full) ---

535 if (alldone == TRUE) {
536#if AUDIT_FILE
537 get_trace(pcb);
538#endif
539 /* Error in record read. Display messages. */
540 if (ret < 0 || ret2 == -2) {
541 pcb->pcb_nrecs++; /* # of read records */
542 if (!f_quiet) {
544 if (pcb->pcb_flags & PF_FILE) {
543 if (pcb->pcb_flags & PF_USEFILE) {
545 /* Ignore if this is not_terminated. */
546 if (!strstr((pcb->pcb_cur)->fcb_file,
547 "not_terminated")) {
548(void) fprintf(stderr, gettext("%s read error in %s at record %d.\n"), ar,
549 (pcb->pcb_cur)->fcb_file, pcb->pcb_nrecs);
550 }
551 } else {
552(void) fprintf(stderr, gettext("%s read error in pipe at record %d.\n"), ar,
553 pcb->pcb_nrecs);
554 }
555 }
556 } else {
557 /*
558 * Only mark infile for deleting if we have succesfully
559 * processed all of it.
560 */
544 /* Ignore if this is not_terminated. */
545 if (!strstr((pcb->pcb_cur)->fcb_file,
546 "not_terminated")) {
547(void) fprintf(stderr, gettext("%s read error in %s at record %d.\n"), ar,
548 (pcb->pcb_cur)->fcb_file, pcb->pcb_nrecs);
549 }
550 } else {
551(void) fprintf(stderr, gettext("%s read error in pipe at record %d.\n"), ar,
552 pcb->pcb_nrecs);
553 }
554 }
555 } else {
556 /*
557 * Only mark infile for deleting if we have succesfully
558 * processed all of it.
559 */
561 if (pcb->pcb_flags & PF_FILE)
560 if (pcb->pcb_flags & PF_USEFILE)
562 (pcb->pcb_cur)->fcb_flags |= FF_DELETE;
563 }
564 if (fclose(pcb->pcb_fpr) == EOF) {
565 if (!f_quiet) {
561 (pcb->pcb_cur)->fcb_flags |= FF_DELETE;
562 }
563 if (fclose(pcb->pcb_fpr) == EOF) {
564 if (!f_quiet) {
566 if (pcb->pcb_flags & PF_FILE) {
565 if (pcb->pcb_flags & PF_USEFILE) {
567 str = (pcb->pcb_cur)->fcb_file;
568 } else {
569 str = "pipe";
570 }
571 (void) fprintf(stderr,
572 gettext("%s couldn't close %s.\n"),
573 ar, str);
574 }

--- 20 unchanged lines hidden (view full) ---

595 */
596static void
597get_trace(pcb)
598audit_pcb_t *pcb;
599{
600 /*
601 * For file give filename, too.
602 */
566 str = (pcb->pcb_cur)->fcb_file;
567 } else {
568 str = "pipe";
569 }
570 (void) fprintf(stderr,
571 gettext("%s couldn't close %s.\n"),
572 ar, str);
573 }

--- 20 unchanged lines hidden (view full) ---

594 */
595static void
596get_trace(pcb)
597audit_pcb_t *pcb;
598{
599 /*
600 * For file give filename, too.
601 */
603 if (pcb->pcb_flags & PF_FILE) {
602 if (pcb->pcb_flags & PF_USEFILE) {
604 (void) fprintf(stderr, "%s closed %s: %d records read recs: \
605 %d record written.\n", ar, (pcb->pcb_cur)->fcb_file,
606 pcb->pcb_nrecs, pcb->pcb_nprecs);
607 } else {
608 (void) fprintf(stderr, "%s closed pipe: %d records read: \
609 %d records written .\n", ar, pcb->pcb_nrecs,
610 pcb->pcb_nprecs);
611 }

--- 437 unchanged lines hidden ---
603 (void) fprintf(stderr, "%s closed %s: %d records read recs: \
604 %d record written.\n", ar, (pcb->pcb_cur)->fcb_file,
605 pcb->pcb_nrecs, pcb->pcb_nprecs);
606 } else {
607 (void) fprintf(stderr, "%s closed pipe: %d records read: \
608 %d records written .\n", ar, pcb->pcb_nrecs,
609 pcb->pcb_nprecs);
610 }

--- 437 unchanged lines hidden ---