aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/sched.h
diff options
context:
space:
mode:
authorCedric Le Goater <clg@fr.ibm.com>2006-10-02 05:19:00 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-10-02 10:57:25 -0400
commit9ec52099e4b8678a60e9f93e41ad87885d64f3e6 (patch)
treea68fe051b39f8f8e8be469cbd3c2f653b9b71a9d /include/linux/sched.h
parent1a657f78dcc8ea7c53eaa1f2a45ea2315738c15f (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 'include/linux/sched.h')
-rw-r--r--include/linux/sched.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 9ba959e34266..38530232d92f 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -1065,6 +1065,8 @@ static inline int is_init(struct task_struct *tsk)
1065 return tsk->pid == 1; 1065 return tsk->pid == 1;
1066} 1066}
1067 1067
1068extern struct pid *cad_pid;
1069
1068extern void free_task(struct task_struct *tsk); 1070extern void free_task(struct task_struct *tsk);
1069#define get_task_struct(tsk) do { atomic_inc(&(tsk)->usage); } while(0) 1071#define get_task_struct(tsk) do { atomic_inc(&(tsk)->usage); } while(0)
1070 1072
@@ -1292,6 +1294,11 @@ extern int send_group_sigqueue(int, struct sigqueue *, struct task_struct *);
1292extern int do_sigaction(int, struct k_sigaction *, struct k_sigaction *); 1294extern int do_sigaction(int, struct k_sigaction *, struct k_sigaction *);
1293extern int do_sigaltstack(const stack_t __user *, stack_t __user *, unsigned long); 1295extern int do_sigaltstack(const stack_t __user *, stack_t __user *, unsigned long);
1294 1296
1297static inline int kill_cad_pid(int sig, int priv)
1298{
1299 return kill_pid(cad_pid, sig, priv);
1300}
1301
1295/* These can be the second arg to send_sig_info/send_group_sig_info. */ 1302/* These can be the second arg to send_sig_info/send_group_sig_info. */
1296#define SEND_SIG_NOINFO ((struct siginfo *) 0) 1303#define SEND_SIG_NOINFO ((struct siginfo *) 0)
1297#define SEND_SIG_PRIV ((struct siginfo *) 1) 1304#define SEND_SIG_PRIV ((struct siginfo *) 1)