summaryrefslogtreecommitdiffstats
path: root/usr.bin/kdump
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2003-03-13 18:46:35 +0000
committerjhb <jhb@FreeBSD.org>2003-03-13 18:46:35 +0000
commit709f5b89f7d815fe8631948769d5089cb897f4ce (patch)
tree9375bb4259d2c3cadbe50dcb9538bf277ce1ded7 /usr.bin/kdump
parent6a7b9a7c64485d71b1c633e97be40cecad3210fe (diff)
downloadFreeBSD-src-709f5b89f7d815fe8631948769d5089cb897f4ce.zip
FreeBSD-src-709f5b89f7d815fe8631948769d5089cb897f4ce.tar.gz
Teach kdump(8) to handle events marked with KTR_DROP. If a record has
KTR_DROP set in its header, then we output an extra line to stdout to indicate that events were dropped between the previous record and this record. It is a bit trickier because we need to always notify the user if events are dropped even if KTR_DROP is set on a record of a type that we aren't interested in since kdump(8) doesn't know if the dropped events were of the types that the user has requested. To avoid outputting multiple events dropped notices in between actual event logs, a state variable is set whenever a drop is logged and cleared whenever an actual record is output. Requested by: phk
Diffstat (limited to 'usr.bin/kdump')
-rw-r--r--usr.bin/kdump/kdump.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/usr.bin/kdump/kdump.c b/usr.bin/kdump/kdump.c
index 66a8bbc..089023b 100644
--- a/usr.bin/kdump/kdump.c
+++ b/usr.bin/kdump/kdump.c
@@ -90,6 +90,7 @@ main(int argc, char *argv[])
int ch, ktrlen, size;
void *m;
int trpoints = ALL_POINTS;
+ int drop_logged;
(void) setlocale(LC_CTYPE, "");
@@ -133,7 +134,17 @@ main(int argc, char *argv[])
errx(1, "%s", strerror(ENOMEM));
if (!freopen(tracefile, "r", stdin))
err(1, "%s", tracefile);
+ drop_logged = 0;
while (fread_tail(&ktr_header, sizeof(struct ktr_header), 1)) {
+ if (ktr_header.ktr_type & KTR_DROP) {
+ ktr_header.ktr_type &= ~KTR_DROP;
+ if (!drop_logged) {
+ (void)printf("%6d %-8.*s Events dropped.\n",
+ ktr_header.ktr_pid, MAXCOMLEN,
+ ktr_header.ktr_comm);
+ drop_logged = 1;
+ }
+ }
if (trpoints & (1<<ktr_header.ktr_type))
dumpheader(&ktr_header);
if ((ktrlen = ktr_header.ktr_len) < 0)
@@ -148,6 +159,7 @@ main(int argc, char *argv[])
errx(1, "data too short");
if ((trpoints & (1<<ktr_header.ktr_type)) == 0)
continue;
+ drop_logged = 0;
switch (ktr_header.ktr_type) {
case KTR_SYSCALL:
ktrsyscall((struct ktr_syscall *)m);
OpenPOWER on IntegriCloud