aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorJeff Dike <jdike@addtoit.com>2007-10-16 04:27:27 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-16 12:43:08 -0400
commit5f734614fc6218db352d26571ab4d1604620199c (patch)
treeff1323d87862c0522ef83568543f46b46eac941a /arch
parentb160fb6309dc907cbd8849e549d83badb86dd35b (diff)
uml: time build fix
Put back an implementation of timeval_to_ns in arch/um/os-Linux/time.c. tglx pointed out in his review of tickless support that there was a perfectly good implementation of it in linux/time.h. The problem is that this is userspace code which can't pull in kernel headers and there doesn't seem to be a libc version. So, I'm copying the version from linux/time.h rather than resurrecting my version. This causes some declaration changes as it now returns a signed value rather than an unsigned value. Signed-off-by: Jeff Dike <jdike@linux.intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/um/include/os.h4
-rw-r--r--arch/um/os-Linux/time.c22
2 files changed, 21 insertions, 5 deletions
diff --git a/arch/um/include/os.h b/arch/um/include/os.h
index 91642e4137d7..a1b0804ee57b 100644
--- a/arch/um/include/os.h
+++ b/arch/um/include/os.h
@@ -254,9 +254,9 @@ extern void os_dump_core(void);
254extern void idle_sleep(unsigned long long nsecs); 254extern void idle_sleep(unsigned long long nsecs);
255extern int set_interval(void); 255extern int set_interval(void);
256extern int timer_one_shot(int ticks); 256extern int timer_one_shot(int ticks);
257extern unsigned long long disable_timer(void); 257extern long long disable_timer(void);
258extern void uml_idle_timer(void); 258extern void uml_idle_timer(void);
259extern unsigned long long os_nsecs(void); 259extern long long os_nsecs(void);
260 260
261/* skas/mem.c */ 261/* skas/mem.c */
262extern long run_syscall_stub(struct mm_id * mm_idp, 262extern long run_syscall_stub(struct mm_id * mm_idp,
diff --git a/arch/um/os-Linux/time.c b/arch/um/os-Linux/time.c
index d2cb161ae2b3..574b134f0502 100644
--- a/arch/um/os-Linux/time.c
+++ b/arch/um/os-Linux/time.c
@@ -39,7 +39,23 @@ int timer_one_shot(int ticks)
39 return 0; 39 return 0;
40} 40}
41 41
42unsigned long long disable_timer(void) 42/**
43 * timeval_to_ns - Convert timeval to nanoseconds
44 * @ts: pointer to the timeval variable to be converted
45 *
46 * Returns the scalar nanosecond representation of the timeval
47 * parameter.
48 *
49 * Ripped from linux/time.h because it's a kernel header, and thus
50 * unusable from here.
51 */
52static inline long long timeval_to_ns(const struct timeval *tv)
53{
54 return ((long long) tv->tv_sec * UM_NSEC_PER_SEC) +
55 tv->tv_usec * UM_NSEC_PER_USEC;
56}
57
58long long disable_timer(void)
43{ 59{
44 struct itimerval time = ((struct itimerval) { { 0, 0 }, { 0, 0 } }); 60 struct itimerval time = ((struct itimerval) { { 0, 0 }, { 0, 0 } });
45 61
@@ -47,10 +63,10 @@ unsigned long long disable_timer(void)
47 printk(UM_KERN_ERR "disable_timer - setitimer failed, " 63 printk(UM_KERN_ERR "disable_timer - setitimer failed, "
48 "errno = %d\n", errno); 64 "errno = %d\n", errno);
49 65
50 return tv_to_nsec(&time.it_value); 66 return timeval_to_ns(&time.it_value);
51} 67}
52 68
53unsigned long long os_nsecs(void) 69long long os_nsecs(void)
54{ 70{
55 struct timeval tv; 71 struct timeval tv;
56 72