openbsd-ports/devel/libgtop2/patches/patch-sysdeps_openbsd_procmap_c
ajacoutot f5d46be714 Sync patches after upstream commit.
Remove bogus patch (indentical).

no pkg change
2012-01-22 11:55:10 +00:00

54 lines
2.1 KiB
Plaintext

$OpenBSD: patch-sysdeps_openbsd_procmap_c,v 1.6 2012/01/22 11:55:10 ajacoutot Exp $
From b11aa1517e203e36a8901f03ea57c50a25dfbfc7 Mon Sep 17 00:00:00 2001
From: Antoine Jacoutot <ajacoutot@gnome.org>
Date: Sun, 22 Jan 2012 11:47:49 +0000
Subject: OpenBSD: kinfo_proc2 -> kinfo_proc
commit 7bd52fc397be0598638abae2bf71740af505d29c
Author: Jasper Lievisse Adriaanse <jasper@humppa.nl>
Date: Sun Sep 18 13:41:20 2011 +0200
Extend comment a bit regarding processes dying before we get to kvm_getproc2()
--- sysdeps/openbsd/procmap.c.orig Sun Jul 24 21:13:56 2011
+++ sysdeps/openbsd/procmap.c Mon Jan 9 18:37:24 2012
@@ -64,13 +64,17 @@ _glibtop_init_proc_map_p (glibtop *server)
server->sysdeps.proc_map = _glibtop_sysdeps_proc_map;
}
-/* Provides detailed information about a process. */
+/*
+ * Provides detailed information about a process.
+ * Due to the fact we are only requested info about one process, it's possible
+ * the process has been reaped before we get to kvm_getprocs. Tough luck.
+ */
glibtop_map_entry *
glibtop_get_proc_map_p (glibtop *server, glibtop_proc_map *buf,
pid_t pid)
{
- struct kinfo_proc2 *pinfo;
+ struct kinfo_proc *pinfo;
struct vm_map_entry entry, *first;
struct vmspace vmspace;
struct vnode vnode;
@@ -91,7 +95,7 @@ glibtop_get_proc_map_p (glibtop *server, glibtop_proc_
glibtop_suid_enter (server);
/* Get the process data */
- pinfo = kvm_getproc2 (server->machine.kd, KERN_PROC_PID, pid, sizeof(struct kinfo_proc2), &count);
+ pinfo = kvm_getprocs (server->machine.kd, KERN_PROC_PID, pid, sizeof(struct kinfo_proc), &count);
if ((pinfo == NULL) || (count < 1)) {
glibtop_warn_io_r (server, "kvm_getprocs (%d)", pid);
return (glibtop_map_entry*) g_array_free(maps, TRUE);
@@ -124,7 +128,8 @@ glibtop_get_proc_map_p (glibtop *server, glibtop_proc_
/* I tested this a few times with `mmap'; as soon as you write
* to the mmap'ed area, the object type changes from OBJT_VNODE
- * to OBJT_DEFAULT so it seems this really works. */
+ * to OBJT_DEFAULT so it seems this really works.
+ */
do {
glibtop_map_entry *mentry;