Skip to contentSkip to conversation

tty_io: Remove unneeded test for session == 0

PATCH New Eric W. Biederman 1 participant 1 message Jan 29, 2006 Char and misc drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tty_io: Remove unneeded test for session == 0

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.

---

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

5bb76f8c81db4b8a6e5d1c4c1512503e8ccc81c3

drivers/char/tty_io.c +10 -12
index 1d83cd5..901280b 100644
@@ -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;
Signature · 1 line
1.1.5.g3480