diff options
Diffstat (limited to 'fs/timerfd.c')
-rw-r--r-- | fs/timerfd.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/fs/timerfd.c b/fs/timerfd.c index 0862f0e49d0c..b042bd7034b1 100644 --- a/fs/timerfd.c +++ b/fs/timerfd.c | |||
@@ -177,7 +177,7 @@ static struct file *timerfd_fget(int fd) | |||
177 | return file; | 177 | return file; |
178 | } | 178 | } |
179 | 179 | ||
180 | asmlinkage long sys_timerfd_create(int clockid, int flags) | 180 | SYSCALL_DEFINE2(timerfd_create, int, clockid, int, flags) |
181 | { | 181 | { |
182 | int ufd; | 182 | int ufd; |
183 | struct timerfd_ctx *ctx; | 183 | struct timerfd_ctx *ctx; |
@@ -186,10 +186,9 @@ asmlinkage long sys_timerfd_create(int clockid, int flags) | |||
186 | BUILD_BUG_ON(TFD_CLOEXEC != O_CLOEXEC); | 186 | BUILD_BUG_ON(TFD_CLOEXEC != O_CLOEXEC); |
187 | BUILD_BUG_ON(TFD_NONBLOCK != O_NONBLOCK); | 187 | BUILD_BUG_ON(TFD_NONBLOCK != O_NONBLOCK); |
188 | 188 | ||
189 | if (flags & ~(TFD_CLOEXEC | TFD_NONBLOCK)) | 189 | if ((flags & ~TFD_CREATE_FLAGS) || |
190 | return -EINVAL; | 190 | (clockid != CLOCK_MONOTONIC && |
191 | if (clockid != CLOCK_MONOTONIC && | 191 | clockid != CLOCK_REALTIME)) |
192 | clockid != CLOCK_REALTIME) | ||
193 | return -EINVAL; | 192 | return -EINVAL; |
194 | 193 | ||
195 | ctx = kzalloc(sizeof(*ctx), GFP_KERNEL); | 194 | ctx = kzalloc(sizeof(*ctx), GFP_KERNEL); |
@@ -201,16 +200,16 @@ asmlinkage long sys_timerfd_create(int clockid, int flags) | |||
201 | hrtimer_init(&ctx->tmr, clockid, HRTIMER_MODE_ABS); | 200 | hrtimer_init(&ctx->tmr, clockid, HRTIMER_MODE_ABS); |
202 | 201 | ||
203 | ufd = anon_inode_getfd("[timerfd]", &timerfd_fops, ctx, | 202 | ufd = anon_inode_getfd("[timerfd]", &timerfd_fops, ctx, |
204 | flags & (O_CLOEXEC | O_NONBLOCK)); | 203 | flags & TFD_SHARED_FCNTL_FLAGS); |
205 | if (ufd < 0) | 204 | if (ufd < 0) |
206 | kfree(ctx); | 205 | kfree(ctx); |
207 | 206 | ||
208 | return ufd; | 207 | return ufd; |
209 | } | 208 | } |
210 | 209 | ||
211 | asmlinkage long sys_timerfd_settime(int ufd, int flags, | 210 | SYSCALL_DEFINE4(timerfd_settime, int, ufd, int, flags, |
212 | const struct itimerspec __user *utmr, | 211 | const struct itimerspec __user *, utmr, |
213 | struct itimerspec __user *otmr) | 212 | struct itimerspec __user *, otmr) |
214 | { | 213 | { |
215 | struct file *file; | 214 | struct file *file; |
216 | struct timerfd_ctx *ctx; | 215 | struct timerfd_ctx *ctx; |
@@ -219,7 +218,8 @@ asmlinkage long sys_timerfd_settime(int ufd, int flags, | |||
219 | if (copy_from_user(&ktmr, utmr, sizeof(ktmr))) | 218 | if (copy_from_user(&ktmr, utmr, sizeof(ktmr))) |
220 | return -EFAULT; | 219 | return -EFAULT; |
221 | 220 | ||
222 | if (!timespec_valid(&ktmr.it_value) || | 221 | if ((flags & ~TFD_SETTIME_FLAGS) || |
222 | !timespec_valid(&ktmr.it_value) || | ||
223 | !timespec_valid(&ktmr.it_interval)) | 223 | !timespec_valid(&ktmr.it_interval)) |
224 | return -EINVAL; | 224 | return -EINVAL; |
225 | 225 | ||
@@ -265,7 +265,7 @@ asmlinkage long sys_timerfd_settime(int ufd, int flags, | |||
265 | return 0; | 265 | return 0; |
266 | } | 266 | } |
267 | 267 | ||
268 | asmlinkage long sys_timerfd_gettime(int ufd, struct itimerspec __user *otmr) | 268 | SYSCALL_DEFINE2(timerfd_gettime, int, ufd, struct itimerspec __user *, otmr) |
269 | { | 269 | { |
270 | struct file *file; | 270 | struct file *file; |
271 | struct timerfd_ctx *ctx; | 271 | struct timerfd_ctx *ctx; |