aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Weinberger <richard@nod.at>2013-10-07 09:26:57 -0400
committerRichard Weinberger <richard@sigma-star.at>2014-08-06 07:03:44 -0400
commit828b1f65d23cf8a68795739f6dd08fc8abd9ee64 (patch)
treebb660d0c7a85e875f96f281729cb752184e1c7af
parent10b1c7ac8bfed429cf3dcb0225482c8dc1485d8e (diff)
Rip out get_signal_to_deliver()
Now we can turn get_signal() to the main function. Signed-off-by: Richard Weinberger <richard@nod.at>
-rw-r--r--include/linux/signal.h14
-rw-r--r--kernel/signal.c23
2 files changed, 13 insertions, 24 deletions
diff --git a/include/linux/signal.h b/include/linux/signal.h
index b005cc3dc1dc..750196fcc0a5 100644
--- a/include/linux/signal.h
+++ b/include/linux/signal.h
@@ -280,7 +280,7 @@ struct ksignal {
280 int sig; 280 int sig;
281}; 281};
282 282
283extern int get_signal_to_deliver(siginfo_t *info, struct k_sigaction *return_ka, struct pt_regs *regs, void *cookie); 283extern int get_signal(struct ksignal *ksig);
284extern void signal_setup_done(int failed, struct ksignal *ksig, int stepping); 284extern void signal_setup_done(int failed, struct ksignal *ksig, int stepping);
285extern void exit_signals(struct task_struct *tsk); 285extern void exit_signals(struct task_struct *tsk);
286extern void kernel_sigaction(int, __sighandler_t); 286extern void kernel_sigaction(int, __sighandler_t);
@@ -300,18 +300,6 @@ static inline void disallow_signal(int sig)
300 kernel_sigaction(sig, SIG_IGN); 300 kernel_sigaction(sig, SIG_IGN);
301} 301}
302 302
303/*
304 * Eventually that'll replace get_signal_to_deliver(); macro for now,
305 * to avoid nastiness with include order.
306 */
307#define get_signal(ksig) \
308({ \
309 struct ksignal *p = (ksig); \
310 p->sig = get_signal_to_deliver(&p->info, &p->ka, \
311 signal_pt_regs(), NULL);\
312 p->sig > 0; \
313})
314
315extern struct kmem_cache *sighand_cachep; 303extern struct kmem_cache *sighand_cachep;
316 304
317int unhandled_signal(struct task_struct *tsk, int sig); 305int unhandled_signal(struct task_struct *tsk, int sig);
diff --git a/kernel/signal.c b/kernel/signal.c
index 0d75cf875d44..5c6020040388 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -2166,8 +2166,7 @@ static int ptrace_signal(int signr, siginfo_t *info)
2166 return signr; 2166 return signr;
2167} 2167}
2168 2168
2169int get_signal_to_deliver(siginfo_t *info, struct k_sigaction *return_ka, 2169int get_signal(struct ksignal *ksig)
2170 struct pt_regs *regs, void *cookie)
2171{ 2170{
2172 struct sighand_struct *sighand = current->sighand; 2171 struct sighand_struct *sighand = current->sighand;
2173 struct signal_struct *signal = current->signal; 2172 struct signal_struct *signal = current->signal;
@@ -2237,13 +2236,13 @@ relock:
2237 goto relock; 2236 goto relock;
2238 } 2237 }
2239 2238
2240 signr = dequeue_signal(current, &current->blocked, info); 2239 signr = dequeue_signal(current, &current->blocked, &ksig->info);
2241 2240
2242 if (!signr) 2241 if (!signr)
2243 break; /* will return 0 */ 2242 break; /* will return 0 */
2244 2243
2245 if (unlikely(current->ptrace) && signr != SIGKILL) { 2244 if (unlikely(current->ptrace) && signr != SIGKILL) {
2246 signr = ptrace_signal(signr, info); 2245 signr = ptrace_signal(signr, &ksig->info);
2247 if (!signr) 2246 if (!signr)
2248 continue; 2247 continue;
2249 } 2248 }
@@ -2251,13 +2250,13 @@ relock:
2251 ka = &sighand->action[signr-1]; 2250 ka = &sighand->action[signr-1];
2252 2251
2253 /* Trace actually delivered signals. */ 2252 /* Trace actually delivered signals. */
2254 trace_signal_deliver(signr, info, ka); 2253 trace_signal_deliver(signr, &ksig->info, ka);
2255 2254
2256 if (ka->sa.sa_handler == SIG_IGN) /* Do nothing. */ 2255 if (ka->sa.sa_handler == SIG_IGN) /* Do nothing. */
2257 continue; 2256 continue;
2258 if (ka->sa.sa_handler != SIG_DFL) { 2257 if (ka->sa.sa_handler != SIG_DFL) {
2259 /* Run the handler. */ 2258 /* Run the handler. */
2260 *return_ka = *ka; 2259 ksig->ka = *ka;
2261 2260
2262 if (ka->sa.sa_flags & SA_ONESHOT) 2261 if (ka->sa.sa_flags & SA_ONESHOT)
2263 ka->sa.sa_handler = SIG_DFL; 2262 ka->sa.sa_handler = SIG_DFL;
@@ -2307,7 +2306,7 @@ relock:
2307 spin_lock_irq(&sighand->siglock); 2306 spin_lock_irq(&sighand->siglock);
2308 } 2307 }
2309 2308
2310 if (likely(do_signal_stop(info->si_signo))) { 2309 if (likely(do_signal_stop(ksig->info.si_signo))) {
2311 /* It released the siglock. */ 2310 /* It released the siglock. */
2312 goto relock; 2311 goto relock;
2313 } 2312 }
@@ -2328,7 +2327,7 @@ relock:
2328 2327
2329 if (sig_kernel_coredump(signr)) { 2328 if (sig_kernel_coredump(signr)) {
2330 if (print_fatal_signals) 2329 if (print_fatal_signals)
2331 print_fatal_signal(info->si_signo); 2330 print_fatal_signal(ksig->info.si_signo);
2332 proc_coredump_connector(current); 2331 proc_coredump_connector(current);
2333 /* 2332 /*
2334 * If it was able to dump core, this kills all 2333 * If it was able to dump core, this kills all
@@ -2338,17 +2337,19 @@ relock:
2338 * first and our do_group_exit call below will use 2337 * first and our do_group_exit call below will use
2339 * that value and ignore the one we pass it. 2338 * that value and ignore the one we pass it.
2340 */ 2339 */
2341 do_coredump(info); 2340 do_coredump(&ksig->info);
2342 } 2341 }
2343 2342
2344 /* 2343 /*
2345 * Death signals, no core dump. 2344 * Death signals, no core dump.
2346 */ 2345 */
2347 do_group_exit(info->si_signo); 2346 do_group_exit(ksig->info.si_signo);
2348 /* NOTREACHED */ 2347 /* NOTREACHED */
2349 } 2348 }
2350 spin_unlock_irq(&sighand->siglock); 2349 spin_unlock_irq(&sighand->siglock);
2351 return signr; 2350
2351 ksig->sig = signr;
2352 return ksig->sig > 0;
2352} 2353}
2353 2354
2354/** 2355/**