aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2011-02-02 05:45:23 -0500
committerThomas Gleixner <tglx@linutronix.de>2011-02-02 09:28:15 -0500
commit4359ac0ace1a2a267927390ad27f781a2f8e0ab8 (patch)
tree01a77aa7afece2932d7838dffdc1a0aa0e8b6aac /kernel
parent42285777631aa0654fbb6442057b3e176445c6c5 (diff)
posix-timers: Make clock_getres and clock_get mandatory
Richard said: "I would think that we can require k_clocks to provide the read function. This could be checked and enforced in register_posix_clock()." Add checks for clock_getres and clock_get in the register function. Suggested-by: Richard Cochran <richardcochran@gmail.com> Cc: John Stultz <johnstul@us.ibm.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/posix-timers.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/kernel/posix-timers.c b/kernel/posix-timers.c
index d9e5edfe8a1b..7f66143d1ce5 100644
--- a/kernel/posix-timers.c
+++ b/kernel/posix-timers.c
@@ -485,7 +485,18 @@ static struct pid *good_sigevent(sigevent_t * event)
485void register_posix_clock(const clockid_t clock_id, struct k_clock *new_clock) 485void register_posix_clock(const clockid_t clock_id, struct k_clock *new_clock)
486{ 486{
487 if ((unsigned) clock_id >= MAX_CLOCKS) { 487 if ((unsigned) clock_id >= MAX_CLOCKS) {
488 printk("POSIX clock register failed for clock_id %d\n", 488 printk(KERN_WARNING "POSIX clock register failed for clock_id %d\n",
489 clock_id);
490 return;
491 }
492
493 if (!new_clock->clock_get) {
494 printk(KERN_WARNING "POSIX clock id %d lacks clock_get()\n",
495 clock_id);
496 return;
497 }
498 if (!new_clock->clock_getres) {
499 printk(KERN_WARNING "POSIX clock id %d lacks clock_getres()\n",
489 clock_id); 500 clock_id);
490 return; 501 return;
491 } 502 }
@@ -961,8 +972,6 @@ SYSCALL_DEFINE2(clock_gettime, const clockid_t, which_clock,
961 972
962 if (!kc) 973 if (!kc)
963 return -EINVAL; 974 return -EINVAL;
964 if (!kc->clock_get)
965 return -EOPNOTSUPP;
966 975
967 error = kc->clock_get(which_clock, &kernel_tp); 976 error = kc->clock_get(which_clock, &kernel_tp);
968 977