X-Git-Url: http://pilppa.org/gitweb/gitweb.cgi?a=blobdiff_plain;f=fs%2Ftimerfd.c;h=c502c60e4f54ddfe6ac9402c2c550a274485b003;hb=012d1f4af1b07e5ccfcd23b7c1dcdcc30a068257;hp=5400524e9cb1d2b2e40bf810a1282277e54eec98;hpb=25a025863e024f6b86b48137b10b4960c50351b0;p=linux-2.6-omap-h63xx.git diff --git a/fs/timerfd.c b/fs/timerfd.c index 5400524e9cb..c502c60e4f5 100644 --- a/fs/timerfd.c +++ b/fs/timerfd.c @@ -181,12 +181,14 @@ static struct file *timerfd_fget(int fd) asmlinkage long sys_timerfd_create(int clockid, int flags) { - int error, ufd; + int ufd; struct timerfd_ctx *ctx; - struct file *file; - struct inode *inode; - 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) @@ -200,12 +202,10 @@ asmlinkage long sys_timerfd_create(int clockid, int flags) ctx->clockid = clockid; hrtimer_init(&ctx->tmr, clockid, HRTIMER_MODE_ABS); - error = anon_inode_getfd(&ufd, &inode, &file, "[timerfd]", - &timerfd_fops, ctx); - if (error) { + ufd = anon_inode_getfd("[timerfd]", &timerfd_fops, ctx, + flags & (O_CLOEXEC | O_NONBLOCK)); + if (ufd < 0) kfree(ctx); - return error; - } return ufd; }