summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/proc/array.c26
-rw-r--r--include/asm-alpha/param.h1
-rw-r--r--include/asm-arm/arch-ebsa110/param.h1
-rw-r--r--include/asm-arm/arch-ebsa285/param.h1
-rw-r--r--include/asm-arm/arch-nexuspci/param.h1
-rw-r--r--include/asm-arm/arch-rpc/param.h1
-rw-r--r--include/asm-arm/proc-armo/param.h1
-rw-r--r--include/asm-i386/param.h1
-rw-r--r--include/asm-m68k/param.h1
-rw-r--r--include/asm-mips/param.h30
-rw-r--r--include/asm-ppc/param.h1
-rw-r--r--include/asm-sparc/param.h1
-rw-r--r--include/asm-sparc64/param.h1
-rw-r--r--kernel/signal.c5
-rw-r--r--kernel/sys.c10
15 files changed, 64 insertions, 18 deletions
diff --git a/fs/proc/array.c b/fs/proc/array.c
index 5e88d0566..33717830f 100644
--- a/fs/proc/array.c
+++ b/fs/proc/array.c
@@ -233,7 +233,7 @@ static int get_kstat(char * buffer)
extern unsigned long total_forks;
unsigned long ticks;
- ticks = jiffies * smp_num_cpus;
+ ticks = HZ_TO_STD(jiffies) * smp_num_cpus;
for (i = 0 ; i < NR_IRQS ; i++)
sum += kstat_irqs(i);
@@ -273,10 +273,10 @@ static int get_kstat(char * buffer)
"page %u %u\n"
"swap %u %u\n"
"intr %u",
- kstat.cpu_user,
- kstat.cpu_nice,
- kstat.cpu_system,
- ticks - (kstat.cpu_user + kstat.cpu_nice + kstat.cpu_system),
+ HZ_TO_STD(kstat.cpu_user),
+ HZ_TO_STD(kstat.cpu_nice),
+ HZ_TO_STD(kstat.cpu_system),
+ ticks - HZ_TO_STD(kstat.cpu_user + kstat.cpu_nice + kstat.cpu_system),
#endif
kstat.dk_drive[0], kstat.dk_drive[1],
kstat.dk_drive[2], kstat.dk_drive[3],
@@ -932,10 +932,10 @@ static int get_stat(int pid, char * buffer)
tsk->cmin_flt,
tsk->maj_flt,
tsk->cmaj_flt,
- tsk->times.tms_utime,
- tsk->times.tms_stime,
- tsk->times.tms_cutime,
- tsk->times.tms_cstime,
+ HZ_TO_STD(tsk->times.tms_utime),
+ HZ_TO_STD(tsk->times.tms_stime),
+ HZ_TO_STD(tsk->times.tms_cutime),
+ HZ_TO_STD(tsk->times.tms_cstime),
priority,
nice,
0UL /* removed */,
@@ -1251,14 +1251,14 @@ static int get_pidcpu(int pid, char * buffer)
len = sprintf(buffer,
"cpu %lu %lu\n",
- tsk->times.tms_utime,
- tsk->times.tms_stime);
+ HZ_TO_STD(tsk->times.tms_utime),
+ HZ_TO_STD(tsk->times.tms_stime));
for (i = 0 ; i < smp_num_cpus; i++)
len += sprintf(buffer + len, "cpu%d %lu %lu\n",
i,
- tsk->per_cpu_utime[cpu_logical_map(i)],
- tsk->per_cpu_stime[cpu_logical_map(i)]);
+ HZ_TO_STD(tsk->per_cpu_utime[cpu_logical_map(i)]),
+ HZ_TO_STD(tsk->per_cpu_stime[cpu_logical_map(i)]));
return len;
}
diff --git a/include/asm-alpha/param.h b/include/asm-alpha/param.h
index 07382f5f1..3b586974f 100644
--- a/include/asm-alpha/param.h
+++ b/include/asm-alpha/param.h
@@ -3,6 +3,7 @@
#ifndef HZ
# define HZ 1024
+# define HZ_TO_STD(a) (a)
#endif
#define EXEC_PAGESIZE 8192
diff --git a/include/asm-arm/arch-ebsa110/param.h b/include/asm-arm/arch-ebsa110/param.h
index 865d8cc7a..46cff02d8 100644
--- a/include/asm-arm/arch-ebsa110/param.h
+++ b/include/asm-arm/arch-ebsa110/param.h
@@ -6,3 +6,4 @@
*/
#define HZ 100
+#define HZ_TO_STD(a) (a)
diff --git a/include/asm-arm/arch-ebsa285/param.h b/include/asm-arm/arch-ebsa285/param.h
index 021282dd7..1efdf79a2 100644
--- a/include/asm-arm/arch-ebsa285/param.h
+++ b/include/asm-arm/arch-ebsa285/param.h
@@ -6,3 +6,4 @@
*/
#define HZ 100
+#define HZ_TO_STD(a) (a)
diff --git a/include/asm-arm/arch-nexuspci/param.h b/include/asm-arm/arch-nexuspci/param.h
index f663d01f2..cb3e53ea1 100644
--- a/include/asm-arm/arch-nexuspci/param.h
+++ b/include/asm-arm/arch-nexuspci/param.h
@@ -6,3 +6,4 @@
*/
#define HZ 100
+#define HZ_TO_STD(a) (a)
diff --git a/include/asm-arm/arch-rpc/param.h b/include/asm-arm/arch-rpc/param.h
index bd1279f60..c71625c93 100644
--- a/include/asm-arm/arch-rpc/param.h
+++ b/include/asm-arm/arch-rpc/param.h
@@ -6,3 +6,4 @@
*/
#define HZ 100
+#define HZ_TO_STD(a) (a)
diff --git a/include/asm-arm/proc-armo/param.h b/include/asm-arm/proc-armo/param.h
index 230511003..9ffb72f18 100644
--- a/include/asm-arm/proc-armo/param.h
+++ b/include/asm-arm/proc-armo/param.h
@@ -9,6 +9,7 @@
#ifndef HZ
#define HZ 100
+#define HZ_TO_STD(a) (a)
#endif
#define EXEC_PAGESIZE 32768
diff --git a/include/asm-i386/param.h b/include/asm-i386/param.h
index f821b8643..8477d5c7a 100644
--- a/include/asm-i386/param.h
+++ b/include/asm-i386/param.h
@@ -3,6 +3,7 @@
#ifndef HZ
#define HZ 100
+#define HZ_TO_STD(a) (a)
#endif
#define EXEC_PAGESIZE 4096
diff --git a/include/asm-m68k/param.h b/include/asm-m68k/param.h
index 475002cef..27c9834e9 100644
--- a/include/asm-m68k/param.h
+++ b/include/asm-m68k/param.h
@@ -3,6 +3,7 @@
#ifndef HZ
#define HZ 100
+#define HZ_TO_STD(a) (a)
#endif
#define EXEC_PAGESIZE 4096
diff --git a/include/asm-mips/param.h b/include/asm-mips/param.h
index 09000b46a..09380c849 100644
--- a/include/asm-mips/param.h
+++ b/include/asm-mips/param.h
@@ -2,7 +2,35 @@
#define __ASM_MIPS_PARAM_H
#ifndef HZ
-#define HZ 100
+
+#include <linux/config.h>
+
+#ifdef CONFIG_DECSTATION
+ /*
+ * log2(HZ), change this here if you want another
+ * HZ value. This is also used in dec_time_init.
+ * Minimum is 1, Maximum is 15.
+ */
+# define LOG_2_HZ 7
+# define HZ (1 << LOG_2_HZ)
+ /*
+ * Ye olde division-by-multiplication trick.
+ *
+ * This works only if 100 / HZ <= 1
+ */
+# define QUOTIENT ((1UL << (32 - LOG_2_HZ)) * 100)
+# define HZ_TO_STD(a) \
+ ({ int __res; \
+ __asm__( \
+ "multu\t%0,%2\n\t" \
+ "mfhi\t%0" \
+ : "=r" (__res): "0" (a), "r" (QUOTIENT)); \
+ __res;})
+#else
+# define HZ 100
+# define HZ_TO_STD(a) (a)
+#endif
+
#endif
#define EXEC_PAGESIZE 4096
diff --git a/include/asm-ppc/param.h b/include/asm-ppc/param.h
index 0cdcc660e..35ad254d6 100644
--- a/include/asm-ppc/param.h
+++ b/include/asm-ppc/param.h
@@ -3,6 +3,7 @@
#ifndef HZ
#define HZ 100
+#define HZ_TO_STD(a) (a)
#endif
#define EXEC_PAGESIZE 4096
diff --git a/include/asm-sparc/param.h b/include/asm-sparc/param.h
index 7e14a410e..639675feb 100644
--- a/include/asm-sparc/param.h
+++ b/include/asm-sparc/param.h
@@ -4,6 +4,7 @@
#ifndef HZ
#define HZ 100
+#define HZ_TO_STD(a) (a)
#endif
#define EXEC_PAGESIZE 8192 /* Thanks for sun4's we carry baggage... */
diff --git a/include/asm-sparc64/param.h b/include/asm-sparc64/param.h
index 6d8bd6269..457db4933 100644
--- a/include/asm-sparc64/param.h
+++ b/include/asm-sparc64/param.h
@@ -4,6 +4,7 @@
#ifndef HZ
#define HZ 100
+#define HZ_TO_STD(a) (a)
#endif
#define EXEC_PAGESIZE 8192 /* Thanks for sun4's we carry baggage... */
diff --git a/kernel/signal.c b/kernel/signal.c
index 9a1cd2ab4..105bb8b1c 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -12,6 +12,7 @@
#include <linux/smp_lock.h>
#include <linux/init.h>
#include <linux/sched.h>
+#include <linux/param.h>
#include <asm/uaccess.h>
@@ -585,8 +586,8 @@ notify_parent(struct task_struct *tsk, int sig)
info.si_pid = tsk->pid;
/* FIXME: find out whether or not this is supposed to be c*time. */
- info.si_utime = tsk->times.tms_utime;
- info.si_stime = tsk->times.tms_stime;
+ info.si_utime = HZ_TO_STD(tsk->times.tms_utime);
+ info.si_stime = HZ_TO_STD(tsk->times.tms_stime);
why = SI_KERNEL; /* shouldn't happen */
switch (tsk->state) {
diff --git a/kernel/sys.c b/kernel/sys.c
index 5302297d8..4752c9ce6 100644
--- a/kernel/sys.c
+++ b/kernel/sys.c
@@ -605,6 +605,8 @@ asmlinkage int sys_setfsgid(gid_t gid)
asmlinkage long sys_times(struct tms * tbuf)
{
+ struct tms temp;
+
/*
* In the SMP world we might just be unlucky and have one of
* the times increment as we use it. Since the value is an
@@ -612,9 +614,13 @@ asmlinkage long sys_times(struct tms * tbuf)
* as if the syscall took an instant longer to occur.
*/
if (tbuf)
- if (copy_to_user(tbuf, &current->times, sizeof(struct tms)))
+ temp.tms_utime = HZ_TO_STD(current->times.tms_utime);
+ temp.tms_stime = HZ_TO_STD(current->times.tms_stime);
+ temp.tms_cutime = HZ_TO_STD(current->times.tms_cutime);
+ temp.tms_cstime = HZ_TO_STD(current->times.tms_cstime);
+ if (copy_to_user(tbuf, &temp, sizeof(struct tms)))
return -EFAULT;
- return jiffies;
+ return HZ_TO_STD(jiffies);
}
/*