diff options
Diffstat (limited to 'devel/libgtop2/files/patch-sysdeps::freebsd::proctime.c')
-rw-r--r-- | devel/libgtop2/files/patch-sysdeps::freebsd::proctime.c | 67 |
1 files changed, 41 insertions, 26 deletions
diff --git a/devel/libgtop2/files/patch-sysdeps::freebsd::proctime.c b/devel/libgtop2/files/patch-sysdeps::freebsd::proctime.c index f26b953a8631..8905fd21ba83 100644 --- a/devel/libgtop2/files/patch-sysdeps::freebsd::proctime.c +++ b/devel/libgtop2/files/patch-sysdeps::freebsd::proctime.c @@ -1,5 +1,5 @@ ---- sysdeps/freebsd/proctime.c.orig Mon Jun 10 17:34:42 2002 -+++ sysdeps/freebsd/proctime.c Wed Oct 2 21:18:38 2002 +--- sysdeps/freebsd/proctime.c.orig Thu Feb 15 06:36:42 2001 ++++ sysdeps/freebsd/proctime.c Tue Sep 9 11:17:56 2003 @@ -57,6 +57,7 @@ * system, and interrupt time usage. */ @@ -46,7 +46,17 @@ /* Provides detailed information about a process. */ -@@ -142,25 +132,25 @@ +@@ -132,9 +122,6 @@ + struct pstats pstats; + int count; + +- char filename [BUFSIZ]; +- struct stat statb; +- + glibtop_init_p (server, (1L << GLIBTOP_SYSDEPS_PROC_TIME), 0); + + memset (buf, 0, sizeof (glibtop_proc_time)); +@@ -142,25 +129,23 @@ /* It does not work for the swapper task. */ if (pid == 0) return; @@ -55,17 +65,20 @@ if (server->sysdeps.proc_time == 0) return; -+#endif - #ifndef __bsdi__ - sprintf (filename, "/proc/%d/mem", (int) pid); - if (stat (filename, &statb)) return; - #endif +-#ifndef __bsdi__ +- sprintf (filename, "/proc/%d/mem", (int) pid); +- if (stat (filename, &statb)) return; -#endif + #endif /* Get the process information */ pinfo = kvm_getprocs (server->machine.kd, KERN_PROC_PID, pid, &count); - if ((pinfo == NULL) || (count != 1)) - glibtop_error_io_r (server, "kvm_getprocs (%d)", pid); +- if ((pinfo == NULL) || (count != 1)) +- glibtop_error_io_r (server, "kvm_getprocs (%d)", pid); ++ if ((pinfo == NULL) || (count != 1)) { ++ glibtop_warn_io_r (server, "kvm_getprocs (%d)", pid); ++ return; ++ } -#if (defined __FreeBSD__) && (__FreeBSD_version >= 300003) - buf->rtime = pinfo [0].kp_proc.p_runtime; @@ -77,13 +90,13 @@ #endif buf->frequency = 1000000; -@@ -192,6 +182,21 @@ +@@ -192,6 +177,21 @@ buf->flags |= _glibtop_sysdeps_proc_time_user; #else +#if __FreeBSD_version >= 500013 +#if __FreeBSD_version >= 500016 -+ if ((pinfo [0].ki_flag & PS_INMEM)) { ++ if ((pinfo [0].ki_sflag & PS_INMEM)) { +#else + if ((pinfo [0].ki_flag & P_INMEM)) { +#endif @@ -92,14 +105,14 @@ + 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; ++ buf->flags |= _glibtop_sysdeps_proc_time_user; + } + +#else glibtop_suid_enter (server); if ((pinfo [0].kp_proc.p_flag & P_INMEM) && -@@ -199,29 +204,16 @@ +@@ -199,31 +199,17 @@ (unsigned long) &u_addr->u_stats, (char *) &pstats, sizeof (pstats)) == sizeof (pstats)) { @@ -109,8 +122,14 @@ - /* Well, we just do the same getrusage () does ... */ - - register struct rusage *rup; -- -- glibtop_suid_leave (server); + ++ buf->utime = tv2sec (pinfo[0].kp_eproc.e_stats.p_ru.ru_utime); ++ buf->stime = tv2sec (pinfo[0].kp_eproc.e_stats.p_ru.ru_stime); ++ buf->cutime = tv2sec (pinfo[0].kp_eproc.e_stats.p_cru.ru_utime); ++ buf->cstime = tv2sec (pinfo[0].kp_eproc.e_stats.p_cru.ru_stime); ++ buf->start_time = tv2sec (pinfo[0].kp_eproc.e_stats.p_start); ++ buf->flags |= _glibtop_sysdeps_proc_time_user; + glibtop_suid_leave (server); - - rup = &pstats.p_ru; - calcru(&(pinfo [0]).kp_proc, @@ -123,16 +142,12 @@ - buf->cstime = tv2sec (pstats.p_cru.ru_stime); - - buf->start_time = tv2sec (pstats.p_start); - -+ buf->utime = tv2sec (pinfo[0].kp_eproc.e_stats.p_ru.ru_utime); -+ buf->stime = tv2sec (pinfo[0].kp_eproc.e_stats.p_ru.ru_stime); -+ buf->cutime = tv2sec (pinfo[0].kp_eproc.e_stats.p_cru.ru_utime); -+ buf->cstime = tv2sec (pinfo[0].kp_eproc.e_stats.p_cru.ru_stime); -+ buf->start_time = tv2sec (pinfo[0].kp_eproc.e_stats.p_start); - buf->flags = _glibtop_sysdeps_proc_time_user; -+ glibtop_suid_leave (server); +- +- buf->flags = _glibtop_sysdeps_proc_time_user; } -+#endif - +- glibtop_suid_leave (server); ++#endif #endif + } + |