git://ftp.safe.ca
/
safe
/
jmp
/
linux-2.6
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
HWPOISON: mention HWPoison in Kconfig entry
[safe/jmp/linux-2.6]
/
fs
/
select.c
diff --git
a/fs/select.c
b/fs/select.c
index
8084834
..
fd38ce2
100644
(file)
--- a/
fs/select.c
+++ b/
fs/select.c
@@
-15,6
+15,7
@@
*/
#include <linux/kernel.h>
*/
#include <linux/kernel.h>
+#include <linux/sched.h>
#include <linux/syscalls.h>
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/syscalls.h>
#include <linux/module.h>
#include <linux/slab.h>
@@
-41,22
+42,28
@@
* better solutions..
*/
* better solutions..
*/
+#define MAX_SLACK (100 * NSEC_PER_MSEC)
+
static long __estimate_accuracy(struct timespec *tv)
{
long slack;
int divfactor = 1000;
static long __estimate_accuracy(struct timespec *tv)
{
long slack;
int divfactor = 1000;
+ if (tv->tv_sec < 0)
+ return 0;
+
if (task_nice(current) > 0)
divfactor = divfactor / 5;
if (task_nice(current) > 0)
divfactor = divfactor / 5;
+ if (tv->tv_sec > MAX_SLACK / (NSEC_PER_SEC/divfactor))
+ return MAX_SLACK;
+
slack = tv->tv_nsec / divfactor;
slack += tv->tv_sec * (NSEC_PER_SEC/divfactor);
slack = tv->tv_nsec / divfactor;
slack += tv->tv_sec * (NSEC_PER_SEC/divfactor);
- if (slack >
100 * NSEC_PER_MSEC
)
-
slack = 100 * NSEC_PER_MSEC
;
+ if (slack >
MAX_SLACK
)
+
return MAX_SLACK
;
- if (slack < 0)
- slack = 0;
return slack;
}
return slack;
}