linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
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 1/3] signals: split do_tkill
Date: Wed, 01 Oct 2008 10:01:35 -0000	[thread overview]
Message-ID: <20081001095412.116951386@linutronix.de> (raw)
In-Reply-To: 20081001095204.343984413@linutronix.de

[-- Attachment #1: signals-split-do-tkill.patch --]
[-- Type: text/plain, Size: 2132 bytes --]

Split out the code from do_tkill to make it reusable by the follow up
patch which implements sys_rt_tgsigqueueinfo

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
 kernel/signal.c |   31 ++++++++++++++++++++-----------
 1 file changed, 20 insertions(+), 11 deletions(-)

Index: linux-2.6-tip/kernel/signal.c
===================================================================
--- linux-2.6-tip.orig/kernel/signal.c
+++ linux-2.6-tip/kernel/signal.c
@@ -2212,24 +2212,20 @@ sys_kill(pid_t pid, int sig)
 	return kill_something_info(sig, &info, pid);
 }
 
-static int do_tkill(pid_t tgid, pid_t pid, int sig)
+static int
+do_send_specific(pid_t tgid, pid_t pid, int sig, struct siginfo *info)
 {
-	int error;
-	struct siginfo info;
 	struct task_struct *p;
 	unsigned long flags;
+	int error = -ESRCH;
 
-	error = -ESRCH;
-	info.si_signo = sig;
-	info.si_errno = 0;
-	info.si_code = SI_TKILL;
-	info.si_pid = task_tgid_vnr(current);
-	info.si_uid = current->uid;
+	info->si_pid = task_tgid_vnr(current);
+	info->si_uid = current->uid;
 
 	rcu_read_lock();
 	p = find_task_by_vpid(pid);
 	if (p && (tgid <= 0 || task_tgid_vnr(p) == tgid)) {
-		error = check_kill_permission(sig, &info, p);
+		error = check_kill_permission(sig, info, p);
 		/*
 		 * The null signal is a permissions and process existence
 		 * probe.  No signal is actually delivered.
@@ -2239,7 +2235,7 @@ static int do_tkill(pid_t tgid, pid_t pi
 		 * signal is private anyway.
 		 */
 		if (!error && sig && lock_task_sighand(p, &flags)) {
-			error = specific_send_sig_info(sig, &info, p);
+			error = specific_send_sig_info(sig, info, p);
 			unlock_task_sighand(p, &flags);
 		}
 	}
@@ -2248,6 +2244,19 @@ static int do_tkill(pid_t tgid, pid_t pi
 	return error;
 }
 
+static int do_tkill(pid_t tgid, pid_t pid, int sig)
+{
+	struct siginfo info;
+
+	info.si_signo = sig;
+	info.si_errno = 0;
+	info.si_code = SI_TKILL;
+	info.si_pid = task_tgid_vnr(current);
+	info.si_uid = current->uid;
+
+	return do_send_specific(tgid, pid, sig, &info);
+}
+
 /**
  *  sys_tgkill - send signal to one specific thread
  *  @tgid: the thread group ID of the thread



  reply	other threads:[~2008-10-01 10:02 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-01 10:01 [RFC patch 0/3] signals: add rt_tgsigqueueinfo syscall V2 Thomas Gleixner
2008-10-01 10:01 ` Thomas Gleixner [this message]
2008-10-01 10:01 ` [RFC patch 2/3] signals: implement sys_rt_tgsigqueueinfo Thomas Gleixner
2008-10-01 10:01 ` [RFC patch 3/3] x86: hookup sys_rt_tgsigqueueinfo Thomas Gleixner
2008-10-01 14:57 ` [RFC patch 0/3] signals: add rt_tgsigqueueinfo syscall V2 Michael Kerrisk
2008-10-02  8:57   ` Thomas Gleixner
2008-10-08  9:49     ` Michael Kerrisk
2008-10-01 17:39 ` Roland McGrath
2008-10-02  8:45   ` Ingo Molnar
  -- strict thread matches above, loose matches on Subject: below --
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

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=20081001095412.116951386@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;
as well as URLs for NNTP newsgroup(s).