Patch for timespec vs. timeval in 2.6
Looks to me that timespec and timeval got confused in 2.6, by the way of an extern declaration in a C file. I'm not sure if this is a problem, but the attached patch makes me more comfortable. Only you might want to correct the comment.
-- Pete
arch/um/include/time_user.h +3 -1
@@ -6,7 +6,9 @@#ifndef __TIME_USER_H__#define __TIME_USER_H__ -extern void timer (void ); +/* struct timeval has the same layout in user and kernel */ +extern void timer (struct timeval *tv); +extern void switch_timers (int to_real);extern void set_interval (int timer_type);extern void idle_sleep (int secs);
arch/um/kernel/time.c +8 -5
@@ -23,14 +23,17 @@*/ extern struct timespec wall_to_monotonic; -extern struct timeval xtime; -struct timeval local_offset = {0 ,0 }; -void timer (void ) +/* +* This is just a way to cross user-kernel boundary. +* For the moment, it is almost the same as do_gettimeofday, but non-locking. +* It may get different if guest time ever diverges from host time. +*/ +void timer (struct timeval *tv) { -gettimeofday (&xtime,NULL ); -timeradd (&xtime, &local_offset, &xtime); +gettimeofday (tv,NULL ); +timeradd (tv, &local_offset, tv); }void set_interval (int timer_type)
arch/um/kernel/time_kern.c +4 -1
@@ -97,10 +97,13 @@irqreturn_t um_timer (int irq,void *dev,struct pt_regs *regs) {unsigned long flags; +struct timeval timeb;do_timer (regs);write_seqlock_irqsave (&xtime_lock, flags); -timer (); +timer (&timeb); + xtime.tv_sec = timeb.tv_sec; + xtime.tv_nsec = timeb.tv_usec *1000 ;write_sequnlock_irqrestore (&xtime_lock, flags);return (IRQ_HANDLED ); }
-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials Free Linux tutorial presented by Daniel Robbins, President and CEO of GenToo technologies. Learn everything from fundamentals to system administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
_______________________________________________
User-mode-linux-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel