Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 234599
b: refs/heads/master
c: 26f9a47
h: refs/heads/master
i:
  234597: a14863d
  234595: 4340879
  234591: 524915e
v: v3
  • Loading branch information
Thomas Gleixner committed Feb 2, 2011
1 parent de3f2d8 commit ab31f34
Show file tree
Hide file tree
Showing 4 changed files with 13 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: 79c9da0d0539fb341a1b48a2a5a23d974726de90
refs/heads/master: 26f9a4796af330173d790c8d2b5e2efcc489e755
3 changes: 0 additions & 3 deletions trunk/include/linux/posix-timers.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,6 @@ extern struct k_clock clock_posix_cpu;

void register_posix_clock(const clockid_t clock_id, struct k_clock *new_clock);

/* error handlers for timer_create, nanosleep and settime */
int do_posix_clock_nosettime(const clockid_t, const struct timespec *tp);

/* function to call to trigger timer event */
int posix_timer_event(struct k_itimer *timr, int si_private);

Expand Down
2 changes: 0 additions & 2 deletions trunk/kernel/posix-cpu-timers.c
Original file line number Diff line number Diff line change
Expand Up @@ -1604,15 +1604,13 @@ static __init int init_posix_cpu_timers(void)
struct k_clock process = {
.clock_getres = process_cpu_clock_getres,
.clock_get = process_cpu_clock_get,
.clock_set = do_posix_clock_nosettime,
.timer_create = process_cpu_timer_create,
.nsleep = process_cpu_nsleep,
.nsleep_restart = process_cpu_nsleep_restart,
};
struct k_clock thread = {
.clock_getres = thread_cpu_clock_getres,
.clock_get = thread_cpu_clock_get,
.clock_set = do_posix_clock_nosettime,
.timer_create = thread_cpu_timer_create,
};
struct timespec ts;
Expand Down
31 changes: 12 additions & 19 deletions trunk/kernel/posix-timers.c
Original file line number Diff line number Diff line change
Expand Up @@ -199,12 +199,6 @@ static int common_clock_get(clockid_t which_clock, struct timespec *tp)
return 0;
}

static inline int common_clock_set(const clockid_t which_clock,
const struct timespec *tp)
{
return do_sys_settimeofday(tp, NULL);
}

static int common_timer_create(struct k_itimer *new_timer)
{
hrtimer_init(&new_timer->it.real.timer, new_timer->it_clock, 0);
Expand Down Expand Up @@ -232,6 +226,13 @@ static inline int invalid_clockid(const clockid_t which_clock)
return 1;
}

/* Set clock_realtime */
static int posix_clock_realtime_set(const clockid_t which_clock,
const struct timespec *tp)
{
return do_sys_settimeofday(tp, NULL);
}

/*
* Get monotonic time for posix timers
*/
Expand Down Expand Up @@ -276,32 +277,29 @@ static __init int init_posix_timers(void)
{
struct k_clock clock_realtime = {
.clock_getres = hrtimer_get_res,
.clock_set = posix_clock_realtime_set,
.nsleep = common_nsleep,
.nsleep_restart = hrtimer_nanosleep_restart,
};
struct k_clock clock_monotonic = {
.clock_getres = hrtimer_get_res,
.clock_get = posix_ktime_get_ts,
.clock_set = do_posix_clock_nosettime,
.nsleep = common_nsleep,
.nsleep_restart = hrtimer_nanosleep_restart,
};
struct k_clock clock_monotonic_raw = {
.clock_getres = hrtimer_get_res,
.clock_get = posix_get_monotonic_raw,
.clock_set = do_posix_clock_nosettime,
.timer_create = no_timer_create,
};
struct k_clock clock_realtime_coarse = {
.clock_getres = posix_get_coarse_res,
.clock_get = posix_get_realtime_coarse,
.clock_set = do_posix_clock_nosettime,
.timer_create = no_timer_create,
};
struct k_clock clock_monotonic_coarse = {
.clock_getres = posix_get_coarse_res,
.clock_get = posix_get_monotonic_coarse,
.clock_set = do_posix_clock_nosettime,
.timer_create = no_timer_create,
};

Expand Down Expand Up @@ -940,24 +938,19 @@ void exit_itimers(struct signal_struct *sig)
}
}

/* Not available / possible... functions */
int do_posix_clock_nosettime(const clockid_t clockid, const struct timespec *tp)
{
return -EINVAL;
}
EXPORT_SYMBOL_GPL(do_posix_clock_nosettime);

SYSCALL_DEFINE2(clock_settime, const clockid_t, which_clock,
const struct timespec __user *, tp)
{
struct k_clock *kc = clockid_to_kclock(which_clock);
struct timespec new_tp;

if (invalid_clockid(which_clock))
if (!kc || !kc->clock_set)
return -EINVAL;

if (copy_from_user(&new_tp, tp, sizeof (*tp)))
return -EFAULT;

return CLOCK_DISPATCH(which_clock, clock_set, (which_clock, &new_tp));
return kc->clock_set(which_clock, &new_tp);
}

SYSCALL_DEFINE2(clock_gettime, const clockid_t, which_clock,
Expand Down

0 comments on commit ab31f34

Please sign in to comment.