public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: akpm@osdl.org, ghoward@sgi.com, ayoung@sgi.com
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH 1/3] snsc: switch from force_sig to kill_proc
Date: Sat, 8 Jul 2006 20:05:50 +0200	[thread overview]
Message-ID: <20060708180550.GA7034@lst.de> (raw)

currently the snsc driver uses force_sig to send init a SIGPWR
when the system overheats.  This patch switches it to kill_proc
instead which has the following advantages:

 (1) gets rid of one of the last remaining tasklist_lock users
     in modular code
 (2) simplifies the snsc code significantly

The downside is that an init implementation could in theory block
SIGPWR and it would not get delivered.  The sysvinit code used by
all major distributions doesn't do this and blocking this signal
in init would be a rather stupid thing to do.


Signed-off-by: Christoph Hellwig <hch@lst.de>

Index: linux-2.6/drivers/char/snsc_event.c
===================================================================
--- linux-2.6.orig/drivers/char/snsc_event.c	2006-07-08 13:13:28.000000000 +0200
+++ linux-2.6/drivers/char/snsc_event.c	2006-07-08 13:14:21.000000000 +0200
@@ -220,20 +220,7 @@
 			       " Sending SIGPWR to init...\n");
 
 		/* give a SIGPWR signal to init proc */
-
-		/* first find init's task */
-		read_lock(&tasklist_lock);
-		for_each_process(p) {
-			if (p->pid == 1)
-				break;
-		}
-		if (p) {
-			force_sig(SIGPWR, p);
-		} else {
-			printk(KERN_ERR "Failed to signal init!\n");
-			snsc_shutting_down = 0; /* so can try again (?) */
-		}
-		read_unlock(&tasklist_lock);
+		kill_proc(1, SIGPWR, 0);
 	} else {
 		/* print to system log */
 		printk("%s|$(0x%x)%s\n", severity, esp_code, desc);

                 reply	other threads:[~2006-07-08 18:06 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20060708180550.GA7034@lst.de \
    --to=hch@lst.de \
    --cc=akpm@osdl.org \
    --cc=ayoung@sgi.com \
    --cc=ghoward@sgi.com \
    --cc=linux-kernel@vger.kernel.org \
    /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