Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 937949d9 authored by Cedric Le Goater's avatar Cedric Le Goater Committed by Linus Torvalds
Browse files

[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: default avatarCedric 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: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent ef55d53c
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1145,7 +1145,7 @@ static int irix_core_dump(long signr, struct pt_regs * regs, struct file *file)
	psinfo.pr_pid = prstatus.pr_pid = current->pid;
	psinfo.pr_ppid = prstatus.pr_ppid = current->parent->pid;
	psinfo.pr_pgrp = prstatus.pr_pgrp = process_group(current);
	psinfo.pr_sid = prstatus.pr_sid = current->signal->session;
	psinfo.pr_sid = prstatus.pr_sid = process_session(current);
	if (current->pid == current->tgid) {
		/*
		 * This is the record for the group leader.  Add in the
+1 −1
Original line number Diff line number Diff line
@@ -994,7 +994,7 @@ static int mxser_open(struct tty_struct *tty, struct file *filp)
		mxser_change_speed(info, NULL);
	}

	info->session = current->signal->session;
	info->session = process_session(current);
	info->pgrp = process_group(current);

	/*
+1 −1
Original line number Diff line number Diff line
@@ -1017,7 +1017,7 @@ static int rp_open(struct tty_struct *tty, struct file *filp)
	/*
	 * Info->count is now 1; so it's safe to sleep now.
	 */
	info->session = current->signal->session;
	info->session = process_session(current);
	info->pgrp = process_group(current);

	if ((info->flags & ROCKET_INITIALIZED) == 0) {
+6 −6
Original line number Diff line number Diff line
@@ -1511,7 +1511,7 @@ void disassociate_ctty(int on_exit)

	spin_lock_irq(&current->sighand->siglock);
	current->signal->tty_old_pgrp = 0;
	session = current->signal->session;
	session = process_session(current);
	spin_unlock_irq(&current->sighand->siglock);

	mutex_lock(&tty_mutex);
@@ -2897,7 +2897,7 @@ static int tiocsctty(struct tty_struct *tty, int arg)
{
	int ret = 0;
	if (current->signal->leader &&
	    (current->signal->session == tty->session))
			(process_session(current) == tty->session))
		return ret;

	mutex_lock(&tty_mutex);
@@ -2979,13 +2979,13 @@ static int tiocspgrp(struct tty_struct *tty, struct tty_struct *real_tty, pid_t
		return retval;
	if (!current->signal->tty ||
	    (current->signal->tty != real_tty) ||
	    (real_tty->session != current->signal->session))
	    (real_tty->session != process_session(current)))
		return -ENOTTY;
	if (get_user(pgrp, p))
		return -EFAULT;
	if (pgrp < 0)
		return -EINVAL;
	if (session_of_pgrp(pgrp) != current->signal->session)
	if (session_of_pgrp(pgrp) != process_session(current))
		return -EPERM;
	real_tty->pgrp = pgrp;
	return 0;
@@ -3338,7 +3338,7 @@ static void __do_SAK(struct work_struct *work)
	/* Kill the entire session */
	do_each_task_pid(session, PIDTYPE_SID, p) {
		printk(KERN_NOTICE "SAK: killed process %d"
			" (%s): p->signal->session==tty->session\n",
			" (%s): process_session(p)==tty->session\n",
			p->pid, p->comm);
		send_sig(SIGKILL, p, 1);
	} while_each_task_pid(session, PIDTYPE_SID, p);
@@ -3348,7 +3348,7 @@ static void __do_SAK(struct work_struct *work)
	do_each_thread(g, p) {
		if (p->signal->tty == tty) {
			printk(KERN_NOTICE "SAK: killed process %d"
			    " (%s): p->signal->session==tty->session\n",
			    " (%s): process_session(p)==tty->session\n",
			    p->pid, p->comm);
			send_sig(SIGKILL, p, 1);
			continue;
+2 −2
Original line number Diff line number Diff line
@@ -1317,7 +1317,7 @@ static void fill_prstatus(struct elf_prstatus *prstatus,
	prstatus->pr_pid = p->pid;
	prstatus->pr_ppid = p->parent->pid;
	prstatus->pr_pgrp = process_group(p);
	prstatus->pr_sid = p->signal->session;
	prstatus->pr_sid = process_session(p);
	if (thread_group_leader(p)) {
		/*
		 * This is the record for the group leader.  Add in the
@@ -1363,7 +1363,7 @@ static int fill_psinfo(struct elf_prpsinfo *psinfo, struct task_struct *p,
	psinfo->pr_pid = p->pid;
	psinfo->pr_ppid = p->parent->pid;
	psinfo->pr_pgrp = process_group(p);
	psinfo->pr_sid = p->signal->session;
	psinfo->pr_sid = process_session(p);

	i = p->state ? ffz(~p->state) + 1 : 0;
	psinfo->pr_state = i;
Loading