mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: ebiederm@xmission.com (Eric W. Biederman)
To: Andrew Morton <akpm@osdl.org>
Cc: <linux-kernel@vger.kernel.org>
Subject: [PATCH] tty_io:  Remove unneeded test for session == 0
Date: Sun, 29 Jan 2006 14:47:48 -0700	[thread overview]
Message-ID: <m1r76q7lkr.fsf@ebiederm.dsl.xmission.com> (raw)


Andrew earlier you asked about code that can be simplified
by not hashing pid 0.  This is one example. 

That patch actually corrects loops like:
		case IOPRIO_WHO_PGRP:
			if (!who)
				who = process_group(current);
			do_each_task_pid(who, PIDTYPE_PGID, p) {
				ret = set_task_ioprio(p, ioprio);
				if (ret)
					break;
			} while_each_task_pid(who, PIDTYPE_PGID, p);
			break;
If the processes calling it is not a member of a process group.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>


---

 drivers/char/tty_io.c |   22 ++++++++++------------
 1 files changed, 10 insertions(+), 12 deletions(-)

5bb76f8c81db4b8a6e5d1c4c1512503e8ccc81c3
diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c
index 1d83cd5..901280b 100644
--- a/drivers/char/tty_io.c
+++ b/drivers/char/tty_io.c
@@ -1069,18 +1069,16 @@ static void do_tty_hangup(void *data)
 	  tty_release is called */
 	
 	read_lock(&tasklist_lock);
-	if (tty->session > 0) {
-		do_each_task_pid(tty->session, PIDTYPE_SID, p) {
-			if (p->signal->tty == tty)
-				p->signal->tty = NULL;
-			if (!p->signal->leader)
-				continue;
-			group_send_sig_info(SIGHUP, SEND_SIG_PRIV, p);
-			group_send_sig_info(SIGCONT, SEND_SIG_PRIV, p);
-			if (tty->pgrp > 0)
-				p->signal->tty_old_pgrp = tty->pgrp;
-		} while_each_task_pid(tty->session, PIDTYPE_SID, p);
-	}
+	do_each_task_pid(tty->session, PIDTYPE_SID, p) {
+		if (p->signal->tty == tty)
+			p->signal->tty = NULL;
+		if (!p->signal->leader)
+			continue;
+		group_send_sig_info(SIGHUP, SEND_SIG_PRIV, p);
+		group_send_sig_info(SIGCONT, SEND_SIG_PRIV, p);
+		if (tty->pgrp > 0)
+			p->signal->tty_old_pgrp = tty->pgrp;
+	} while_each_task_pid(tty->session, PIDTYPE_SID, p);
 	read_unlock(&tasklist_lock);
 
 	tty->flags = 0;
-- 
1.1.5.g3480


                 reply	other threads:[~2006-01-29 21:48 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=m1r76q7lkr.fsf@ebiederm.dsl.xmission.com \
    --to=ebiederm@xmission.com \
    --cc=akpm@osdl.org \
    --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

all inboxes | Powered by JetHome®