]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - fs/timerfd.c
Merge git://git.kernel.org/pub/scm/linux/kernel/git/viro/bdev
[linux-2.6-omap-h63xx.git] / fs / timerfd.c
index d87d354ec42438a4a0794cf964999eb376053c73..c502c60e4f54ddfe6ac9402c2c550a274485b003 100644 (file)
@@ -184,7 +184,11 @@ asmlinkage long sys_timerfd_create(int clockid, int flags)
        int ufd;
        struct timerfd_ctx *ctx;
 
-       if (flags)
+       /* Check the TFD_* constants for consistency.  */
+       BUILD_BUG_ON(TFD_CLOEXEC != O_CLOEXEC);
+       BUILD_BUG_ON(TFD_NONBLOCK != O_NONBLOCK);
+
+       if (flags & ~(TFD_CLOEXEC | TFD_NONBLOCK))
                return -EINVAL;
        if (clockid != CLOCK_MONOTONIC &&
            clockid != CLOCK_REALTIME)
@@ -198,7 +202,8 @@ asmlinkage long sys_timerfd_create(int clockid, int flags)
        ctx->clockid = clockid;
        hrtimer_init(&ctx->tmr, clockid, HRTIMER_MODE_ABS);
 
-       ufd = anon_inode_getfd("[timerfd]", &timerfd_fops, ctx);
+       ufd = anon_inode_getfd("[timerfd]", &timerfd_fops, ctx,
+                              flags & (O_CLOEXEC | O_NONBLOCK));
        if (ufd < 0)
                kfree(ctx);