Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 232725
b: refs/heads/master
c: 0781b90
h: refs/heads/master
i:
  232723: 28c5f0c
v: v3
  • Loading branch information
Eric Dumazet authored and Linus Torvalds committed Feb 3, 2011
1 parent f05ee46 commit 92dd7e1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 48db54ee2f41e8ae2faf330b55db34a9fffb5b3c
refs/heads/master: 0781b909b5586f4db720b5d1838b78f9d8e42f14
16 changes: 13 additions & 3 deletions trunk/fs/eventpoll.c
Original file line number Diff line number Diff line change
Expand Up @@ -1114,19 +1114,29 @@ static int ep_send_events(struct eventpoll *ep,
return ep_scan_ready_list(ep, ep_send_events_proc, &esed);
}

static inline struct timespec ep_set_mstimeout(long ms)
{
struct timespec now, ts = {
.tv_sec = ms / MSEC_PER_SEC,
.tv_nsec = NSEC_PER_MSEC * (ms % MSEC_PER_SEC),
};

ktime_get_ts(&now);
return timespec_add_safe(now, ts);
}

static int ep_poll(struct eventpoll *ep, struct epoll_event __user *events,
int maxevents, long timeout)
{
int res, eavail, timed_out = 0;
unsigned long flags;
long slack;
wait_queue_t wait;
struct timespec end_time;
ktime_t expires, *to = NULL;

if (timeout > 0) {
ktime_get_ts(&end_time);
timespec_add_ns(&end_time, (u64)timeout * NSEC_PER_MSEC);
struct timespec end_time = ep_set_mstimeout(timeout);

slack = select_estimate_accuracy(&end_time);
to = &expires;
*to = timespec_to_ktime(end_time);
Expand Down

0 comments on commit 92dd7e1

Please sign in to comment.