-.\" $OpenBSD: kdump.1,v 1.38 2023/09/30 13:03:40 naddy Exp $
+.\" $OpenBSD: kdump.1,v 1.39 2023/11/09 15:43:28 kn Exp $
.\"
.\" Copyright (c) 1990, 1993
.\" The Regents of the University of California. All rights reserved.
.\"
.\" from: @(#)kdump.1 8.1 (Berkeley) 6/6/93
.\"
-.Dd $Mdocdate: September 30 2023 $
+.Dd $Mdocdate: November 9 2023 $
.Dt KDUMP 1
.Os
.Sh NAME
.Op Fl dHlnRTXx
.Op Fl f Ar file
.Op Fl m Ar maxdata
+.Op Fl P Ar program
.Op Fl p Ar pid
.Op Fl t Ar trstr
.Op Fl u Ar label
string.
Suppressing this feature yields a more consistent output format and is
easily amenable to further processing.
+.It Fl P Ar program
+Show output only for processes with
+.Ar program
+as their command name.
.It Fl p Ar pid
Show output only for the
.Ar pid
-/* $OpenBSD: kdump.c,v 1.158 2023/08/21 01:37:56 visa Exp $ */
+/* $OpenBSD: kdump.c,v 1.159 2023/11/09 15:43:28 kn Exp $ */
/*-
* Copyright (c) 1988, 1993
char *tracefile = DEF_TRACEFILE;
struct ktr_header ktr_header;
pid_t pid_opt = -1;
+const char *program;
char* utracefilter;
#define eqs(s1, s2) (strcmp((s1), (s2)) == 0)
screenwidth = 80;
}
- while ((ch = getopt(argc, argv, "f:dHlm:np:RTt:u:xX")) != -1)
+ while ((ch = getopt(argc, argv, "f:dHlm:nP:p:RTt:u:xX")) != -1)
switch (ch) {
case 'f':
tracefile = optarg;
case 'n':
fancy = 0;
break;
+ case 'P':
+ program = optarg;
+ break;
case 'p':
pid_opt = strtonum(optarg, 1, INT_MAX, &errstr);
if (errstr)
silent = 0;
if (pid_opt != -1 && pid_opt != ktr_header.ktr_pid)
silent = 1;
+ if (program != NULL &&
+ strcmp(ktr_header.ktr_comm, program) != 0)
+ silent = 1;
if (utracefilter == NULL && silent == 0 &&
trpoints & (1<<ktr_header.ktr_type))
dumpheader(&ktr_header);
extern char *__progname;
fprintf(stderr, "usage: %s "
- "[-dHlnRTXx] [-f file] [-m maxdata] [-p pid] [-t trstr] "
- "[-u label]\n", __progname);
+ "[-dHlnRTXx] [-f file] [-m maxdata] [-P program] [-p pid] "
+ "[-t trstr]\n\t[-u label]\n", __progname);
exit(1);
}