diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2012-05-02 09:59:21 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2012-06-01 12:58:48 -0400 |
commit | b7f9a11a6cf1ea9ee6be3eb2b90d91327a09ad14 (patch) | |
tree | 7d5a5f469aea8ac2b3e1ab41e05a6abafcb2b694 /arch/sh/kernel | |
parent | 51a7b448d4134e3e8eec633435e3e8faee14a828 (diff) |
new helper: sigmask_to_save()
replace boilerplate "should we use ->saved_sigmask or ->blocked?"
with calls of obvious inlined helper...
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'arch/sh/kernel')
-rw-r--r-- | arch/sh/kernel/signal_32.c | 11 | ||||
-rw-r--r-- | arch/sh/kernel/signal_64.c | 13 |
2 files changed, 7 insertions, 17 deletions
diff --git a/arch/sh/kernel/signal_32.c b/arch/sh/kernel/signal_32.c index 92f4173ad29..bfb3d599f03 100644 --- a/arch/sh/kernel/signal_32.c +++ b/arch/sh/kernel/signal_32.c | |||
@@ -524,8 +524,9 @@ handle_syscall_restart(unsigned long save_r0, struct pt_regs *regs, | |||
524 | */ | 524 | */ |
525 | static int | 525 | static int |
526 | handle_signal(unsigned long sig, struct k_sigaction *ka, siginfo_t *info, | 526 | handle_signal(unsigned long sig, struct k_sigaction *ka, siginfo_t *info, |
527 | sigset_t *oldset, struct pt_regs *regs, unsigned int save_r0) | 527 | struct pt_regs *regs, unsigned int save_r0) |
528 | { | 528 | { |
529 | sigset_t *oldset = sigmask_to_save(); | ||
529 | int ret; | 530 | int ret; |
530 | 531 | ||
531 | /* Set up the stack frame */ | 532 | /* Set up the stack frame */ |
@@ -554,7 +555,6 @@ static void do_signal(struct pt_regs *regs, unsigned int save_r0) | |||
554 | siginfo_t info; | 555 | siginfo_t info; |
555 | int signr; | 556 | int signr; |
556 | struct k_sigaction ka; | 557 | struct k_sigaction ka; |
557 | sigset_t *oldset; | ||
558 | 558 | ||
559 | /* | 559 | /* |
560 | * We want the common case to go fast, which | 560 | * We want the common case to go fast, which |
@@ -565,17 +565,12 @@ static void do_signal(struct pt_regs *regs, unsigned int save_r0) | |||
565 | if (!user_mode(regs)) | 565 | if (!user_mode(regs)) |
566 | return; | 566 | return; |
567 | 567 | ||
568 | if (current_thread_info()->status & TS_RESTORE_SIGMASK) | ||
569 | oldset = ¤t->saved_sigmask; | ||
570 | else | ||
571 | oldset = ¤t->blocked; | ||
572 | |||
573 | signr = get_signal_to_deliver(&info, &ka, regs, NULL); | 568 | signr = get_signal_to_deliver(&info, &ka, regs, NULL); |
574 | if (signr > 0) { | 569 | if (signr > 0) { |
575 | handle_syscall_restart(save_r0, regs, &ka.sa); | 570 | handle_syscall_restart(save_r0, regs, &ka.sa); |
576 | 571 | ||
577 | /* Whee! Actually deliver the signal. */ | 572 | /* Whee! Actually deliver the signal. */ |
578 | if (handle_signal(signr, &ka, &info, oldset, | 573 | if (handle_signal(signr, &ka, &info, |
579 | regs, save_r0) == 0) { | 574 | regs, save_r0) == 0) { |
580 | /* | 575 | /* |
581 | * A signal was successfully delivered; the saved | 576 | * A signal was successfully delivered; the saved |
diff --git a/arch/sh/kernel/signal_64.c b/arch/sh/kernel/signal_64.c index 6e191ef0aa6..cc22d2b2e3f 100644 --- a/arch/sh/kernel/signal_64.c +++ b/arch/sh/kernel/signal_64.c | |||
@@ -45,7 +45,7 @@ | |||
45 | 45 | ||
46 | static int | 46 | static int |
47 | handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka, | 47 | handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka, |
48 | sigset_t *oldset, struct pt_regs * regs); | 48 | struct pt_regs * regs); |
49 | 49 | ||
50 | static inline void | 50 | static inline void |
51 | handle_syscall_restart(struct pt_regs *regs, struct sigaction *sa) | 51 | handle_syscall_restart(struct pt_regs *regs, struct sigaction *sa) |
@@ -88,7 +88,6 @@ static void do_signal(struct pt_regs *regs) | |||
88 | siginfo_t info; | 88 | siginfo_t info; |
89 | int signr; | 89 | int signr; |
90 | struct k_sigaction ka; | 90 | struct k_sigaction ka; |
91 | sigset_t *oldset; | ||
92 | 91 | ||
93 | /* | 92 | /* |
94 | * We want the common case to go fast, which | 93 | * We want the common case to go fast, which |
@@ -99,17 +98,12 @@ static void do_signal(struct pt_regs *regs) | |||
99 | if (!user_mode(regs)) | 98 | if (!user_mode(regs)) |
100 | return; | 99 | return; |
101 | 100 | ||
102 | if (current_thread_info()->status & TS_RESTORE_SIGMASK) | ||
103 | oldset = ¤t->saved_sigmask; | ||
104 | else | ||
105 | oldset = ¤t->blocked; | ||
106 | |||
107 | signr = get_signal_to_deliver(&info, &ka, regs, 0); | 101 | signr = get_signal_to_deliver(&info, &ka, regs, 0); |
108 | if (signr > 0) { | 102 | if (signr > 0) { |
109 | handle_syscall_restart(regs, &ka.sa); | 103 | handle_syscall_restart(regs, &ka.sa); |
110 | 104 | ||
111 | /* Whee! Actually deliver the signal. */ | 105 | /* Whee! Actually deliver the signal. */ |
112 | if (handle_signal(signr, &info, &ka, oldset, regs) == 0) { | 106 | if (handle_signal(signr, &info, &ka, regs) == 0) { |
113 | /* | 107 | /* |
114 | * If a signal was successfully delivered, the | 108 | * If a signal was successfully delivered, the |
115 | * saved sigmask is in its frame, and we can | 109 | * saved sigmask is in its frame, and we can |
@@ -656,8 +650,9 @@ give_sigsegv: | |||
656 | */ | 650 | */ |
657 | static int | 651 | static int |
658 | handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka, | 652 | handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka, |
659 | sigset_t *oldset, struct pt_regs * regs) | 653 | struct pt_regs * regs) |
660 | { | 654 | { |
655 | sigset_t *oldset = sigmask_to_save(); | ||
661 | int ret; | 656 | int ret; |
662 | 657 | ||
663 | /* Set up the stack frame */ | 658 | /* Set up the stack frame */ |