source: patches/procps-3.2.8-fix_HZ_errors-1.patch@ c58eb217

clfs-3.0.0-systemd clfs-3.0.0-sysvinit systemd sysvinit
Last change on this file since c58eb217 was 6d1db7d, checked in by Joe Ciccone <jciccone@…>, 14 years ago

Added a patch to procps to fix an issue when the
screen refresh rate isn't 60Hz.

  • Property mode set to 100644
File size: 2.3 KB
RevLine 
[6d1db7d]1Submitted By: DJ Lucas <dj_AT_linuxfromscratch_DOT_org>
2Date: 2010-09-20
3Initial Package Version: 3.2.8
4Origin: Debian 30_sysinfo_7numbers.patch
5Upstream Status: Submitted
6Description: Fixes "unknown HZ value (##)" errors in procps utils.
7
8diff -Naurp procps-3.2.8-orig//proc/sysinfo.c procps-3.2.8//proc/sysinfo.c
9--- procps-3.2.8-orig//proc/sysinfo.c 2008-03-23 23:33:43.000000000 -0500
10+++ procps-3.2.8//proc/sysinfo.c 2010-09-20 01:13:36.000000000 -0500
11@@ -124,24 +124,25 @@ int uptime(double *restrict uptime_secs,
12 unsigned long long Hertz;
13
14 static void old_Hertz_hack(void){
15- unsigned long long user_j, nice_j, sys_j, other_j; /* jiffies (clock ticks) */
16+ unsigned long long user_j, nice_j, sys_j, other_j, wait_j, hirq_j, sirq_j, stol_j; /* jiffies (clock ticks) */
17 double up_1, up_2, seconds;
18 unsigned long long jiffies;
19 unsigned h;
20 char *restrict savelocale;
21
22+ wait_j = hirq_j = sirq_j = stol_j = 0;
23 savelocale = setlocale(LC_NUMERIC, NULL);
24 setlocale(LC_NUMERIC, "C");
25 do{
26 FILE_TO_BUF(UPTIME_FILE,uptime_fd); sscanf(buf, "%lf", &up_1);
27 /* uptime(&up_1, NULL); */
28 FILE_TO_BUF(STAT_FILE,stat_fd);
29- sscanf(buf, "cpu %Lu %Lu %Lu %Lu", &user_j, &nice_j, &sys_j, &other_j);
30+ sscanf(buf, "cpu %Lu %Lu %Lu %Lu %Lu %Lu %Lu %Lu", &user_j, &nice_j, &sys_j, &other_j, &wait_j, &hirq_j, &sirq_j, &stol_j);
31 FILE_TO_BUF(UPTIME_FILE,uptime_fd); sscanf(buf, "%lf", &up_2);
32 /* uptime(&up_2, NULL); */
33 } while((long long)( (up_2-up_1)*1000.0/up_1 )); /* want under 0.1% error */
34 setlocale(LC_NUMERIC, savelocale);
35- jiffies = user_j + nice_j + sys_j + other_j;
36+ jiffies = user_j + nice_j + sys_j + other_j + wait_j + hirq_j + sirq_j + stol_j ;
37 seconds = (up_1 + up_2) / 2;
38 h = (unsigned)( (double)jiffies/seconds/smp_num_cpus );
39 /* actual values used by 2.4 kernels: 32 64 100 128 1000 1024 1200 */
40@@ -221,12 +222,13 @@ static void init_libproc(void){
41 // _SC_NPROCESSORS_ONLN returns 1, which should work OK
42 smp_num_cpus = sysconf(_SC_NPROCESSORS_ONLN);
43 if(smp_num_cpus<1) smp_num_cpus=1; /* SPARC glibc is buggy */
44-
45+#ifdef __linux__
46 if(linux_version_code > LINUX_VERSION(2, 4, 0)){
47 Hertz = find_elf_note(AT_CLKTCK);
48 if(Hertz!=NOTE_NOT_FOUND) return;
49 fputs("2.4+ kernel w/o ELF notes? -- report this\n", stderr);
50 }
51+#endif
52 old_Hertz_hack();
53 }
54
Note: See TracBrowser for help on using the repository browser.