diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2009-04-04 17:01:06 -0400 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2009-04-30 13:24:24 -0400 |
commit | 62ab4505e3efaf67784f84059e0fb9cedb1728ea (patch) | |
tree | 54da8395eaf30a0386cd71214fbabe94ded229e2 /kernel | |
parent | 30b4ae8a4498543863501f707879b7220b649602 (diff) |
signals: implement sys_rt_tgsigqueueinfo
sys_kill has the per thread counterpart sys_tgkill. sigqueueinfo is
missing a thread directed counterpart. Such an interface is important
for migrating applications from other OSes which have the per thread
delivery implemented.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Oleg Nesterov <oleg@redhat.com>
Acked-by: Roland McGrath <roland@redhat.com>
Acked-by: Ulrich Drepper <drepper@redhat.com>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/compat.c | 11 | ||||
-rw-r--r-- | kernel/signal.c | 26 |
2 files changed, 37 insertions, 0 deletions
diff --git a/kernel/compat.c b/kernel/compat.c index 42d56544460f..f6c204f07ea6 100644 --- a/kernel/compat.c +++ b/kernel/compat.c | |||
@@ -882,6 +882,17 @@ compat_sys_rt_sigtimedwait (compat_sigset_t __user *uthese, | |||
882 | 882 | ||
883 | } | 883 | } |
884 | 884 | ||
885 | asmlinkage long | ||
886 | compat_sys_rt_tgsigqueueinfo(compat_pid_t tgid, compat_pid_t pid, int sig, | ||
887 | struct compat_siginfo __user *uinfo) | ||
888 | { | ||
889 | siginfo_t info; | ||
890 | |||
891 | if (copy_siginfo_from_user32(&info, uinfo)) | ||
892 | return -EFAULT; | ||
893 | return do_rt_tgsigqueueinfo(tgid, pid, sig, &info); | ||
894 | } | ||
895 | |||
885 | #ifdef __ARCH_WANT_COMPAT_SYS_TIME | 896 | #ifdef __ARCH_WANT_COMPAT_SYS_TIME |
886 | 897 | ||
887 | /* compat_time_t is a 32 bit "long" and needs to get converted. */ | 898 | /* compat_time_t is a 32 bit "long" and needs to get converted. */ |
diff --git a/kernel/signal.c b/kernel/signal.c index 56d27acad87e..f79b3b9f8375 100644 --- a/kernel/signal.c +++ b/kernel/signal.c | |||
@@ -2369,6 +2369,32 @@ SYSCALL_DEFINE3(rt_sigqueueinfo, pid_t, pid, int, sig, | |||
2369 | return kill_proc_info(sig, &info, pid); | 2369 | return kill_proc_info(sig, &info, pid); |
2370 | } | 2370 | } |
2371 | 2371 | ||
2372 | long do_rt_tgsigqueueinfo(pid_t tgid, pid_t pid, int sig, siginfo_t *info) | ||
2373 | { | ||
2374 | /* This is only valid for single tasks */ | ||
2375 | if (pid <= 0 || tgid <= 0) | ||
2376 | return -EINVAL; | ||
2377 | |||
2378 | /* Not even root can pretend to send signals from the kernel. | ||
2379 | Nor can they impersonate a kill(), which adds source info. */ | ||
2380 | if (info->si_code >= 0) | ||
2381 | return -EPERM; | ||
2382 | info->si_signo = sig; | ||
2383 | |||
2384 | return do_send_specific(tgid, pid, sig, info); | ||
2385 | } | ||
2386 | |||
2387 | SYSCALL_DEFINE4(rt_tgsigqueueinfo, pid_t, tgid, pid_t, pid, int, sig, | ||
2388 | siginfo_t __user *, uinfo) | ||
2389 | { | ||
2390 | siginfo_t info; | ||
2391 | |||
2392 | if (copy_from_user(&info, uinfo, sizeof(siginfo_t))) | ||
2393 | return -EFAULT; | ||
2394 | |||
2395 | return do_rt_tgsigqueueinfo(tgid, pid, sig, &info); | ||
2396 | } | ||
2397 | |||
2372 | int do_sigaction(int sig, struct k_sigaction *act, struct k_sigaction *oact) | 2398 | int do_sigaction(int sig, struct k_sigaction *act, struct k_sigaction *oact) |
2373 | { | 2399 | { |
2374 | struct task_struct *t = current; | 2400 | struct task_struct *t = current; |