[Glibc-bsd-commits] r2977 - in trunk/kfreebsd-8/debian: . patches
Petr Salinger
ps-guest at alioth.debian.org
Sat Feb 13 17:45:03 UTC 2010
Author: ps-guest
Date: 2010-02-13 17:45:01 +0000 (Sat, 13 Feb 2010)
New Revision: 2977
Added:
trunk/kfreebsd-8/debian/patches/104_linprocfs.diff
Modified:
trunk/kfreebsd-8/debian/changelog
trunk/kfreebsd-8/debian/patches/series
Log:
Improve linprocfs, see #344546, #521304, #460331 for other/related problems.
Modified: trunk/kfreebsd-8/debian/changelog
===================================================================
--- trunk/kfreebsd-8/debian/changelog 2010-02-13 12:33:24 UTC (rev 2976)
+++ trunk/kfreebsd-8/debian/changelog 2010-02-13 17:45:01 UTC (rev 2977)
@@ -1,7 +1,11 @@
kfreebsd-8 (8.0-4) UNRELEASED; urgency=low
+ [ Robert Millan ]
* Remove build kludge in favour of using libsbuf-dev.
+ [ Petr Salinger ]
+ * Improve linprocfs, see #460331, #521304.
+
-- Robert Millan <rmh.debian at aybabtu.com> Fri, 29 Jan 2010 14:34:15 +0100
kfreebsd-8 (8.0-3) unstable; urgency=low
Added: trunk/kfreebsd-8/debian/patches/104_linprocfs.diff
===================================================================
--- trunk/kfreebsd-8/debian/patches/104_linprocfs.diff (rev 0)
+++ trunk/kfreebsd-8/debian/patches/104_linprocfs.diff 2010-02-13 17:45:01 UTC (rev 2977)
@@ -0,0 +1,93 @@
+
+Improve linprocfs, see #344546, #521304, #460331
+for other/related problems.
+
+--- a/sys//compat/linprocfs/linprocfs.c
++++ b/sys//compat/linprocfs/linprocfs.c
+@@ -110,13 +110,36 @@
+ /*
+ * Various conversion macros
+ */
++
++/* The LINUX_USER_HZ is assumed 100 for now */
++
++#if defined(__i386__)
++/* we need intermediate result as 64 bit, otherwise it overflows too early */
++#define DO64_MULDIV(v,m,d) \
++({ \
++ unsigned long rv0; \
++ unsigned long rv1; \
++ __asm__ __volatile__( \
++ "mull %1\n\t" \
++ "divl %2\n\t" \
++ :"=a" (rv0), "=d" (rv1) \
++ :"r" (d), "0" (v), "1" (m) \
++ :"cc" ); \
++ rv0; \
++})
++
++#define T2J(x) DO64_MULDIV((x), 100UL, (stathz ? stathz : hz)) /* ticks to jiffies */
++#else
+ #define T2J(x) (((x) * 100UL) / (stathz ? stathz : hz)) /* ticks to jiffies */
++#endif
+ #define T2S(x) ((x) / (stathz ? stathz : hz)) /* ticks to seconds */
+ #define B2K(x) ((x) >> 10) /* bytes to kbytes */
+ #define B2P(x) ((x) >> PAGE_SHIFT) /* bytes to pages */
+ #define P2B(x) ((x) << PAGE_SHIFT) /* pages to bytes */
+ #define P2K(x) ((x) << (PAGE_SHIFT - 10)) /* pages to kbytes */
+
++#define TV2J(x) (((x)->tv_sec) * 100UL + ((x)->tv_usec) / 10000)
++
+ /**
+ * @brief Mapping of ki_stat in struct kinfo_proc to the linux state
+ *
+@@ -498,12 +521,24 @@
+ {
+ long cp_time[CPUSTATES];
+ struct timeval tv;
++ int cnt, i;
+
+ getmicrouptime(&tv);
+ read_cpu_time(cp_time);
++
++ for (cnt = 0, i = 0; i <= mp_maxid; ++i)
++ if (!(CPU_ABSENT(i)))
++ cnt++;
++
++ if (!cnt)
++ cnt = 1;
++
++ i = ((cp_time[CP_IDLE])/cnt) % (stathz ? stathz : hz);
++ i = (i * 100) / (stathz ? stathz : hz);
++
+ sbuf_printf(sb, "%lld.%02ld %ld.%02ld\n",
+ (long long)tv.tv_sec, tv.tv_usec / 10000,
+- T2S(cp_time[CP_IDLE]), T2J(cp_time[CP_IDLE]) % 100);
++ T2S((cp_time[CP_IDLE]/cnt)), i);
+ return (0);
+ }
+
+@@ -637,10 +672,10 @@
+ PS_ADD("cminflt", "%lu", kp.ki_rusage_ch.ru_minflt);
+ PS_ADD("majflt", "%lu", kp.ki_rusage.ru_majflt);
+ PS_ADD("cmajflt", "%lu", kp.ki_rusage_ch.ru_majflt);
+- PS_ADD("utime", "%ld", T2J(tvtohz(&kp.ki_rusage.ru_utime)));
+- PS_ADD("stime", "%ld", T2J(tvtohz(&kp.ki_rusage.ru_stime)));
+- PS_ADD("cutime", "%ld", T2J(tvtohz(&kp.ki_rusage_ch.ru_utime)));
+- PS_ADD("cstime", "%ld", T2J(tvtohz(&kp.ki_rusage_ch.ru_stime)));
++ PS_ADD("utime", "%ld", TV2J((&kp.ki_rusage.ru_utime)));
++ PS_ADD("stime", "%ld", TV2J((&kp.ki_rusage.ru_stime)));
++ PS_ADD("cutime", "%ld", TV2J((&kp.ki_rusage_ch.ru_utime)));
++ PS_ADD("cstime", "%ld", TV2J((&kp.ki_rusage_ch.ru_stime)));
+ PS_ADD("priority", "%d", kp.ki_pri.pri_user);
+ PS_ADD("nice", "%d", kp.ki_nice); /* 19 (nicest) to -19 */
+ PS_ADD("0", "%d", 0); /* removed field */
+@@ -648,7 +683,7 @@
+ /* XXX: starttime is not right, it is the _same_ for _every_ process.
+ It should be the number of jiffies between system boot and process
+ start. */
+- PS_ADD("starttime", "%lu", T2J(tvtohz(&kp.ki_start)));
++ PS_ADD("starttime", "%lu", TV2J((&kp.ki_start)) - TV2J((&boottime)));
+ PS_ADD("vsize", "%ju", P2K((uintmax_t)kp.ki_size));
+ PS_ADD("rss", "%ju", (uintmax_t)kp.ki_rssize);
+ PS_ADD("rlim", "%lu", kp.ki_rusage.ru_maxrss);
Modified: trunk/kfreebsd-8/debian/patches/series
===================================================================
--- trunk/kfreebsd-8/debian/patches/series 2010-02-13 12:33:24 UTC (rev 2976)
+++ trunk/kfreebsd-8/debian/patches/series 2010-02-13 17:45:01 UTC (rev 2977)
@@ -17,6 +17,7 @@
021_superpages_i386.diff
102_POLL_HUP.diff
103_stat_pipe.diff
+104_linprocfs.diff
902_version.diff
903_disable_non-free_drivers.diff
904_dev_full.diff
More information about the Glibc-bsd-commits
mailing list