summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormillert <millert@openbsd.org>2009-07-21 14:37:00 +0000
committermillert <millert@openbsd.org>2009-07-21 14:37:00 +0000
commitd360b1b6dd095c9cdc73b69c89625ee7c06321c4 (patch)
tree79d1486b154657a0191a42b785fd19b0851d643e
parentHandle the case where so_pcb is NULL. (diff)
downloadwireguard-openbsd-d360b1b6dd095c9cdc73b69c89625ee7c06321c4.tar.xz
wireguard-openbsd-d360b1b6dd095c9cdc73b69c89625ee7c06321c4.zip
Support KERN_FILE_TEXT here too
-rw-r--r--lib/libkvm/kvm_file2.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/lib/libkvm/kvm_file2.c b/lib/libkvm/kvm_file2.c
index 4eafc0aa4fc..20a6ceb7b34 100644
--- a/lib/libkvm/kvm_file2.c
+++ b/lib/libkvm/kvm_file2.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kvm_file2.c,v 1.11 2009/07/21 14:10:15 millert Exp $ */
+/* $OpenBSD: kvm_file2.c,v 1.12 2009/07/21 14:37:00 millert Exp $ */
/*
* Copyright (c) 2009 Todd C. Miller <Todd.Miller@courtesan.com>
@@ -46,7 +46,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char *rcsid = "$OpenBSD: kvm_file2.c,v 1.11 2009/07/21 14:10:15 millert Exp $";
+static char *rcsid = "$OpenBSD: kvm_file2.c,v 1.12 2009/07/21 14:37:00 millert Exp $";
#endif /* LIBC_SCCS and not lint */
/*
@@ -356,6 +356,17 @@ kvm_deadfile2_byid(kvm_t *kd, int op, int arg, size_t esize, int *cnt)
}
proc.p_fd = &filed;
+ if (proc.p_textvp) {
+ if (buflen < sizeof(struct kinfo_file2))
+ goto done;
+ kf = (struct kinfo_file2 *)where;
+ where += sizeof(struct kinfo_file2);
+ buflen -= sizeof(struct kinfo_file2);
+ n++;
+ if (fill_file2(kd, kf, NULL, proc.p_textvp, &proc,
+ KERN_FILE_TEXT) == -1)
+ return (NULL);
+ }
if (filed.fd_cdir) {
if (buflen < sizeof(struct kinfo_file2))
goto done;