diff options
Diffstat (limited to 'fs/signalfd.c')
-rw-r--r-- | fs/signalfd.c | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/fs/signalfd.c b/fs/signalfd.c index 619725644c75..9c39bc7f8431 100644 --- a/fs/signalfd.c +++ b/fs/signalfd.c | |||
@@ -205,11 +205,19 @@ static const struct file_operations signalfd_fops = { | |||
205 | .read = signalfd_read, | 205 | .read = signalfd_read, |
206 | }; | 206 | }; |
207 | 207 | ||
208 | asmlinkage long sys_signalfd(int ufd, sigset_t __user *user_mask, size_t sizemask) | 208 | asmlinkage long sys_signalfd4(int ufd, sigset_t __user *user_mask, |
209 | size_t sizemask, int flags) | ||
209 | { | 210 | { |
210 | sigset_t sigmask; | 211 | sigset_t sigmask; |
211 | struct signalfd_ctx *ctx; | 212 | struct signalfd_ctx *ctx; |
212 | 213 | ||
214 | /* Check the SFD_* constants for consistency. */ | ||
215 | BUILD_BUG_ON(SFD_CLOEXEC != O_CLOEXEC); | ||
216 | BUILD_BUG_ON(SFD_NONBLOCK != O_NONBLOCK); | ||
217 | |||
218 | if (flags & ~(SFD_CLOEXEC | SFD_NONBLOCK)) | ||
219 | return -EINVAL; | ||
220 | |||
213 | if (sizemask != sizeof(sigset_t) || | 221 | if (sizemask != sizeof(sigset_t) || |
214 | copy_from_user(&sigmask, user_mask, sizeof(sigmask))) | 222 | copy_from_user(&sigmask, user_mask, sizeof(sigmask))) |
215 | return -EINVAL; | 223 | return -EINVAL; |
@@ -227,7 +235,8 @@ asmlinkage long sys_signalfd(int ufd, sigset_t __user *user_mask, size_t sizemas | |||
227 | * When we call this, the initialization must be complete, since | 235 | * When we call this, the initialization must be complete, since |
228 | * anon_inode_getfd() will install the fd. | 236 | * anon_inode_getfd() will install the fd. |
229 | */ | 237 | */ |
230 | ufd = anon_inode_getfd("[signalfd]", &signalfd_fops, ctx); | 238 | ufd = anon_inode_getfd("[signalfd]", &signalfd_fops, ctx, |
239 | flags & (O_CLOEXEC | O_NONBLOCK)); | ||
231 | if (ufd < 0) | 240 | if (ufd < 0) |
232 | kfree(ctx); | 241 | kfree(ctx); |
233 | } else { | 242 | } else { |
@@ -249,3 +258,9 @@ asmlinkage long sys_signalfd(int ufd, sigset_t __user *user_mask, size_t sizemas | |||
249 | 258 | ||
250 | return ufd; | 259 | return ufd; |
251 | } | 260 | } |
261 | |||
262 | asmlinkage long sys_signalfd(int ufd, sigset_t __user *user_mask, | ||
263 | size_t sizemask) | ||
264 | { | ||
265 | return sys_signalfd4(ufd, user_mask, sizemask, 0); | ||
266 | } | ||