diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2012-11-07 15:09:38 -0500 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2013-02-03 15:09:25 -0500 |
commit | ca86b5dce213f52c7538932740f83cafb2c34547 (patch) | |
tree | 25d7e651fc9908523eccbb6c8b2843e1eeafa3f2 /include/linux/signal.h | |
parent | 9d94b9e2f354f79461aa674e75b0926d0e768db6 (diff) |
new helper: get_signal()
On success get_signal_to_deliver() fills k_sigaction and siginfo.
_All_ users pass it addresses of the local variables sitting in
the same function. Then they proceed to pass those addresses
pretty much in tandem to a bunch of helper functions; again, all
callers of those helpers are passing them such a pair, and one that
had been through get_signal_to_deliver() at that.
The obvious cleanup: introduce a new type that would contain a
<k_sigaction,siginfo> pair (struct ksignal) and begin switching to
using it. Turns out that it's convenient to store the signal number
in the same object.
New helper, taking that sucker is a wrapper for get_signal_to_deliver();
takes struct ksignal * and returns bool. On success fills ksignal
with the information for signal handler to be invoked.
For now it's a macro (to avoid header ordering headache), but eventually
it'll be a function in kernel/signal.c, with get_signal_to_deliver()
folded into it.
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'include/linux/signal.h')
-rw-r--r-- | include/linux/signal.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/include/linux/signal.h b/include/linux/signal.h index e28e8d455d6e..7c2744198dba 100644 --- a/include/linux/signal.h +++ b/include/linux/signal.h | |||
@@ -279,10 +279,28 @@ struct old_sigaction { | |||
279 | }; | 279 | }; |
280 | #endif | 280 | #endif |
281 | 281 | ||
282 | struct ksignal { | ||
283 | struct k_sigaction ka; | ||
284 | siginfo_t info; | ||
285 | int sig; | ||
286 | }; | ||
287 | |||
282 | extern int get_signal_to_deliver(siginfo_t *info, struct k_sigaction *return_ka, struct pt_regs *regs, void *cookie); | 288 | extern int get_signal_to_deliver(siginfo_t *info, struct k_sigaction *return_ka, struct pt_regs *regs, void *cookie); |
283 | extern void signal_delivered(int sig, siginfo_t *info, struct k_sigaction *ka, struct pt_regs *regs, int stepping); | 289 | extern void signal_delivered(int sig, siginfo_t *info, struct k_sigaction *ka, struct pt_regs *regs, int stepping); |
284 | extern void exit_signals(struct task_struct *tsk); | 290 | extern void exit_signals(struct task_struct *tsk); |
285 | 291 | ||
292 | /* | ||
293 | * Eventually that'll replace get_signal_to_deliver(); macro for now, | ||
294 | * to avoid nastiness with include order. | ||
295 | */ | ||
296 | #define get_signal(ksig) \ | ||
297 | ({ \ | ||
298 | struct ksignal *p = (ksig); \ | ||
299 | p->sig = get_signal_to_deliver(&p->info, &p->ka, \ | ||
300 | signal_pt_regs(), NULL);\ | ||
301 | p->sig > 0; \ | ||
302 | }) | ||
303 | |||
286 | extern struct kmem_cache *sighand_cachep; | 304 | extern struct kmem_cache *sighand_cachep; |
287 | 305 | ||
288 | int unhandled_signal(struct task_struct *tsk, int sig); | 306 | int unhandled_signal(struct task_struct *tsk, int sig); |