From: Davide Libenzi <davidel@xmailserver.org>
To: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Cc: Michael Kerrisk <mtk.manpages@gmail.com>,
Thomas Gleixner <tglx@linutronix.de>,
Andrew Morton <akpm@linux-foundation.org>
Subject: [patch 2/2] timerfd extend clockid support
Date: Sun, 8 Feb 2009 15:23:23 -0800 (PST) [thread overview]
Message-ID: <alpine.DEB.1.10.0902081510150.18839@alien.or.mcafeemobile.com> (raw)
The following patch extends timerfd clockid support to cover the ones
supported by timer_create().
It exports the invalid_clockid() function outside posix-timers.c to allow
timerfd to properly check input parameters.
Andrew, this is (eventually) .30 material, and do not take the patch
until you have Thomas sign off.
Thomas, timerfd uses core hrtimer functions for its tasks. By extending
the clockid support, I assume that the clockids other than CLOCK_MONOTONIC
and CLOCK_REALTIME, behaves the same from a hrtimer caller POV. Right?
Signed-off-by: Davide Libenzi <davidel@xmailserver.org>
- Davide
---
fs/timerfd.c | 3 +--
include/linux/posix-timers.h | 1 +
kernel/posix-timers.c | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
Index: linux-2.6.mod/fs/timerfd.c
===================================================================
--- linux-2.6.mod.orig/fs/timerfd.c 2009-02-08 15:02:06.000000000 -0800
+++ linux-2.6.mod/fs/timerfd.c 2009-02-08 15:03:43.000000000 -0800
@@ -187,8 +187,7 @@ SYSCALL_DEFINE2(timerfd_create, int, clo
BUILD_BUG_ON(TFD_NONBLOCK != O_NONBLOCK);
if ((flags & ~TFD_CREATE_FLAGS) ||
- (clockid != CLOCK_MONOTONIC &&
- clockid != CLOCK_REALTIME))
+ invalid_clockid(clockid))
return -EINVAL;
ctx = kzalloc(sizeof(*ctx), GFP_KERNEL);
Index: linux-2.6.mod/include/linux/posix-timers.h
===================================================================
--- linux-2.6.mod.orig/include/linux/posix-timers.h 2009-02-08 15:02:06.000000000 -0800
+++ linux-2.6.mod/include/linux/posix-timers.h 2009-02-08 15:02:53.000000000 -0800
@@ -84,6 +84,7 @@ struct k_clock {
struct itimerspec * cur_setting);
};
+int invalid_clockid(const clockid_t which_clock);
void register_posix_clock(const clockid_t clock_id, struct k_clock *new_clock);
/* error handlers for timer_create, nanosleep and settime */
Index: linux-2.6.mod/kernel/posix-timers.c
===================================================================
--- linux-2.6.mod.orig/kernel/posix-timers.c 2009-02-08 15:02:06.000000000 -0800
+++ linux-2.6.mod/kernel/posix-timers.c 2009-02-08 15:02:53.000000000 -0800
@@ -205,7 +205,7 @@ static int no_timer_create(struct k_itim
/*
* Return nonzero if we know a priori this clockid_t value is bogus.
*/
-static inline int invalid_clockid(const clockid_t which_clock)
+int invalid_clockid(const clockid_t which_clock)
{
if (which_clock < 0) /* CPU clock, posix_cpu_* will check it */
return 0;
next reply other threads:[~2009-02-08 23:23 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-02-08 23:23 Davide Libenzi [this message]
2009-02-09 9:28 ` Michael Kerrisk
2009-02-09 17:42 ` Davide Libenzi
2009-02-09 19:28 ` Michael Kerrisk
2009-02-09 20:10 ` Davide Libenzi
2009-02-09 23:01 ` Michael Kerrisk
2009-02-09 23:03 ` Michael Kerrisk
2009-02-09 23:23 ` Davide Libenzi
2009-02-09 23:25 ` Michael Kerrisk
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=alpine.DEB.1.10.0902081510150.18839@alien.or.mcafeemobile.com \
--to=davidel@xmailserver.org \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mtk.manpages@gmail.com \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®