diff options
author | Cedric Le Goater <clg@fr.ibm.com> | 2006-10-02 05:19:00 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-10-02 10:57:25 -0400 |
commit | 9ec52099e4b8678a60e9f93e41ad87885d64f3e6 (patch) | |
tree | a68fe051b39f8f8e8be469cbd3c2f653b9b71a9d /arch/mips | |
parent | 1a657f78dcc8ea7c53eaa1f2a45ea2315738c15f (diff) |
[PATCH] replace cad_pid by a struct pid
There are a few places in the kernel where the init task is signaled. The
ctrl+alt+del sequence is one them. It kills a task, usually init, using a
cached pid (cad_pid).
This patch replaces the pid_t by a struct pid to avoid pid wrap around
problem. The struct pid is initialized at boot time in init() and can be
modified through systctl with
/proc/sys/kernel/cad_pid
[ I haven't found any distro using it ? ]
It also introduces a small helper routine kill_cad_pid() which is used
where it seemed ok to use cad_pid instead of pid 1.
[akpm@osdl.org: cleanups, build fix]
Signed-off-by: Cedric Le Goater <clg@fr.ibm.com>
Cc: Eric W. Biederman <ebiederm@xmission.com>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Paul Mackerras <paulus@samba.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch/mips')
-rw-r--r-- | arch/mips/sgi-ip22/ip22-reset.c | 3 | ||||
-rw-r--r-- | arch/mips/sgi-ip32/ip32-reset.c | 2 |
2 files changed, 3 insertions, 2 deletions
diff --git a/arch/mips/sgi-ip22/ip22-reset.c b/arch/mips/sgi-ip22/ip22-reset.c index 8134220ed600..7a941ecff3bb 100644 --- a/arch/mips/sgi-ip22/ip22-reset.c +++ b/arch/mips/sgi-ip22/ip22-reset.c | |||
@@ -123,7 +123,8 @@ static inline void power_button(void) | |||
123 | if (machine_state & MACHINE_PANICED) | 123 | if (machine_state & MACHINE_PANICED) |
124 | return; | 124 | return; |
125 | 125 | ||
126 | if ((machine_state & MACHINE_SHUTTING_DOWN) || kill_proc(1,SIGINT,1)) { | 126 | if ((machine_state & MACHINE_SHUTTING_DOWN) || |
127 | kill_cad_pid(SIGINT, 1)) { | ||
127 | /* No init process or button pressed twice. */ | 128 | /* No init process or button pressed twice. */ |
128 | sgi_machine_power_off(); | 129 | sgi_machine_power_off(); |
129 | } | 130 | } |
diff --git a/arch/mips/sgi-ip32/ip32-reset.c b/arch/mips/sgi-ip32/ip32-reset.c index 79ddb4605659..fd0932b2d521 100644 --- a/arch/mips/sgi-ip32/ip32-reset.c +++ b/arch/mips/sgi-ip32/ip32-reset.c | |||
@@ -120,7 +120,7 @@ static inline void ip32_power_button(void) | |||
120 | if (has_panicked) | 120 | if (has_panicked) |
121 | return; | 121 | return; |
122 | 122 | ||
123 | if (shuting_down || kill_proc(1, SIGINT, 1)) { | 123 | if (shuting_down || kill_cad_pid(SIGINT, 1)) { |
124 | /* No init process or button pressed twice. */ | 124 | /* No init process or button pressed twice. */ |
125 | ip32_machine_power_off(); | 125 | ip32_machine_power_off(); |
126 | } | 126 | } |