diff options
author | Cedric Le Goater <clg@fr.ibm.com> | 2006-12-08 05:37:54 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.osdl.org> | 2006-12-08 11:28:51 -0500 |
commit | 937949d9edbf4049bd41af6c9f92c26280584564 (patch) | |
tree | d0a28f503b082f890cfa1f7fe952fda8fc771752 /drivers/char | |
parent | ef55d53caa055aedee13e77da82740987dd64f2d (diff) |
[PATCH] add process_session() helper routine
Replace occurences of task->signal->session by a new process_session() helper
routine.
It will be useful for pid namespaces to abstract the session pid number.
Signed-off-by: Cedric Le Goater <clg@fr.ibm.com>
Cc: Kirill Korotaev <dev@openvz.org>
Cc: Eric W. Biederman <ebiederm@xmission.com>
Cc: Herbert Poetzl <herbert@13thfloor.at>
Cc: Sukadev Bhattiprolu <sukadev@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/char')
-rw-r--r-- | drivers/char/mxser.c | 2 | ||||
-rw-r--r-- | drivers/char/rocket.c | 2 | ||||
-rw-r--r-- | drivers/char/tty_io.c | 12 |
3 files changed, 8 insertions, 8 deletions
diff --git a/drivers/char/mxser.c b/drivers/char/mxser.c index 5ed2486b7581..b1cc89c89820 100644 --- a/drivers/char/mxser.c +++ b/drivers/char/mxser.c | |||
@@ -994,7 +994,7 @@ static int mxser_open(struct tty_struct *tty, struct file *filp) | |||
994 | mxser_change_speed(info, NULL); | 994 | mxser_change_speed(info, NULL); |
995 | } | 995 | } |
996 | 996 | ||
997 | info->session = current->signal->session; | 997 | info->session = process_session(current); |
998 | info->pgrp = process_group(current); | 998 | info->pgrp = process_group(current); |
999 | 999 | ||
1000 | /* | 1000 | /* |
diff --git a/drivers/char/rocket.c b/drivers/char/rocket.c index bac80056f7e0..4fdf52e9f3b1 100644 --- a/drivers/char/rocket.c +++ b/drivers/char/rocket.c | |||
@@ -1017,7 +1017,7 @@ static int rp_open(struct tty_struct *tty, struct file *filp) | |||
1017 | /* | 1017 | /* |
1018 | * Info->count is now 1; so it's safe to sleep now. | 1018 | * Info->count is now 1; so it's safe to sleep now. |
1019 | */ | 1019 | */ |
1020 | info->session = current->signal->session; | 1020 | info->session = process_session(current); |
1021 | info->pgrp = process_group(current); | 1021 | info->pgrp = process_group(current); |
1022 | 1022 | ||
1023 | if ((info->flags & ROCKET_INITIALIZED) == 0) { | 1023 | if ((info->flags & ROCKET_INITIALIZED) == 0) { |
diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c index 8a2d26e98ac4..4ebba7ca1dc9 100644 --- a/drivers/char/tty_io.c +++ b/drivers/char/tty_io.c | |||
@@ -1511,7 +1511,7 @@ void disassociate_ctty(int on_exit) | |||
1511 | 1511 | ||
1512 | spin_lock_irq(¤t->sighand->siglock); | 1512 | spin_lock_irq(¤t->sighand->siglock); |
1513 | current->signal->tty_old_pgrp = 0; | 1513 | current->signal->tty_old_pgrp = 0; |
1514 | session = current->signal->session; | 1514 | session = process_session(current); |
1515 | spin_unlock_irq(¤t->sighand->siglock); | 1515 | spin_unlock_irq(¤t->sighand->siglock); |
1516 | 1516 | ||
1517 | mutex_lock(&tty_mutex); | 1517 | mutex_lock(&tty_mutex); |
@@ -2897,7 +2897,7 @@ static int tiocsctty(struct tty_struct *tty, int arg) | |||
2897 | { | 2897 | { |
2898 | int ret = 0; | 2898 | int ret = 0; |
2899 | if (current->signal->leader && | 2899 | if (current->signal->leader && |
2900 | (current->signal->session == tty->session)) | 2900 | (process_session(current) == tty->session)) |
2901 | return ret; | 2901 | return ret; |
2902 | 2902 | ||
2903 | mutex_lock(&tty_mutex); | 2903 | mutex_lock(&tty_mutex); |
@@ -2979,13 +2979,13 @@ static int tiocspgrp(struct tty_struct *tty, struct tty_struct *real_tty, pid_t | |||
2979 | return retval; | 2979 | return retval; |
2980 | if (!current->signal->tty || | 2980 | if (!current->signal->tty || |
2981 | (current->signal->tty != real_tty) || | 2981 | (current->signal->tty != real_tty) || |
2982 | (real_tty->session != current->signal->session)) | 2982 | (real_tty->session != process_session(current))) |
2983 | return -ENOTTY; | 2983 | return -ENOTTY; |
2984 | if (get_user(pgrp, p)) | 2984 | if (get_user(pgrp, p)) |
2985 | return -EFAULT; | 2985 | return -EFAULT; |
2986 | if (pgrp < 0) | 2986 | if (pgrp < 0) |
2987 | return -EINVAL; | 2987 | return -EINVAL; |
2988 | if (session_of_pgrp(pgrp) != current->signal->session) | 2988 | if (session_of_pgrp(pgrp) != process_session(current)) |
2989 | return -EPERM; | 2989 | return -EPERM; |
2990 | real_tty->pgrp = pgrp; | 2990 | real_tty->pgrp = pgrp; |
2991 | return 0; | 2991 | return 0; |
@@ -3338,7 +3338,7 @@ static void __do_SAK(struct work_struct *work) | |||
3338 | /* Kill the entire session */ | 3338 | /* Kill the entire session */ |
3339 | do_each_task_pid(session, PIDTYPE_SID, p) { | 3339 | do_each_task_pid(session, PIDTYPE_SID, p) { |
3340 | printk(KERN_NOTICE "SAK: killed process %d" | 3340 | printk(KERN_NOTICE "SAK: killed process %d" |
3341 | " (%s): p->signal->session==tty->session\n", | 3341 | " (%s): process_session(p)==tty->session\n", |
3342 | p->pid, p->comm); | 3342 | p->pid, p->comm); |
3343 | send_sig(SIGKILL, p, 1); | 3343 | send_sig(SIGKILL, p, 1); |
3344 | } while_each_task_pid(session, PIDTYPE_SID, p); | 3344 | } while_each_task_pid(session, PIDTYPE_SID, p); |
@@ -3348,7 +3348,7 @@ static void __do_SAK(struct work_struct *work) | |||
3348 | do_each_thread(g, p) { | 3348 | do_each_thread(g, p) { |
3349 | if (p->signal->tty == tty) { | 3349 | if (p->signal->tty == tty) { |
3350 | printk(KERN_NOTICE "SAK: killed process %d" | 3350 | printk(KERN_NOTICE "SAK: killed process %d" |
3351 | " (%s): p->signal->session==tty->session\n", | 3351 | " (%s): process_session(p)==tty->session\n", |
3352 | p->pid, p->comm); | 3352 | p->pid, p->comm); |
3353 | send_sig(SIGKILL, p, 1); | 3353 | send_sig(SIGKILL, p, 1); |
3354 | continue; | 3354 | continue; |