diff options
author | ade <ade@FreeBSD.org> | 2000-12-28 01:26:58 +0800 |
---|---|---|
committer | ade <ade@FreeBSD.org> | 2000-12-28 01:26:58 +0800 |
commit | c59e8292cec966e834e0510233a5aaf76ceab881 (patch) | |
tree | d49f7c6adb5a232164a0a71ba038773922ec1ec3 /devel/libgtop | |
parent | 2b17b36164ed0bb88a9e41b0fff356c94123f105 (diff) | |
download | freebsd-ports-gnome-c59e8292cec966e834e0510233a5aaf76ceab881.tar.gz freebsd-ports-gnome-c59e8292cec966e834e0510233a5aaf76ceab881.tar.zst freebsd-ports-gnome-c59e8292cec966e834e0510233a5aaf76ceab881.zip |
Make libgtop compile on -current again after the recent
kinfo_proc changes. It seems to do the right thing on my laptop,
but confirmations from others would be appreciated.
Diffstat (limited to 'devel/libgtop')
-rw-r--r-- | devel/libgtop/Makefile | 2 | ||||
-rw-r--r-- | devel/libgtop/files/patch-ah | 12 | ||||
-rw-r--r-- | devel/libgtop/files/patch-aj | 365 |
3 files changed, 376 insertions, 3 deletions
diff --git a/devel/libgtop/Makefile b/devel/libgtop/Makefile index e42e08df09b3..d11660a8c2eb 100644 --- a/devel/libgtop/Makefile +++ b/devel/libgtop/Makefile @@ -7,7 +7,7 @@ PORTNAME= libgtop PORTVERSION= 1.0.10 -PORTREVISION= 1 +PORTREVISION= 2 CATEGORIES= devel gnome MASTER_SITES= ${MASTER_SITE_GNOME} MASTER_SITE_SUBDIR= stable/sources/libgtop diff --git a/devel/libgtop/files/patch-ah b/devel/libgtop/files/patch-ah index 4d013402ac73..6fd7e96d00c5 100644 --- a/devel/libgtop/files/patch-ah +++ b/devel/libgtop/files/patch-ah @@ -1,5 +1,5 @@ --- sysdeps/freebsd/procmap.c.orig Thu May 27 13:56:48 1999 -+++ sysdeps/freebsd/procmap.c Wed Dec 6 21:51:47 2000 ++++ sysdeps/freebsd/procmap.c Wed Dec 27 10:51:50 2000 @@ -35,3 +35,7 @@ #include <vm/vm_object.h> +#if (__FreeBSD_version >= 400011) @@ -12,7 +12,15 @@ struct inode inode; - struct mount mount; #endif -@@ -253,7 +256,2 @@ +@@ -116,3 +119,7 @@ + if (kvm_read (server->machine.kd, ++#if __FreeBSD_version >= 500013 ++ (unsigned long) pinfo [0].ki_vmspace, ++#else + (unsigned long) pinfo [0].kp_proc.p_vmspace, ++#endif + (char *) &vmspace, sizeof (vmspace)) != sizeof (vmspace)) +@@ -253,7 +260,2 @@ glibtop_error_io_r (server, "kvm_read (inode)"); - - if (kvm_read (server->machine.kd, diff --git a/devel/libgtop/files/patch-aj b/devel/libgtop/files/patch-aj new file mode 100644 index 000000000000..89b14a7ce5c2 --- /dev/null +++ b/devel/libgtop/files/patch-aj @@ -0,0 +1,365 @@ +--- sysdeps/freebsd/proclist.c.orig Thu May 27 09:04:05 1999 ++++ sysdeps/freebsd/proclist.c Fri Dec 22 18:02:59 2000 +@@ -88,9 +88,20 @@ + for (i=j=0; i < count; i++) { ++#if __FreeBSD_version >= 500013 ++#define XXX_P_STAT ki_stat ++#define XXX_P_RUID ki_ruid ++#define XXX_P_PID ki_pid ++ ++#else ++#define XXX_P_STAT kp_proc.p_stat ++#define XXX_P_RUID kp_eproc.e_pcred.p_ruid ++#define XXX_P_PID kp_proc.p_pid ++ ++#endif + if ((real_which & GLIBTOP_EXCLUDE_IDLE) && +- (pinfo[i].kp_proc.p_stat != SRUN)) ++ (pinfo[i].XXX_P_STAT != SRUN)) + continue; + else if ((real_which & GLIBTOP_EXCLUDE_SYSTEM) && +- (pinfo[i].kp_eproc.e_pcred.p_ruid == 0)) ++ (pinfo[i].XXX_P_RUID == 0)) + continue; +- pids [j++] = (unsigned) pinfo[i].kp_proc.p_pid; ++ pids [j++] = (unsigned) pinfo[i].XXX_P_PID; + } /* end for */ +--- sysdeps/freebsd/procstate.c.orig Sat Oct 16 13:01:39 1999 ++++ sysdeps/freebsd/procstate.c Fri Dec 22 18:00:55 2000 +@@ -78,11 +78,29 @@ + +- strncpy (buf->cmd, pinfo [0].kp_proc.p_comm, sizeof (buf->cmd)-1); ++#if __FreeBSD_version >= 500013 ++#define XXX_P_COMM ki_comm ++#define XXX_P_SVUID ki_svuid ++#define XXX_P_SVGID ki_svgid ++#define XXX_P_RUID ki_ruid ++#define XXX_P_RGID ki_rgid ++#define XXX_P_STAT ki_stat ++ ++#else ++#define XXX_P_COMM kp_proc.p_comm ++#define XXX_P_SVUID kp_eproc.e_pcred.p_svuid ++#define XXX_P_SVGID kp_eproc.e_pcred.p_svgid ++#define XXX_P_RUID kp_eproc.e_pcred.p_ruid ++#define XXX_P_RGID kp_eproc.e_pcred.p_rgid ++#define XXX_P_STAT kp_proc.p_stat ++ ++#endif ++ ++ strncpy (buf->cmd, pinfo [0].XXX_P_COMM, sizeof (buf->cmd)-1); + buf->cmd [sizeof (buf->cmd)-1] = 0; + +- buf->uid = pinfo [0].kp_eproc.e_pcred.p_svuid; +- buf->gid = pinfo [0].kp_eproc.e_pcred.p_svgid; ++ buf->uid = pinfo [0].XXX_P_SVUID; ++ buf->gid = pinfo [0].XXX_P_SVGID; + + #if LIBGTOP_VERSION_CODE >= 1001000 +- buf->ruid = pinfo [0].kp_eproc.e_pcred.p_ruid; +- buf->rgid = pinfo [0].kp_eproc.e_pcred.p_rgid; ++ buf->ruid = pinfo [0].XXX_P_RUID; ++ buf->rgid = pinfo [0].XXX_P_RGID; + #endif +@@ -94,3 +112,3 @@ + #if LIBGTOP_VERSION_CODE >= 1001000 +- switch (pinfo [0].kp_proc.p_stat) { ++ switch (pinfo [0].XXX_P_STAT) { + case SIDL: +@@ -114,3 +132,3 @@ + #else +- switch (pinfo [0].kp_proc.p_stat) { ++ switch (pinfo [0].XXX_P_STAT) { + case SIDL: +--- sysdeps/freebsd/procuid.c.orig Thu Sep 16 16:08:07 1999 ++++ sysdeps/freebsd/procuid.c Fri Dec 22 18:37:41 2000 +@@ -86,13 +86,38 @@ + +- buf->uid = pinfo [0].kp_eproc.e_pcred.p_ruid; +- buf->euid = pinfo [0].kp_eproc.e_pcred.p_svuid; +- buf->gid = pinfo [0].kp_eproc.e_pcred.p_rgid; +- buf->egid = pinfo [0].kp_eproc.e_pcred.p_svgid; +- +- buf->ppid = pinfo [0].kp_eproc.e_ppid; +- buf->pgrp = pinfo [0].kp_eproc.e_pgid; +- buf->tpgid = pinfo [0].kp_eproc.e_tpgid; ++#if __FreeBSD_version >= 500013 + +- buf->nice = pinfo [0].kp_proc.p_nice; +- buf->priority = pinfo [0].kp_proc.p_priority; ++#define XXX_P_RUID ki_ruid ++#define XXX_P_SVUID ki_svuid ++#define XXX_P_RGID ki_rgid ++#define XXX_P_SVGID ki_svgid ++#define XXX_E_PPID ki_ppid ++#define XXX_E_PGID ki_pgid ++#define XXX_E_TPGID ki_tpgid ++#define XXX_P_NICE ki_nice ++#define XXX_P_PRIORITY ki_priority ++#else ++ ++#define XXX_P_RUID kp_eproc.e_pcred.p_ruid ++#define XXX_P_SVUID kp_eproc.e_pcred.p_svuid ++#define XXX_P_RGID kp_eproc.e_pcred.p_rgid ++#define XXX_P_SVGID kp_eproc.e_pcred.p_svgid ++#define XXX_E_PPID kp_eproc.e_ppid ++#define XXX_E_PGID kp_eproc.e_pgid ++#define XXX_E_TPGID kp_eproc.e_tpgid ++#define XXX_P_NICE kp_proc.p_nice ++#define XXX_P_PRIORITY kp_proc.p_priority ++ ++#endif ++ ++ buf->uid = pinfo [0].XXX_P_RUID; ++ buf->euid = pinfo [0].XXX_P_SVUID; ++ buf->gid = pinfo [0].XXX_P_RGID; ++ buf->egid = pinfo [0].XXX_P_SVGID; ++ ++ buf->ppid = pinfo [0].XXX_E_PPID; ++ buf->pgrp = pinfo [0].XXX_E_PGID; ++ buf->tpgid = pinfo [0].XXX_E_TPGID; ++ ++ buf->nice = pinfo [0].XXX_P_NICE; ++ buf->priority = pinfo [0].XXX_P_PRIORITY; + +--- sysdeps/freebsd/proctime.c.orig Thu Sep 16 16:08:07 1999 ++++ sysdeps/freebsd/proctime.c Fri Dec 22 22:45:57 2000 +@@ -68,5 +68,2 @@ + u_quad_t u, st, ut, it, tot; +-#if (__FreeBSD_version < 300003) +- long sec, usec; +-#endif + struct timeval tv; +@@ -83,8 +80,3 @@ + +-#if (defined __FreeBSD__) && (__FreeBSD_version >= 300003) +- +- /* This was changed from a `struct timeval' into a `u_int64_t' +- * on FreeBSD 3.0 and renamed p_rtime -> p_runtime. +- */ +- ++#if (defined __FreeBSD__) + totusec = (u_quad_t) p->p_runtime; +@@ -159,6 +151,6 @@ + +-#if (defined __FreeBSD__) && (__FreeBSD_version >= 300003) +- buf->rtime = pinfo [0].kp_proc.p_runtime; ++#if (defined __FreeBSD__) && (__FreeBSD_version >= 500013) ++ buf->rtime = pinfo [0].ki_runtime; + #else +- buf->rtime = tv2sec (pinfo [0].kp_proc.p_rtime); ++ buf->rtime = pinfo [0].kp_proc.p_runtime; + #endif +@@ -194,2 +186,13 @@ + #else ++#if __FreeBSD_version >= 500013 ++ if ((pinfo [0].ki_flag & P_INMEM)) { ++ buf->utime = pinfo [0].ki_runtime; ++ buf->stime = 0; /* XXX */ ++ buf->cutime = tv2sec (pinfo [0].ki_childtime); ++ buf->cstime = 0; /* XXX */ ++ buf->start_time = tv2sec (pinfo [0].ki_start); ++ buf->flags = _glibtop_sysdeps_proc_time_user; ++ } ++ ++#else + glibtop_suid_enter (server); +@@ -224,2 +227,3 @@ + } ++#endif + +--- sysdeps/freebsd/procmem.c.orig Thu May 27 13:56:49 1999 ++++ sysdeps/freebsd/procmem.c Wed Dec 27 10:16:26 2000 +@@ -139,2 +139,18 @@ + ++#if __FreeBSD_version >= 500013 ++ ++#define XXX_P_VMSPACE ki_vmspace ++ ++ buf->rss_rlim = pinfo [0].ki_rssize; ++ ++ buf->vsize = buf->size = (u_int64_t) pagetok ++ (pinfo [0].ki_tsize + pinfo [0].ki_dsize + pinfo[0].ki_ssize) ++ << LOG1024; ++ buf->resident = buf->rss = (u_int64_t) pagetok ++ (pinfo [0].ki_rssize) << LOG1024; ++ ++#else ++ ++#define XXX_P_VMSPACE kp_proc.p_vmspace ++ + if (kvm_read (server->machine.kd, +@@ -156,2 +172,3 @@ + (vms->vm_rssize) << LOG1024; ++#endif + +@@ -160,3 +177,3 @@ + if (kvm_read (server->machine.kd, +- (unsigned long) pinfo [0].kp_proc.p_vmspace, ++ (unsigned long) pinfo [0].XXX_P_VMSPACE, + (char *) &vmspace, sizeof (vmspace)) != sizeof (vmspace)) { +--- sysdeps/freebsd/procsignal.c.orig Sun Feb 13 15:31:39 2000 ++++ sysdeps/freebsd/procsignal.c Wed Dec 27 10:22:28 2000 +@@ -69,2 +69,18 @@ + ++#if __FreeBSD_version >= 500013 ++ ++#define XXX_P_SIGLIST ki_siglist ++#define XXX_P_SIGMASK ki_sigmask ++#define XXX_P_SIGIGNORE ki_sigignore ++#define XXX_P_SIGCATCH ki_sigcatch ++ ++#else ++ ++#define XXX_P_SIGLIST kp_proc.p_siglist ++#define XXX_P_SIGMASK kp_proc.p_sigmask ++#define XXX_P_SIGIGNORE kp_proc.p_sigignore ++#define XXX_P_SIGCATCH kp_proc.p.sigcatch ++ ++#endif ++ + /* signal: mask of pending signals. +@@ -73,3 +89,3 @@ + #if (defined(__NetBSD__) && (NSIG > 32)) || (__FreeBSD_version >= 400011) +- buf->signal [0] = pinfo [0].kp_proc.p_siglist.__bits[0]; ++ buf->signal [0] = pinfo [0].XXX_P_SIGLIST.__bits[0]; + #else +@@ -82,3 +98,3 @@ + #if (defined(__NetBSD__) && (NSIG > 32)) || (__FreeBSD_version >= 400011) +- buf->blocked [0] = pinfo [0].kp_proc.p_sigmask.__bits[0]; ++ buf->blocked [0] = pinfo [0].XXX_P_SIGMASK.__bits[0]; + #else +@@ -91,3 +107,3 @@ + #if (defined(__NetBSD__) && (NSIG > 32)) || (__FreeBSD_version >= 400011) +- buf->sigignore [0] = pinfo [0].kp_proc.p_sigignore.__bits[0]; ++ buf->sigignore [0] = pinfo [0].XXX_P_SIGIGNORE.__bits[0]; + #else +@@ -100,3 +116,3 @@ + #if (defined(__NetBSD__) && (NSIG > 32)) || (__FreeBSD_version >= 400011) +- buf->sigcatch [0] = pinfo [0].kp_proc.p_sigcatch.__bits[0]; ++ buf->sigcatch [0] = pinfo [0].XXX_P_SIGCATCH.__bits[0]; + #else +--- sysdeps/freebsd/prockernel.c.orig Sat Oct 16 13:31:43 1999 ++++ sysdeps/freebsd/prockernel.c Wed Dec 27 10:50:19 2000 +@@ -36,8 +36,2 @@ + #endif +-#if !defined(__bsdi__) && !(defined(__FreeBSD__) && defined(__alpha__)) +-#include <machine/pcb.h> +-#endif +-#if defined(__FreeBSD__) && !defined(__alpha__) +-#include <machine/tss.h> +-#endif + +@@ -80,10 +74,4 @@ + struct kinfo_proc *pinfo; +- struct user *u_addr = (struct user *)USRSTACK; +- struct pstats pstats; +- struct pcb pcb; + int count; + +- char filename [BUFSIZ]; +- struct stat statb; +- + glibtop_init_p (server, (1L << GLIBTOP_SYSDEPS_PROC_KERNEL), 0); +@@ -103,7 +91,21 @@ + +- buf->nwchan = (unsigned long) pinfo [0].kp_proc.p_wchan &~ KERNBASE; ++#if __FreeBSD_version >= 500013 ++ ++#define XXX_P_WCHAN ki_wchan ++#define XXX_P_WMESG ki_wmesg ++#define XXX_E_WMESG ki_wmesg ++ ++#else ++ ++#define XXX_P_WCHAN kp_proc.p_wchan ++#define XXX_P_WMESG kp_proc.p_wmesg ++#define XXX_E_WMESG kp_eproc.e_wmesg ++ ++#endif ++ ++ buf->nwchan = (unsigned long) pinfo [0].XXX_P_WCHAN &~ KERNBASE; + buf->flags |= (1L << GLIBTOP_PROC_KERNEL_NWCHAN); + +- if (pinfo [0].kp_proc.p_wchan && pinfo [0].kp_proc.p_wmesg) { +- strncpy (buf->wchan, pinfo [0].kp_eproc.e_wmesg, ++ if (pinfo [0].XXX_P_WCHAN && pinfo [0].XXX_P_WMESG) { ++ strncpy (buf->wchan, pinfo [0].XXX_E_WMESG, + sizeof (buf->wchan) - 1); +@@ -115,70 +117,8 @@ + +- /* Taken from `saveuser ()' in `/usr/src/bin/ps/ps.c'. */ +- +- /* [FIXME]: /usr/include/sys/user.h tells me that the user area +- * may or may not be at the same kernel address in all +- * processes, but I don't see any way to get that address. +- * Since `ps' simply uses its own address, I think it's +- * safe to do this here, too. */ +- +- /* NOTE: You need to mount the /proc filesystem to make +- * `kvm_uread' work. */ +- +- sprintf (filename, "/proc/%d/mem", (int) pid); +- if (stat (filename, &statb)) return; +- +- glibtop_suid_enter (server); +- +- if ((pinfo [0].kp_proc.p_flag & P_INMEM) && +- kvm_uread (server->machine.kd, &(pinfo [0]).kp_proc, +- (unsigned long) &u_addr->u_stats, +- (char *) &pstats, sizeof (pstats)) == sizeof (pstats)) +- { +- /* +- * The u-area might be swapped out, and we can't get +- * at it because we have a crashdump and no swap. +- * If it's here fill in these fields, otherwise, just +- * leave them 0. +- */ +- +- buf->min_flt = (u_int64_t) pstats.p_ru.ru_minflt; +- buf->maj_flt = (u_int64_t) pstats.p_ru.ru_majflt; +- buf->cmin_flt = (u_int64_t) pstats.p_cru.ru_minflt; +- buf->cmaj_flt = (u_int64_t) pstats.p_cru.ru_majflt; +- +- buf->flags |= _glibtop_sysdeps_proc_kernel_pstats; +- } +- +- if ((pinfo [0].kp_proc.p_flag & P_INMEM) && +- kvm_uread (server->machine.kd, &(pinfo [0]).kp_proc, +- (unsigned long) &u_addr->u_pcb, +- (char *) &pcb, sizeof (pcb)) == sizeof (pcb)) +- { +-#ifdef __FreeBSD__ +-#ifndef __alpha__ +-#if (__FreeBSD_version >= 300003) +- buf->kstk_esp = (u_int64_t) pcb.pcb_esp; +- buf->kstk_eip = (u_int64_t) pcb.pcb_eip; +-#else +- buf->kstk_esp = (u_int64_t) pcb.pcb_ksp; +- buf->kstk_eip = (u_int64_t) pcb.pcb_pc; +-#endif +-#else +- /*xxx FreeBSD/Alpha? */ +-#endif +-#else +- buf->kstk_esp = (u_int64_t) pcb.pcb_tss.tss_esp0; +-#ifdef __bsdi__ +- buf->kstk_eip = (u_int64_t) pcb.pcb_tss.tss_eip; +-#else +- buf->kstk_eip = (u_int64_t) pcb.pcb_tss.__tss_eip; +-#endif +- +- buf->flags |= _glibtop_sysdeps_proc_kernel_pcb; +-#endif +- } +- +- /* Taken from `wchan ()' in `/usr/src/bin/ps/print.c'. */ +- +- glibtop_suid_leave (server); ++ /* XXX: the code here was, quite frankly, junk, and almost ++ * certainly wrong - remove it all, leave these fields ++ * unpopulated, and give up until such time as the right ++ * code is produced for both FreeBSD 4.x and 5.x ++ */ ++ return; + } |