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

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

53 lines
1.9 KiB
Plaintext

$OpenBSD: patch-sysdeps_openbsd_procargs_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 dd46d6a00e4af444d423383abbc538436a170e2b
Author: Jasper Lievisse Adriaanse <jasper@humppa.nl>
Date: Sun Sep 18 13:42:13 2011 +0200
Don't bother with PIDs below 20 as they are highly likely to be kernel threads anyway.
--- sysdeps/openbsd/procargs.c.orig Sun Jul 24 21:13:56 2011
+++ sysdeps/openbsd/procargs.c Mon Jan 9 18:37:24 2012
@@ -49,7 +49,7 @@ char *
glibtop_get_proc_args_p (glibtop *server, glibtop_proc_args *buf,
pid_t pid, unsigned max_len)
{
- struct kinfo_proc2 *pinfo;
+ struct kinfo_proc *pinfo;
char *retval, **args, **ptr;
size_t size = 0, pos = 0;
int count;
@@ -58,13 +58,16 @@ glibtop_get_proc_args_p (glibtop *server, glibtop_proc
memset (buf, 0, sizeof (glibtop_proc_args));
- /* swapper, init, pagedaemon, vmdaemon, update - this doen't work. */
- if (pid < 5) return NULL;
+ /*
+ * Don't bother with PIDs below 20, because everything below this
+ * number is highly likely to be a kernel thread.
+ */
+ if (pid < 19) return NULL;
glibtop_suid_enter (server);
/* Get the process data */
- pinfo = kvm_getproc2 (server->machine.kd, KERN_PROC_PID, pid,
+ pinfo = kvm_getprocs (server->machine.kd, KERN_PROC_PID, pid,
sizeof (*pinfo), &count);
if ((pinfo == NULL) || (count < 1)) {
glibtop_suid_leave (server);
@@ -72,7 +75,7 @@ glibtop_get_proc_args_p (glibtop *server, glibtop_proc
return NULL;
}
- args = kvm_getargv2 (server->machine.kd, pinfo, max_len);
+ args = kvm_getargv (server->machine.kd, pinfo, max_len);
if (args == NULL) {
glibtop_suid_leave (server);
glibtop_warn_io_r (server, "kvm_getargv (%d)", pid);