--- sysdeps/freebsd/proclist.c.orig Thu May 27 23:04:05 1999 +++ sysdeps/freebsd/proclist.c Sun Sep 7 20:37:30 2003 @@ -86,13 +86,24 @@ pids = glibtop_realloc_r (server, pids, count * sizeof (unsigned)); /* Copy the pids over to this chain */ 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 */ /* Set the fields in buf */ buf->number = j; --- sysdeps/freebsd/procstate.c.orig Sun Oct 17 03:01:39 1999 +++ sysdeps/freebsd/procstate.c Sun Sep 7 20:37:30 2003 @@ -28,7 +28,7 @@ #include #if !defined(__OpenBSD__) -//&& (!defined __bsdi__) +/*&& (!defined __bsdi__)*/ #include #endif @@ -37,11 +37,7 @@ (1L << GLIBTOP_PROC_STATE_GID); static const unsigned long _glibtop_sysdeps_proc_state_new = -#if LIBGTOP_VERSION_CODE >= 1001000 -(1L << GLIBTOP_PROC_STATE_RUID) + (1L << GLIBTOP_PROC_STATE_RGID); -#else 0; -#endif /* Init function. */ @@ -76,43 +72,35 @@ return; } - strncpy (buf->cmd, pinfo [0].kp_proc.p_comm, sizeof (buf->cmd)-1); - buf->cmd [sizeof (buf->cmd)-1] = 0; +#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 - buf->uid = pinfo [0].kp_eproc.e_pcred.p_svuid; - buf->gid = pinfo [0].kp_eproc.e_pcred.p_svgid; +#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 -#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; #endif + strncpy (buf->cmd, pinfo [0].XXX_P_COMM, sizeof (buf->cmd)-1); + buf->cmd [sizeof (buf->cmd)-1] = 0; + + buf->uid = pinfo [0].XXX_P_SVUID; + buf->gid = pinfo [0].XXX_P_SVGID; + /* Set the flags for the data we're about to return*/ buf->flags = _glibtop_sysdeps_proc_state | _glibtop_sysdeps_proc_state_new; -#if LIBGTOP_VERSION_CODE >= 1001000 - switch (pinfo [0].kp_proc.p_stat) { - case SIDL: - buf->state = 0; - break; - case SRUN: - buf->state = GLIBTOP_PROCESS_RUNNING; - break; - case SSLEEP: - buf->state = GLIBTOP_PROCESS_INTERRUPTIBLE; - break; - case SSTOP: - buf->state = GLIBTOP_PROCESS_STOPPED; - break; - case SZOMB: - buf->state = GLIBTOP_PROCESS_ZOMBIE; - break; - default: - return; - } -#else - switch (pinfo [0].kp_proc.p_stat) { + switch (pinfo [0].XXX_P_STAT) { case SIDL: buf->state = 'S'; break; @@ -131,7 +119,6 @@ default: return; } -#endif buf->flags |= (1L << GLIBTOP_PROC_STATE_STATE); } --- sysdeps/freebsd/procuid.c.orig Fri Sep 17 06:08:07 1999 +++ sysdeps/freebsd/procuid.c Sun Sep 7 20:37:30 2003 @@ -84,17 +84,46 @@ return; } - 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 +#if __FreeBSD_version >= 500013 +#define XXX_P_PRIORITY ki_pri.pri_user +#else +#define XXX_P_PRIORITY ki_priority +#endif +#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; /* Set the flags for the data we're about to return*/ buf->flags = _glibtop_sysdeps_proc_uid; --- sysdeps/freebsd/procsignal.c.orig Mon Feb 14 06:31:39 2000 +++ sysdeps/freebsd/procsignal.c Sun Sep 7 20:37:30 2003 @@ -67,11 +67,27 @@ return; } +#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. * pinfo [0].kp_proc.p_siglist */ #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 buf->signal [0] = pinfo [0].kp_proc.p_siglist; #endif @@ -80,7 +96,7 @@ * pinfo [0].kp_proc.p_sigmask */ #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 buf->blocked [0] = pinfo [0].kp_proc.p_sigmask; #endif @@ -89,7 +105,7 @@ * pinfo [0].kp_proc.p_sigignore */ #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 buf->sigignore [0] = pinfo [0].kp_proc.p_sigignore; #endif @@ -98,7 +114,7 @@ * pinfo [0].kp_proc.p_sigcatch */ #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 buf->sigcatch [0] = pinfo [0].kp_proc.p_sigcatch; #endif