Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 24098
b: refs/heads/master
c: 3b98a53
h: refs/heads/master
v: v3
  • Loading branch information
Roman Zippel authored and Linus Torvalds committed Mar 26, 2006
1 parent 0498076 commit ac804ef
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 25 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: 44f21475511bbc0135b52c66ad74dcc6a9026da3
refs/heads/master: 3b98a5328171cebc867f70484b20bd34948cd7f6
50 changes: 26 additions & 24 deletions trunk/kernel/posix-timers.c
Original file line number Diff line number Diff line change
Expand Up @@ -608,39 +608,41 @@ static struct k_itimer * lock_timer(timer_t timer_id, unsigned long *flags)
static void
common_timer_get(struct k_itimer *timr, struct itimerspec *cur_setting)
{
ktime_t remaining;
ktime_t now, remaining, iv;
struct hrtimer *timer = &timr->it.real.timer;

memset(cur_setting, 0, sizeof(struct itimerspec));
remaining = hrtimer_get_remaining(timer);

/* Time left ? or timer pending */
if (remaining.tv64 > 0 || hrtimer_active(timer))
goto calci;
iv = timr->it.real.interval;

/* interval timer ? */
if (timr->it.real.interval.tv64 == 0)
if (iv.tv64)
cur_setting->it_interval = ktime_to_timespec(iv);
else if (!hrtimer_active(timer) &&
(timr->it_sigev_notify & ~SIGEV_THREAD_ID) != SIGEV_NONE)
return;

now = timer->base->get_time();

/*
* When a requeue is pending or this is a SIGEV_NONE timer
* move the expiry time forward by intervals, so expiry is >
* now.
* When a requeue is pending or this is a SIGEV_NONE
* timer move the expiry time forward by intervals, so
* expiry is > now.
*/
if (timr->it_requeue_pending & REQUEUE_PENDING ||
(timr->it_sigev_notify & ~SIGEV_THREAD_ID) == SIGEV_NONE) {
timr->it_overrun +=
hrtimer_forward(timer, timer->base->get_time(),
timr->it.real.interval);
remaining = hrtimer_get_remaining(timer);
}
calci:
/* interval timer ? */
if (timr->it.real.interval.tv64 != 0)
cur_setting->it_interval =
ktime_to_timespec(timr->it.real.interval);
if (iv.tv64 && (timr->it_requeue_pending & REQUEUE_PENDING ||
(timr->it_sigev_notify & ~SIGEV_THREAD_ID) == SIGEV_NONE))
timr->it_overrun += hrtimer_forward(timer, now, iv);

remaining = ktime_sub(timer->expires, now);
/* Return 0 only, when the timer is expired and not pending */
if (remaining.tv64 <= 0)
cur_setting->it_value.tv_nsec = 1;
else
if (remaining.tv64 <= 0) {
/*
* A single shot SIGEV_NONE timer must return 0, when
* it is expired !
*/
if ((timr->it_sigev_notify & ~SIGEV_THREAD_ID) != SIGEV_NONE)
cur_setting->it_value.tv_nsec = 1;
} else
cur_setting->it_value = ktime_to_timespec(remaining);
}

Expand Down

0 comments on commit ac804ef

Please sign in to comment.