Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 105414
b: refs/heads/master
c: 9deb27b
h: refs/heads/master
v: v3
  • Loading branch information
Ulrich Drepper authored and Linus Torvalds committed Jul 24, 2008
1 parent 73b0982 commit 5cefd1b
Show file tree
Hide file tree
Showing 10 changed files with 35 additions and 7 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 7d9dbca34240ebb6ff88d8a29c6c7bffd098f0c1
refs/heads/master: 9deb27baedb79759c3ab9435a7d8b841842d56e9
1 change: 1 addition & 0 deletions trunk/arch/x86/ia32/ia32entry.S
Original file line number Diff line number Diff line change
Expand Up @@ -826,4 +826,5 @@ ia32_sys_call_table:
.quad sys32_fallocate
.quad compat_sys_timerfd_settime /* 325 */
.quad compat_sys_timerfd_gettime
.quad compat_sys_signalfd4
ia32_syscall_end:
1 change: 1 addition & 0 deletions trunk/arch/x86/kernel/syscall_table_32.S
Original file line number Diff line number Diff line change
Expand Up @@ -326,3 +326,4 @@ ENTRY(sys_call_table)
.long sys_fallocate
.long sys_timerfd_settime /* 325 */
.long sys_timerfd_gettime
.long sys_signalfd4
14 changes: 10 additions & 4 deletions trunk/fs/compat.c
Original file line number Diff line number Diff line change
Expand Up @@ -2131,9 +2131,9 @@ asmlinkage long compat_sys_epoll_pwait(int epfd,

#ifdef CONFIG_SIGNALFD

asmlinkage long compat_sys_signalfd(int ufd,
const compat_sigset_t __user *sigmask,
compat_size_t sigsetsize)
asmlinkage long compat_sys_signalfd4(int ufd,
const compat_sigset_t __user *sigmask,
compat_size_t sigsetsize, int flags)
{
compat_sigset_t ss32;
sigset_t tmp;
Expand All @@ -2148,9 +2148,15 @@ asmlinkage long compat_sys_signalfd(int ufd,
if (copy_to_user(ksigmask, &tmp, sizeof(sigset_t)))
return -EFAULT;

return sys_signalfd(ufd, ksigmask, sizeof(sigset_t));
return sys_signalfd4(ufd, ksigmask, sizeof(sigset_t), flags);
}

asmlinkage long compat_sys_signalfd(int ufd,
const compat_sigset_t __user *sigmask,
compat_size_t sigsetsize)
{
return compat_sys_signalfd4(ufd, sigmask, sigsetsize, 0);
}
#endif /* CONFIG_SIGNALFD */

#ifdef CONFIG_TIMERFD
Expand Down
14 changes: 12 additions & 2 deletions trunk/fs/signalfd.c
Original file line number Diff line number Diff line change
Expand Up @@ -205,11 +205,15 @@ static const struct file_operations signalfd_fops = {
.read = signalfd_read,
};

asmlinkage long sys_signalfd(int ufd, sigset_t __user *user_mask, size_t sizemask)
asmlinkage long sys_signalfd4(int ufd, sigset_t __user *user_mask,
size_t sizemask, int flags)
{
sigset_t sigmask;
struct signalfd_ctx *ctx;

if (flags & ~SFD_CLOEXEC)
return -EINVAL;

if (sizemask != sizeof(sigset_t) ||
copy_from_user(&sigmask, user_mask, sizeof(sigmask)))
return -EINVAL;
Expand All @@ -228,7 +232,7 @@ asmlinkage long sys_signalfd(int ufd, sigset_t __user *user_mask, size_t sizemas
* anon_inode_getfd() will install the fd.
*/
ufd = anon_inode_getfd("[signalfd]", &signalfd_fops, ctx,
0);
flags & O_CLOEXEC);
if (ufd < 0)
kfree(ctx);
} else {
Expand All @@ -250,3 +254,9 @@ asmlinkage long sys_signalfd(int ufd, sigset_t __user *user_mask, size_t sizemas

return ufd;
}

asmlinkage long sys_signalfd(int ufd, sigset_t __user *user_mask,
size_t sizemask)
{
return sys_signalfd4(ufd, user_mask, sizemask, 0);
}
1 change: 1 addition & 0 deletions trunk/include/asm-x86/unistd_32.h
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,7 @@
#define __NR_fallocate 324
#define __NR_timerfd_settime 325
#define __NR_timerfd_gettime 326
#define __NR_signalfd4 327

#ifdef __KERNEL__

Expand Down
2 changes: 2 additions & 0 deletions trunk/include/asm-x86/unistd_64.h
Original file line number Diff line number Diff line change
Expand Up @@ -641,6 +641,8 @@ __SYSCALL(__NR_timerfd_settime, sys_timerfd_settime)
__SYSCALL(__NR_timerfd_gettime, sys_timerfd_gettime)
#define __NR_paccept 288
__SYSCALL(__NR_paccept, sys_paccept)
#define __NR_signalfd4 289
__SYSCALL(__NR_signalfd4, sys_signalfd4)


#ifndef __NO_STUBS
Expand Down
5 changes: 5 additions & 0 deletions trunk/include/linux/signalfd.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@
#ifndef _LINUX_SIGNALFD_H
#define _LINUX_SIGNALFD_H

/* For O_CLOEXEC */
#include <linux/fcntl.h>

/* Flags for signalfd4. */
#define SFD_CLOEXEC O_CLOEXEC

struct signalfd_siginfo {
__u32 ssi_signo;
Expand Down
1 change: 1 addition & 0 deletions trunk/include/linux/syscalls.h
Original file line number Diff line number Diff line change
Expand Up @@ -610,6 +610,7 @@ asmlinkage long sys_set_robust_list(struct robust_list_head __user *head,
size_t len);
asmlinkage long sys_getcpu(unsigned __user *cpu, unsigned __user *node, struct getcpu_cache __user *cache);
asmlinkage long sys_signalfd(int ufd, sigset_t __user *user_mask, size_t sizemask);
asmlinkage long sys_signalfd4(int ufd, sigset_t __user *user_mask, size_t sizemask, int flags);
asmlinkage long sys_timerfd_create(int clockid, int flags);
asmlinkage long sys_timerfd_settime(int ufd, int flags,
const struct itimerspec __user *utmr,
Expand Down
1 change: 1 addition & 0 deletions trunk/kernel/sys_ni.c
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ cond_syscall(sys_ioprio_get);

/* New file descriptors */
cond_syscall(sys_signalfd);
cond_syscall(sys_signalfd4);
cond_syscall(compat_sys_signalfd);
cond_syscall(sys_timerfd_create);
cond_syscall(sys_timerfd_settime);
Expand Down

0 comments on commit 5cefd1b

Please sign in to comment.