Commit 4e4c22c7 authored by Roland McGrath's avatar Roland McGrath Committed by Linus Torvalds

signals: add set_restore_sigmask

This adds the set_restore_sigmask() inline in <linux/thread_info.h> and
replaces every set_thread_flag(TIF_RESTORE_SIGMASK) with a call to it.  No
change, but abstracts the details of the flag protocol from all the calls.
Signed-off-by: default avatarRoland McGrath <roland@redhat.com>
Cc: Oleg Nesterov <oleg@tv-sign.ru>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: "Luck, Tony" <tony.luck@intel.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 80fe728d
...@@ -1720,7 +1720,7 @@ asmlinkage long compat_sys_pselect7(int n, compat_ulong_t __user *inp, ...@@ -1720,7 +1720,7 @@ asmlinkage long compat_sys_pselect7(int n, compat_ulong_t __user *inp,
if (sigmask) { if (sigmask) {
memcpy(&current->saved_sigmask, &sigsaved, memcpy(&current->saved_sigmask, &sigsaved,
sizeof(sigsaved)); sizeof(sigsaved));
set_thread_flag(TIF_RESTORE_SIGMASK); set_restore_sigmask();
} }
} else if (sigmask) } else if (sigmask)
sigprocmask(SIG_SETMASK, &sigsaved, NULL); sigprocmask(SIG_SETMASK, &sigsaved, NULL);
...@@ -1791,7 +1791,7 @@ asmlinkage long compat_sys_ppoll(struct pollfd __user *ufds, ...@@ -1791,7 +1791,7 @@ asmlinkage long compat_sys_ppoll(struct pollfd __user *ufds,
if (sigmask) { if (sigmask) {
memcpy(&current->saved_sigmask, &sigsaved, memcpy(&current->saved_sigmask, &sigsaved,
sizeof(sigsaved)); sizeof(sigsaved));
set_thread_flag(TIF_RESTORE_SIGMASK); set_restore_sigmask();
} }
ret = -ERESTARTNOHAND; ret = -ERESTARTNOHAND;
} else if (sigmask) } else if (sigmask)
...@@ -2117,7 +2117,7 @@ asmlinkage long compat_sys_epoll_pwait(int epfd, ...@@ -2117,7 +2117,7 @@ asmlinkage long compat_sys_epoll_pwait(int epfd,
if (err == -EINTR) { if (err == -EINTR) {
memcpy(&current->saved_sigmask, &sigsaved, memcpy(&current->saved_sigmask, &sigsaved,
sizeof(sigsaved)); sizeof(sigsaved));
set_thread_flag(TIF_RESTORE_SIGMASK); set_restore_sigmask();
} else } else
sigprocmask(SIG_SETMASK, &sigsaved, NULL); sigprocmask(SIG_SETMASK, &sigsaved, NULL);
} }
......
...@@ -1279,7 +1279,7 @@ asmlinkage long sys_epoll_pwait(int epfd, struct epoll_event __user *events, ...@@ -1279,7 +1279,7 @@ asmlinkage long sys_epoll_pwait(int epfd, struct epoll_event __user *events,
if (error == -EINTR) { if (error == -EINTR) {
memcpy(&current->saved_sigmask, &sigsaved, memcpy(&current->saved_sigmask, &sigsaved,
sizeof(sigsaved)); sizeof(sigsaved));
set_thread_flag(TIF_RESTORE_SIGMASK); set_restore_sigmask();
} else } else
sigprocmask(SIG_SETMASK, &sigsaved, NULL); sigprocmask(SIG_SETMASK, &sigsaved, NULL);
} }
...@@ -1309,4 +1309,3 @@ static int __init eventpoll_init(void) ...@@ -1309,4 +1309,3 @@ static int __init eventpoll_init(void)
return 0; return 0;
} }
fs_initcall(eventpoll_init); fs_initcall(eventpoll_init);
...@@ -498,7 +498,7 @@ asmlinkage long sys_pselect7(int n, fd_set __user *inp, fd_set __user *outp, ...@@ -498,7 +498,7 @@ asmlinkage long sys_pselect7(int n, fd_set __user *inp, fd_set __user *outp,
if (sigmask) { if (sigmask) {
memcpy(&current->saved_sigmask, &sigsaved, memcpy(&current->saved_sigmask, &sigsaved,
sizeof(sigsaved)); sizeof(sigsaved));
set_thread_flag(TIF_RESTORE_SIGMASK); set_restore_sigmask();
} }
} else if (sigmask) } else if (sigmask)
sigprocmask(SIG_SETMASK, &sigsaved, NULL); sigprocmask(SIG_SETMASK, &sigsaved, NULL);
...@@ -805,7 +805,7 @@ asmlinkage long sys_ppoll(struct pollfd __user *ufds, unsigned int nfds, ...@@ -805,7 +805,7 @@ asmlinkage long sys_ppoll(struct pollfd __user *ufds, unsigned int nfds,
if (sigmask) { if (sigmask) {
memcpy(&current->saved_sigmask, &sigsaved, memcpy(&current->saved_sigmask, &sigsaved,
sizeof(sigsaved)); sizeof(sigsaved));
set_thread_flag(TIF_RESTORE_SIGMASK); set_restore_sigmask();
} }
ret = -ERESTARTNOHAND; ret = -ERESTARTNOHAND;
} else if (sigmask) } else if (sigmask)
......
...@@ -92,6 +92,19 @@ static inline int test_ti_thread_flag(struct thread_info *ti, int flag) ...@@ -92,6 +92,19 @@ static inline int test_ti_thread_flag(struct thread_info *ti, int flag)
#define set_need_resched() set_thread_flag(TIF_NEED_RESCHED) #define set_need_resched() set_thread_flag(TIF_NEED_RESCHED)
#define clear_need_resched() clear_thread_flag(TIF_NEED_RESCHED) #define clear_need_resched() clear_thread_flag(TIF_NEED_RESCHED)
#endif #ifdef TIF_RESTORE_SIGMASK
/**
* set_restore_sigmask() - make sure saved_sigmask processing gets done
*
* This sets TIF_RESTORE_SIGMASK and ensures that the arch signal code
* will run before returning to user mode, to process the flag.
*/
static inline void set_restore_sigmask(void)
{
set_thread_flag(TIF_RESTORE_SIGMASK);
}
#endif /* TIF_RESTORE_SIGMASK */
#endif /* __KERNEL__ */
#endif /* _LINUX_THREAD_INFO_H */ #endif /* _LINUX_THREAD_INFO_H */
...@@ -898,7 +898,7 @@ asmlinkage long compat_sys_rt_sigsuspend(compat_sigset_t __user *unewset, compat ...@@ -898,7 +898,7 @@ asmlinkage long compat_sys_rt_sigsuspend(compat_sigset_t __user *unewset, compat
current->state = TASK_INTERRUPTIBLE; current->state = TASK_INTERRUPTIBLE;
schedule(); schedule();
set_thread_flag(TIF_RESTORE_SIGMASK); set_restore_sigmask();
return -ERESTARTNOHAND; return -ERESTARTNOHAND;
} }
#endif /* __ARCH_WANT_COMPAT_SYS_RT_SIGSUSPEND */ #endif /* __ARCH_WANT_COMPAT_SYS_RT_SIGSUSPEND */
...@@ -1080,4 +1080,3 @@ compat_sys_sysinfo(struct compat_sysinfo __user *info) ...@@ -1080,4 +1080,3 @@ compat_sys_sysinfo(struct compat_sysinfo __user *info)
return 0; return 0;
} }
...@@ -2541,7 +2541,7 @@ asmlinkage long sys_rt_sigsuspend(sigset_t __user *unewset, size_t sigsetsize) ...@@ -2541,7 +2541,7 @@ asmlinkage long sys_rt_sigsuspend(sigset_t __user *unewset, size_t sigsetsize)
current->state = TASK_INTERRUPTIBLE; current->state = TASK_INTERRUPTIBLE;
schedule(); schedule();
set_thread_flag(TIF_RESTORE_SIGMASK); set_restore_sigmask();
return -ERESTARTNOHAND; return -ERESTARTNOHAND;
} }
#endif /* __ARCH_WANT_SYS_RT_SIGSUSPEND */ #endif /* __ARCH_WANT_SYS_RT_SIGSUSPEND */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment