diff options
Diffstat (limited to 'lib/libkvm')
-rw-r--r-- | lib/libkvm/kvm_file2.c | 21 | ||||
-rw-r--r-- | lib/libkvm/kvm_proc2.c | 6 |
2 files changed, 13 insertions, 14 deletions
diff --git a/lib/libkvm/kvm_file2.c b/lib/libkvm/kvm_file2.c index bd18d4b1a0b..e0538f559c7 100644 --- a/lib/libkvm/kvm_file2.c +++ b/lib/libkvm/kvm_file2.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kvm_file2.c,v 1.33 2014/01/20 21:19:28 guenther Exp $ */ +/* $OpenBSD: kvm_file2.c,v 1.34 2014/02/05 03:49:00 guenther Exp $ */ /* * Copyright (c) 2009 Todd C. Miller <Todd.Miller@courtesan.com> @@ -169,7 +169,7 @@ kvm_getfiles(kvm_t *kd, int op, int arg, size_t esize, int *cnt) return (NULL); } *cnt = size / esize; - return ((struct kinfo_file *)kd->filebase); + return (kd->filebase); } else { if (esize > sizeof(struct kinfo_file)) { _kvm_syserr(kd, kd->program, @@ -253,7 +253,7 @@ kvm_deadfile_byfile(kvm_t *kd, int op, int arg, size_t esize, int *cnt) return (NULL); } *cnt = n; - return ((struct kinfo_file *)kd->filebase); + return (kd->filebase); } static struct kinfo_file * @@ -269,13 +269,12 @@ 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, proc2; + struct proc proc; struct process *pr, process; struct pcred pcred; struct ucred ucred; char *filebuf = NULL; int i, nfiles; - pid_t pid; nl[0].n_name = "_filehead"; nl[1].n_name = "_nfiles"; @@ -391,7 +390,7 @@ kvm_deadfile_byid(kvm_t *kd, int op, int arg, size_t esize, int *cnt) if (buflen < esize) goto done; if (fill_file(kd, &kf, NULL, 0, process.ps_textvp, - &proc, KERN_FILE_TEXT, pid) == -1) + &proc, KERN_FILE_TEXT, proc.p_pid) == -1) goto cleanup; memcpy(where, &kf, esize); where += esize; @@ -402,7 +401,7 @@ kvm_deadfile_byid(kvm_t *kd, int op, int arg, size_t esize, int *cnt) if (buflen < esize) goto done; if (fill_file(kd, &kf, NULL, 0, filed.fd_cdir, &proc, - KERN_FILE_CDIR, pid) == -1) + KERN_FILE_CDIR, proc.p_pid) == -1) goto cleanup; memcpy(where, &kf, esize); where += esize; @@ -413,7 +412,7 @@ kvm_deadfile_byid(kvm_t *kd, int op, int arg, size_t esize, int *cnt) if (buflen < esize) goto done; if (fill_file(kd, &kf, NULL, 0, filed.fd_rdir, &proc, - KERN_FILE_RDIR, pid) == -1) + KERN_FILE_RDIR, proc.p_pid) == -1) goto cleanup; memcpy(where, &kf, esize); where += esize; @@ -424,7 +423,7 @@ kvm_deadfile_byid(kvm_t *kd, int op, int arg, size_t esize, int *cnt) if (buflen < esize) goto done; if (fill_file(kd, &kf, NULL, 0, process.ps_tracevp, - &proc, KERN_FILE_TRACE, pid) == -1) + &proc, KERN_FILE_TRACE, proc.p_pid) == -1) goto cleanup; memcpy(where, &kf, esize); where += esize; @@ -451,7 +450,7 @@ kvm_deadfile_byid(kvm_t *kd, int op, int arg, size_t esize, int *cnt) goto cleanup; } if (fill_file(kd, &kf, &file, (u_long)fp, NULL, - &proc, i, pid) == -1) + &proc, i, proc.p_pid) == -1) goto cleanup; memcpy(where, &kf, esize); where += esize; @@ -462,7 +461,7 @@ kvm_deadfile_byid(kvm_t *kd, int op, int arg, size_t esize, int *cnt) done: *cnt = n; free(filebuf); - return ((struct kinfo_file *)kd->filebase); + return (kd->filebase); cleanup: free(filebuf); return (NULL); diff --git a/lib/libkvm/kvm_proc2.c b/lib/libkvm/kvm_proc2.c index b3c3feb0600..cca8e7b0b0e 100644 --- a/lib/libkvm/kvm_proc2.c +++ b/lib/libkvm/kvm_proc2.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kvm_proc2.c,v 1.18 2014/01/20 21:19:28 guenther Exp $ */ +/* $OpenBSD: kvm_proc2.c,v 1.19 2014/02/05 03:49:00 guenther Exp $ */ /* $NetBSD: kvm_proc.c,v 1.30 1999/03/24 05:50:50 mrg Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -287,8 +287,8 @@ kvm_proclist(kvm_t *kd, int op, int arg, struct process *pr, #define do_copy_str(_d, _s, _l) kvm_read(kd, (u_long)(_s), (_d), (_l)-1) FILL_KPROC(&kp, do_copy_str, &proc, &process, &pcred, - &ucred, &pgrp, p, proc.p_p, &sess, vmp, limp, sap, - 0, 1); + &ucred, &pgrp, process.ps_mainproc, proc.p_p, &sess, + vmp, limp, sap, 0, 1); /* stuff that's too painful to generalize */ kp.p_pid = process_pid; |