pkgsrc/sysutils/libgtop/patches/patch-cd
drochner 4d7f1acf90 update to 2.20.0
This switches to the new gnome-2.20 branch.

pkgsrc notes:
-System dependant parts were reorganized upstream, in particular there
 if a subtree for FreeBSD now, and one for the other BSDs. I didn't
 pull in the DragonFly patches because I can't decide whether to base
 them on the freebsd or the rest.
-I've changed the NetBSD code to use kinfo_proc2 almost completely.
 Some vm statistics reporting might be less accurate now because
 some fields in proc2 seem to be unmaintained by the current kernel
 (eg ixrss).
-Also, some libgtop functions might be able to run in the non-privileged
 part now, but dealing with this would require even more #ifdefs, so
 we should consider setting up a private subtree as FreeBSD did.
-I didn't verify with older NetBSDs; kvm_getproc2() has been in the
 tree for quite some time so I hope it will just work without the need
 for excessive "#if __NetBSD_Version__ > t".
2007-11-05 19:06:02 +00:00

55 lines
1.6 KiB
Text

$NetBSD: patch-cd,v 1.1 2007/11/05 19:06:06 drochner Exp $
--- sysdeps/bsd/procargs.c.orig 2007-04-27 00:27:34.000000000 +0200
+++ sysdeps/bsd/procargs.c
@@ -47,12 +47,16 @@ char *
glibtop_get_proc_args_p (glibtop *server, glibtop_proc_args *buf,
pid_t pid, unsigned max_len)
{
+#if defined(__NetBSD__)
+ struct kinfo_proc2 *pinfo;
+#else
struct kinfo_proc *pinfo;
+#endif
char *retval, **args, **ptr;
size_t size = 0, pos = 0;
int count;
-#ifndef __bsdi__
+#if !defined(__bsdi__) && !defined(__NetBSD)
char filename [BUFSIZ];
struct stat statb;
#endif
@@ -64,7 +68,7 @@ glibtop_get_proc_args_p (glibtop *server
/* swapper, init, pagedaemon, vmdaemon, update - this doen't work. */
if (pid < 5) return NULL;
-#ifndef __bsdi__
+#if !defined(__bsdi__) && !defined(__NetBSD__)
sprintf (filename, "/proc/%d/mem", pid);
if (stat (filename, &statb)) return NULL;
#endif
@@ -72,14 +76,23 @@ glibtop_get_proc_args_p (glibtop *server
glibtop_suid_enter (server);
/* Get the process data */
+#if defined(__NetBSD__)
+ pinfo = kvm_getproc2 (server->machine.kd, KERN_PROC_PID, pid,
+ sizeof (*pinfo), &count);
+#else
pinfo = kvm_getprocs (server->machine.kd, KERN_PROC_PID, pid, &count);
+#endif
if ((pinfo == NULL) || (count < 1)) {
glibtop_suid_leave (server);
glibtop_warn_io_r (server, "kvm_getprocs (%d)", pid);
return NULL;
}
+#if defined(__NetBSD__)
+ args = kvm_getargv2 (server->machine.kd, pinfo, max_len);
+#else
args = kvm_getargv (server->machine.kd, pinfo, max_len);
+#endif
if (args == NULL) {
glibtop_suid_leave (server);
glibtop_warn_io_r (server, "kvm_getargv (%d)", pid);