pkgsrc/sysutils/libgtop/patches/patch-am
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

103 lines
3.2 KiB
Text

$NetBSD: patch-am,v 1.5 2007/11/05 19:06:05 drochner Exp $
--- sysdeps/bsd/procsignal.c.orig 2007-04-27 00:27:34.000000000 +0200
+++ sysdeps/bsd/procsignal.c
@@ -51,7 +51,11 @@ glibtop_get_proc_signal_p (glibtop *serv
glibtop_proc_signal *buf,
pid_t pid)
{
+#if defined(__NetBSD__)
+ struct kinfo_proc2 *pinfo;
+#else
struct kinfo_proc *pinfo;
+#endif
int count = 0;
glibtop_init_p (server, (1L << GLIBTOP_SYSDEPS_PROC_SIGNAL), 0);
@@ -62,7 +66,12 @@ glibtop_get_proc_signal_p (glibtop *serv
if (pid == 0) return;
/* Get the process information */
+#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_warn_io_r (server, "kvm_getprocs (%d)", pid);
return;
@@ -75,6 +84,10 @@ glibtop_get_proc_signal_p (glibtop *serv
#define PROC_SIGIGNORE ki_sigignore
#define PROC_SIGCATCH ki_sigcatch
+#elif defined(__NetBSD__)
+
+/* nothing for now */
+
#else
#define PROC_SIGLIST kp_proc.p_siglist
@@ -87,6 +100,9 @@ glibtop_get_proc_signal_p (glibtop *serv
/* signal: mask of pending signals.
* pinfo [0].kp_proc.p_siglist
*/
+#if defined(__NetBSD__)
+ buf->signal[0] = pinfo[0].p_siglist.__bits[0];
+#else
#if defined(__NetBSD__) && (__NetBSD_Version__ >= 105150000)
buf->signal [0] = pinfo [0].kp_proc.p_sigctx.ps_siglist.__bits[0];
#elif (defined(__NetBSD__) && (NSIG > 32)) || \
@@ -95,10 +111,14 @@ glibtop_get_proc_signal_p (glibtop *serv
#else
buf->signal [0] = pinfo [0].kp_proc.p_siglist;
#endif
+#endif /* NetBSD */
/* blocked: mask of blocked signals.
* pinfo [0].kp_proc.p_sigmask
*/
+#if defined(__NetBSD__)
+ buf->blocked[0] = pinfo[0].p_sigmask.__bits[0];
+#else
#if defined(__NetBSD__) && (__NetBSD_Version__ >= 105150000)
buf->blocked [0] = pinfo [0].kp_proc.p_sigctx.ps_sigmask.__bits[0];
#elif (defined(__NetBSD__) && (NSIG > 32)) || \
@@ -107,10 +127,14 @@ glibtop_get_proc_signal_p (glibtop *serv
#else
buf->blocked [0] = pinfo [0].kp_proc.p_sigmask;
#endif
+#endif /* NetBSD */
/* sigignore: mask of ignored signals.
* pinfo [0].kp_proc.p_sigignore
*/
+#if defined(__NetBSD__)
+ buf->sigignore[0] = pinfo[0].p_sigignore.__bits[0];
+#else
#if defined(__NetBSD__) && (__NetBSD_Version__ >= 105150000)
buf->sigignore [0] = pinfo [0].kp_proc.p_sigctx.ps_sigignore.__bits[0];
#elif (defined(__NetBSD__) && (NSIG > 32)) || \
@@ -119,10 +143,14 @@ glibtop_get_proc_signal_p (glibtop *serv
#else
buf->sigignore [0] = pinfo [0].kp_proc.p_sigignore;
#endif
+#endif /* NetBSD */
/* sigcatch: mask of caught signals.
* pinfo [0].kp_proc.p_sigcatch
*/
+#if defined(__NetBSD__)
+ buf->sigcatch[0] = pinfo[0].p_sigcatch.__bits[0];
+#else
#if defined(__NetBSD__) && (__NetBSD_Version__ >= 105150000)
buf->sigcatch [0] = pinfo [0].kp_proc.p_sigctx.ps_sigcatch.__bits[0];
#elif (defined(__NetBSD__) && (NSIG > 32)) || \
@@ -131,6 +159,7 @@ glibtop_get_proc_signal_p (glibtop *serv
#else
buf->sigcatch [0] = pinfo [0].kp_proc.p_sigcatch;
#endif
+#endif /* NetBSD */
buf->flags = _glibtop_sysdeps_proc_signal;
}