PERFORCE change 153241 for review

Christian S.J. Peron csjp at FreeBSD.org
Wed Nov 19 13:20:33 PST 2008


http://perforce.freebsd.org/chv.cgi?CH=153241

Change 153241 by csjp at hvm02 on 2008/11/19 21:19:33

	- Fix a stack overflow which was the result of the drop/read counters being
	  switched to 64 bits.
	- Don't bother trying to process the ap_truncates counter since this counter
	  is no longer supported.

Affected files ...

.. //depot/projects/trustedbsd/bsmtrace/pipe.c#2 edit
.. //depot/projects/trustedbsd/bsmtrace/pipe.h#2 edit

Differences ...

==== //depot/projects/trustedbsd/bsmtrace/pipe.c#2 (text+ko) ====

@@ -32,7 +32,6 @@
 #ifdef AUDITPIPE_GET_DROPS
 
 static int	ap_cur_drop_cnt;
-static int	ap_cur_trunc_cnt;
 
 void
 pipe_analyze_loss(int pipefd)
@@ -42,16 +41,6 @@
 
 	pipe_get_stats(pipefd, &aps);
 	/*
-	 * We dont currently handle truncated records, but we should at
-	 * least be logging the fact that it happens.
-	 */
-	if (aps.ap_truncates > ap_cur_trunc_cnt) {
-		bsmtrace_error(0, "audit pipe truncated %d records"
-		    " (%d) since last interval", aps.ap_truncates,
-		    aps.ap_truncates - ap_cur_trunc_cnt);
-		ap_cur_trunc_cnt = aps.ap_truncates;
-	}
-	/*
 	 * If there has been no change in the drop count since the last time
 	 * we collected the statistics, return because there is nothing to
 	 * worry about.
@@ -95,9 +84,6 @@
 	if (ioctl(pipefd, AUDITPIPE_GET_DROPS, &aps->ap_drops) < 0)
 		bsmtrace_error(1, "AUDITPIPE_GET_DROPS: %s",
 		    strerror(errno));
-	if (ioctl(pipefd, AUDITPIPE_GET_TRUNCATES, &aps->ap_truncates) < 0)
-		bsmtrace_error(1, "AUDITPIPE_GET_TRUNCATES: %s",
-		    strerror(errno));
 }
 
 void
@@ -110,13 +96,12 @@
 	/* XXX should be calling bsmtrace_error(0, ...) here? */
 	if (opts.Fflag)
 		(void) fprintf(stderr,
-		    "audit record drops %u\n"
-		    "audit record reads %u\n"
-		    "audit record truncates %u\n",
-		    aps.ap_drops, aps.ap_reads, aps.ap_truncates);
+		    "audit record drops %ju\n"
+		    "audit record reads %ju\n",
+		    aps.ap_drops, aps.ap_reads);
 	else
 		syslog(LOG_AUTH | LOG_INFO,
-		    "audit record drops=%u reads=%u truncates=%u",
-		    aps.ap_drops, aps.ap_reads, aps.ap_truncates);
+		    "audit record drops=%ju reads=%ju",
+		    aps.ap_drops, aps.ap_reads);
 }
 #endif	/* AUDITPIPE_GET_DROPS */

==== //depot/projects/trustedbsd/bsmtrace/pipe.h#2 (text+ko) ====

@@ -31,9 +31,8 @@
 #define PIPE_DOT_H_
 
 struct pipe_stats {
-	unsigned int		ap_reads;
-	unsigned int		ap_drops;
-	unsigned int		ap_truncates;
+	u_int64_t		ap_reads;
+	u_int64_t		ap_drops;
 };
 
 void	pipe_analyze_loss(int);


More information about the p4-projects mailing list