summaryrefslogtreecommitdiffstats
path: root/lib/libkvm/kvm_file2.c
diff options
context:
space:
mode:
authorguenther <guenther@openbsd.org>2017-01-21 05:42:03 +0000
committerguenther <guenther@openbsd.org>2017-01-21 05:42:03 +0000
commit8fda72b7e051ba1f5fd77ca4e41c7870ed36e4b6 (patch)
tree29b8fd2a73cde1a19923f8bfe3122b9b92c116d2 /lib/libkvm/kvm_file2.c
parentremove some extra whitespace. (diff)
downloadwireguard-openbsd-8fda72b7e051ba1f5fd77ca4e41c7870ed36e4b6.tar.xz
wireguard-openbsd-8fda72b7e051ba1f5fd77ca4e41c7870ed36e4b6.zip
p_comm is the process's command and isn't per thread, so move it from
struct proc to struct process. ok deraadt@ kettenis@
Diffstat (limited to 'lib/libkvm/kvm_file2.c')
-rw-r--r--lib/libkvm/kvm_file2.c17
1 files changed, 2 insertions, 15 deletions
diff --git a/lib/libkvm/kvm_file2.c b/lib/libkvm/kvm_file2.c
index 46aee3da694..183ee4e1666 100644
--- a/lib/libkvm/kvm_file2.c
+++ b/lib/libkvm/kvm_file2.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kvm_file2.c,v 1.51 2016/11/07 00:26:33 guenther Exp $ */
+/* $OpenBSD: kvm_file2.c,v 1.52 2017/01/21 05:42:04 guenther Exp $ */
/*
* Copyright (c) 2009 Todd C. Miller <Todd.Miller@courtesan.com>
@@ -273,7 +273,6 @@ kvm_deadfile_byid(kvm_t *kd, int op, int arg, size_t esize, int *cnt)
struct filedesc0 filed0;
#define filed filed0.fd_fd
struct processlist allprocess;
- struct proc proc;
struct process *pr, process;
struct ucred ucred;
char *filebuf = NULL;
@@ -327,15 +326,6 @@ kvm_deadfile_byid(kvm_t *kd, int op, int arg, size_t esize, int *cnt)
if (process.ps_flags & (PS_SYSTEM | PS_EMBRYO | PS_EXITING))
continue;
- if (process.ps_mainproc == NULL)
- continue;
- /* XXX only needed for p_comm now */
- if (KREAD(kd, (u_long)process.ps_mainproc, &proc)) {
- _kvm_err(kd, kd->program, "can't read proc at %lx",
- (u_long)process.ps_mainproc);
- goto cleanup;
- }
-
if (op == KERN_FILE_BYPID) {
/* check if this is the pid we are looking for */
if (arg > 0 && process.ps_pid != (pid_t)arg)
@@ -348,8 +338,6 @@ kvm_deadfile_byid(kvm_t *kd, int op, int arg, size_t esize, int *cnt)
(u_long)process.ps_ucred);
goto cleanup;
}
- process.ps_mainproc = &proc;
- proc.p_p = &process;
process.ps_ucred = &ucred;
if (op == KERN_FILE_BYUID && arg >= 0 &&
@@ -731,8 +719,7 @@ fill_file(kvm_t *kd, struct kinfo_file *kf, struct file *fp, u_long fpaddr,
kf->p_uid = pr->ps_ucred->cr_uid;
kf->p_gid = pr->ps_ucred->cr_gid;
kf->p_tid = -1;
- strlcpy(kf->p_comm, pr->ps_mainproc->p_comm,
- sizeof(kf->p_comm));
+ strlcpy(kf->p_comm, pr->ps_comm, sizeof(kf->p_comm));
if (pr->ps_fd != NULL)
kf->fd_ofileflags = pr->ps_fd->fd_ofileflags[fd];
}