public inbox for linux-arch@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/4] set_restore_sigmask
@ 2008-03-29  0:12 Roland McGrath
  2008-03-29  0:12 ` Roland McGrath
                   ` (2 more replies)
  0 siblings, 3 replies; 54+ messages in thread
From: Roland McGrath @ 2008-03-29  0:12 UTC (permalink / raw)
  To: Andrew Morton, Linus Torvalds
  Cc: Martin Schwidefsky, linux-s390, tony.luck, linux-ia64, linux-arch,
	linux-kernel

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 flag protocol details from all the calls.

Signed-off-by: Roland McGrath <roland@redhat.com>
---
 fs/compat.c                 |    6 +++---
 fs/eventpoll.c              |    3 +--
 fs/select.c                 |    4 ++--
 include/linux/thread_info.h |   15 ++++++++++++++-
 kernel/compat.c             |    3 +--
 kernel/signal.c             |    2 +-
 6 files changed, 22 insertions(+), 11 deletions(-)

diff --git a/fs/compat.c b/fs/compat.c
index 2ce4456..9964d54 100644
--- a/fs/compat.c
+++ b/fs/compat.c
@@ -1720,7 +1720,7 @@ sticky:
 		if (sigmask) {
 			memcpy(&current->saved_sigmask, &sigsaved,
 					sizeof(sigsaved));
-			set_thread_flag(TIF_RESTORE_SIGMASK);
+			set_restore_sigmask();
 		}
 	} else if (sigmask)
 		sigprocmask(SIG_SETMASK, &sigsaved, NULL);
@@ -1791,7 +1791,7 @@ asmlinkage long compat_sys_ppoll(struct pollfd __user *ufds,
 		if (sigmask) {
 			memcpy(&current->saved_sigmask, &sigsaved,
 				sizeof(sigsaved));
-			set_thread_flag(TIF_RESTORE_SIGMASK);
+			set_restore_sigmask();
 		}
 		ret = -ERESTARTNOHAND;
 	} else if (sigmask)
@@ -2117,7 +2117,7 @@ asmlinkage long compat_sys_epoll_pwait(int epfd,
 		if (err == -EINTR) {
 			memcpy(&current->saved_sigmask, &sigsaved,
 			       sizeof(sigsaved));
-			set_thread_flag(TIF_RESTORE_SIGMASK);
+			set_restore_sigmask();
 		} else
 			sigprocmask(SIG_SETMASK, &sigsaved, NULL);
 	}
diff --git a/fs/eventpoll.c b/fs/eventpoll.c
index a415f42..503ffa4 100644
--- a/fs/eventpoll.c
+++ b/fs/eventpoll.c
@@ -1300,7 +1300,7 @@ asmlinkage long sys_epoll_pwait(int epfd, struct epoll_event __user *events,
 		if (error == -EINTR) {
 			memcpy(&current->saved_sigmask, &sigsaved,
 			       sizeof(sigsaved));
-			set_thread_flag(TIF_RESTORE_SIGMASK);
+			set_restore_sigmask();
 		} else
 			sigprocmask(SIG_SETMASK, &sigsaved, NULL);
 	}
@@ -1330,4 +1330,3 @@ static int __init eventpoll_init(void)
 	return 0;
 }
 fs_initcall(eventpoll_init);
-
diff --git a/fs/select.c b/fs/select.c
index 5633fe9..bbd351c 100644
--- a/fs/select.c
+++ b/fs/select.c
@@ -498,7 +498,7 @@ sticky:
 		if (sigmask) {
 			memcpy(&current->saved_sigmask, &sigsaved,
 					sizeof(sigsaved));
-			set_thread_flag(TIF_RESTORE_SIGMASK);
+			set_restore_sigmask();
 		}
 	} else if (sigmask)
 		sigprocmask(SIG_SETMASK, &sigsaved, NULL);
@@ -805,7 +805,7 @@ asmlinkage long sys_ppoll(struct pollfd __user *ufds, unsigned int nfds,
 		if (sigmask) {
 			memcpy(&current->saved_sigmask, &sigsaved,
 					sizeof(sigsaved));
-			set_thread_flag(TIF_RESTORE_SIGMASK);
+			set_restore_sigmask();
 		}
 		ret = -ERESTARTNOHAND;
 	} else if (sigmask)
diff --git a/include/linux/thread_info.h b/include/linux/thread_info.h
index 421323e..d82c073 100644
--- a/include/linux/thread_info.h
+++ b/include/linux/thread_info.h
@@ -80,6 +80,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 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 */
diff --git a/kernel/compat.c b/kernel/compat.c
index 5f0e201..a830c84 100644
--- a/kernel/compat.c
+++ b/kernel/compat.c
@@ -899,7 +899,7 @@ asmlinkage long compat_sys_rt_sigsuspend(compat_sigset_t __user *unewset, compat
 
 	current->state = TASK_INTERRUPTIBLE;
 	schedule();
-	set_thread_flag(TIF_RESTORE_SIGMASK);
+	set_restore_sigmask();
 	return -ERESTARTNOHAND;
 }
 #endif /* __ARCH_WANT_COMPAT_SYS_RT_SIGSUSPEND */
@@ -1081,4 +1081,3 @@ compat_sys_sysinfo(struct compat_sysinfo __user *info)
 
 	return 0;
 }
-
diff --git a/kernel/signal.c b/kernel/signal.c
index 6af1210..977b3cd 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -2610,7 +2610,7 @@ asmlinkage long sys_rt_sigsuspend(sigset_t __user *unewset, size_t sigsetsize)
 
 	current->state = TASK_INTERRUPTIBLE;
 	schedule();
-	set_thread_flag(TIF_RESTORE_SIGMASK);
+	set_restore_sigmask();
 	return -ERESTARTNOHAND;
 }
 #endif /* __ARCH_WANT_SYS_RT_SIGSUSPEND */

^ permalink raw reply related	[flat|nested] 54+ messages in thread

end of thread, other threads:[~2008-04-11 13:41 UTC | newest]

Thread overview: 54+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-29  0:12 [PATCH 1/4] set_restore_sigmask Roland McGrath
2008-03-29  0:12 ` Roland McGrath
     [not found] ` <20080329001230.D013726FA1D-nL1rrgvulkcB9AHHLWeGtNQXobZC6xk2@public.gmane.org>
2008-03-29  0:13   ` [PATCH 2/4] set_restore_sigmask TIF_SIGPENDING Roland McGrath
2008-03-29  0:13     ` Roland McGrath
     [not found]     ` <20080329001341.7F93826FA1D-nL1rrgvulkcB9AHHLWeGtNQXobZC6xk2@public.gmane.org>
2008-03-29  0:53       ` Linus Torvalds
2008-03-29  0:53         ` Linus Torvalds
     [not found]         ` <alpine.LFD.1.00.0803281746480.14670-5CScLwifNT1QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org>
2008-03-29  2:24           ` Roland McGrath
2008-03-29  2:24             ` Roland McGrath
2008-03-29  2:52             ` Linus Torvalds
2008-03-29  2:52               ` Linus Torvalds
     [not found]               ` <alpine.LFD.1.00.0803281942440.14670-5CScLwifNT1QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org>
2008-03-29  3:12                 ` Roland McGrath
2008-03-29  3:12                   ` Roland McGrath
     [not found]             ` <20080329022408.0DD4726FA1D-nL1rrgvulkcB9AHHLWeGtNQXobZC6xk2@public.gmane.org>
2008-03-29  3:11               ` [PATCH 1/2] HAVE_SET_RESTORE_SIGMASK Roland McGrath
2008-03-29  3:11                 ` Roland McGrath
2008-04-09 11:45                 ` David Woodhouse
2008-04-09 11:45                   ` David Woodhouse
2008-04-10 20:32                   ` Russell King
2008-04-10 20:32                     ` Russell King
     [not found]                     ` <20080410203250.GA21589-f404yB8NqCZvn6HldHNs0ANdhmdF6hFW@public.gmane.org>
2008-04-11 13:40                       ` David Woodhouse
2008-04-11 13:40                         ` David Woodhouse
2008-03-29  3:14             ` Roland McGrath
2008-03-29  3:14               ` Roland McGrath
2008-03-29  3:14               ` [PATCH 2/2] x86 TS_RESTORE_SIGMASK Roland McGrath
2008-03-29  3:14                 ` Roland McGrath
2008-03-31 13:01                 ` Ingo Molnar
2008-03-31 13:01                   ` Ingo Molnar
2008-03-31 19:30                   ` Roland McGrath
2008-03-31 19:30                     ` Roland McGrath
2008-03-30 10:53           ` [PATCH 2/4] set_restore_sigmask TIF_SIGPENDING Paul Mackerras
2008-03-30 10:53             ` Paul Mackerras
2008-04-08 11:35           ` Oleg Nesterov
2008-04-08 11:35             ` Oleg Nesterov
     [not found]             ` <20080408113519.GA227-6lXkIZvqkOAvJsYlp49lxw@public.gmane.org>
2008-04-08 14:53               ` Linus Torvalds
2008-04-08 14:53                 ` Linus Torvalds
2008-04-08 19:51               ` Roland McGrath
2008-04-08 19:51                 ` Roland McGrath
2008-04-09 11:16             ` David Woodhouse
2008-04-09 11:16               ` David Woodhouse
     [not found]               ` <1207739787.27048.57.camel-Fexsq3y4057IgHVZqg5X0TlWvGAXklZc@public.gmane.org>
2008-04-09 11:39                 ` Oleg Nesterov
2008-04-09 11:39                   ` Oleg Nesterov
2008-04-09 12:57                   ` Petr Tesarik
2008-04-09 12:57                     ` Petr Tesarik
     [not found]                   ` <20080409113939.GA99-6lXkIZvqkOAvJsYlp49lxw@public.gmane.org>
2008-04-09 16:14                     ` David Woodhouse
2008-04-09 16:14                       ` David Woodhouse
2008-04-09 16:22                       ` Oleg Nesterov
2008-04-09 16:22                         ` Oleg Nesterov
2008-04-09 18:40                         ` David Woodhouse
2008-04-09 18:40                           ` David Woodhouse
2008-03-29  0:14   ` [PATCH 3/4] s390 renumber TIF_RESTORE_SIGMASK Roland McGrath
2008-03-29  0:14     ` Roland McGrath
2008-03-31  7:53     ` Martin Schwidefsky
2008-03-31  7:53       ` Martin Schwidefsky
2008-03-29  0:14 ` [PATCH 4/4] ia64 " Roland McGrath
2008-03-29  0:14   ` Roland McGrath

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox