From: Thomas Gleixner <tglx@linutronix.de>
To: LKML <linux-kernel@vger.kernel.org>
Cc: Ingo Molnar <mingo@elte.hu>, Ulrich Drepper <drepper@redhat.com>,
Roland McGrath <roland@redhat.com>,
Oleg Nesterov <oleg@tv-sign.ru>,
Michael Kerrisk <mtk.manpages@googlemail.com>
Subject: [RFC patch 2/3] signals: implement sys_rt_tgsigqueueinfo
Date: Tue, 30 Sep 2008 19:49:00 -0000 [thread overview]
Message-ID: <20080930194516.891475378@linutronix.de> (raw)
In-Reply-To: 20080930194445.978351700@linutronix.de
[-- Attachment #1: signals-implement-rt-tgsigqueueinfo.patch --]
[-- Type: text/plain, Size: 1319 bytes --]
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>
---
kernel/signal.c | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
Index: linux-2.6-tip/kernel/signal.c
===================================================================
--- linux-2.6-tip.orig/kernel/signal.c
+++ linux-2.6-tip/kernel/signal.c
@@ -2307,6 +2307,27 @@ sys_rt_sigqueueinfo(pid_t pid, int sig,
return kill_proc_info(sig, &info, pid);
}
+asmlinkage long
+sys_rt_tgsigqueueinfo(pid_t tgid, pid_t pid, int sig, siginfo_t __user *uinfo)
+{
+ siginfo_t info;
+
+ /* This is only valid for single tasks */
+ if (pid <= 0 || tgid <= 0)
+ return -EINVAL;
+
+ if (copy_from_user(&info, uinfo, sizeof(siginfo_t)))
+ return -EFAULT;
+
+ /* Not even root can pretend to send signals from the kernel.
+ Nor can they impersonate a kill(), which adds source info. */
+ if (info.si_code >= 0)
+ return -EPERM;
+ info.si_signo = sig;
+
+ return do_send_specific(tgid, pid, sig, &info);
+}
+
int do_sigaction(int sig, struct k_sigaction *act, struct k_sigaction *oact)
{
struct task_struct *t = current;
next prev parent reply other threads:[~2008-09-30 19:49 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-09-30 19:48 [RFC patch 0/3] signals: add rt_tgsigqueueinfo syscall Thomas Gleixner
2008-09-30 19:48 ` [RFC patch 1/3] signals: split do_tkill Thomas Gleixner
2008-09-30 19:49 ` Thomas Gleixner [this message]
2008-09-30 19:49 ` [RFC patch 3/3] x86: hookup sys_rt_tgsigqueueinfo Thomas Gleixner
2008-10-01 6:39 ` [RFC patch 0/3] signals: add rt_tgsigqueueinfo syscall Roland McGrath
2008-10-01 7:51 ` Thomas Gleixner
2008-10-07 13:49 ` Michael Kerrisk
2008-10-07 20:21 ` Roland McGrath
2008-10-08 2:50 ` Michael Kerrisk
-- strict thread matches above, loose matches on Subject: below --
2008-10-01 10:01 [RFC patch 0/3] signals: add rt_tgsigqueueinfo syscall V2 Thomas Gleixner
2008-10-01 10:01 ` [RFC patch 2/3] signals: implement sys_rt_tgsigqueueinfo Thomas Gleixner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20080930194516.891475378@linutronix.de \
--to=tglx@linutronix.de \
--cc=drepper@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=mtk.manpages@googlemail.com \
--cc=oleg@tv-sign.ru \
--cc=roland@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox