lkml.org 
[lkml]   [2011]   [Mar]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [patch 28/28] posix clocks: Introduce dynamic clocks
On Tue, Feb 01, 2011 at 01:52:35PM -0000, Thomas Gleixner wrote:
> From: Richard Cochran <richardcochran@gmail.com>
>
> This patch adds support for adding and removing posix clocks. The
> clock lifetime cycle is patterned after usb devices. Each clock is
> represented by a standard character device. In addition, the driver
> may optionally implement custom character device operations.
>
> The posix clock and timer system calls listed below now work with
> dynamic posix clocks, as well as the traditional static clocks.
> The following system calls are affected:
>
> - clock_adjtime (brand new syscall)
> - clock_gettime
> - clock_getres
> - clock_settime
> - timer_create
> - timer_delete
> - timer_gettime
> - timer_settime
>
> [ tglx: Adapted to the posix-timer cleanup. Moved clock_posix_dynamic
> to posix-clock.c and made all referenced functions static ]
>
> Signed-off-by: Richard Cochran <richard.cochran@omicron.at>
> Cc: John Stultz <john.stultz@linaro.org>
> LKML-Reference: <21258f45fcc5e08a595f411c7760f3ccc18964bb.1296124770.git.richard.cochran@omicron.at>
> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
> ---
> include/linux/posix-clock.h | 150 ++++++++++++++
> include/linux/posix-timers.h | 6
> kernel/posix-timers.c | 4
> kernel/time/Makefile | 3
> kernel/time/posix-clock.c | 441 +++++++++++++++++++++++++++++++++++++++++++
> 5 files changed, 601 insertions(+), 3 deletions(-)
> create mode 100644 include/linux/posix-clock.h
> create mode 100644 kernel/time/posix-clock-syscalls.h
> create mode 100644 kernel/time/posix-clock.c



>
> +
> +static int pc_clock_adjtime(clockid_t id, struct timex *tx)
> +{
> + struct posix_clock_desc cd;
> + int err;
> +
> + err = get_clock_desc(id, &cd);
> + if (err)
> + return err;

there is no permission check here.
if i get the clock fd in READ mode, i can still adjtime.
same for settime.

> +
> + if (cd.clk->ops.clock_adjtime)
> + err = cd.clk->ops.clock_adjtime(cd.clk, tx);
> + else
> + err = -EOPNOTSUPP;
> +
> + put_clock_desc(&cd);
> +
> + return err;
> +}




--
torben Hohn


\
 
 \ /
  Last update: 2011-03-03 15:53    [W:0.240 / U:1.408 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site