lkml.org 
[lkml]   [1997]   [Jul]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Date
Subjectutime kernel patch fixed
Hi.

There are two bugs in the utime kernel patch for 2.1.43 you can find at
http://hegel.ittc.ukans.edu/projects/utime/ :

1) speed is improperly calculated, seems that 1 is blindly added without
further checks. My P5-100 and 150 give values of 101000000 and
151000000 respectively.

2) there is a bug in nanosleep, a modulo should really be a div:

diff -u -r -N -b --exclude-from=diff_exclude linux-ref/kernel/sched.c linux-work/kernel/sched.c
--- linux-ref/kernel/sched.c Thu Jun 12 18:22:10 1997
+++ linux-work/kernel/sched.c Mon Jul 7 04:36:14 1997
@@ -1492,6 +1700,29 @@
}
return -EINTR;
}
+
+#else
+ expire = t.tv_sec*HZ+jiffies;
+ expire_u = t.tv_nsec/1000+jiffies_u;
+ expire += expire_u % USEC_PER_JIFFIES;
^^^
should be:
+ expire += expire_u / USEC_PER_JIFFIES;
^^^
+ expire_u %= USEC_PER_JIFFIES;
+ current->timeout = expire;
+ current->timeout_u = expire_u;
+ current->state = TASK_INTERRUPTIBLE;
+ schedule();
+ if ((expire > jiffies)||((expire==jiffies)
+ && (expire_u > jiffies_u))) {
+ if (rmtp) {
+ t.tv_sec = (expire-jiffies)/HZ;
+ t.tv_nsec = (expire-jiffies)%HZ +
+ (expire_u-jiffies_u)*1000;
+ if (copy_to_user(rmtp, &t,
+ sizeof(struct timespec)))
+ return -EFAULT;
+ }
+ return -EINTR;
+ }
+#endif
return 0;
}
Note for dosemu developers: this patch doesn't change _anything_.

Alberto



\
 
 \ /
  Last update: 2005-03-22 13:39    [W:0.019 / U:1.404 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site