Subject: kern/8455: It is impossible to get SIGIOs for non-controlling ttys
To: None <>
From: Michael Eriksson <>
List: netbsd-bugs
Date: 09/20/1999 15:55:17
>Number:         8455
>Category:       kern
>Synopsis:       It is impossible to get SIGIOs for non-controlling ttys
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people (Kernel Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Sep 20 15:05:00 1999
>Originator:     Michael Eriksson
Ericsson Radio Systems AB
>Release:        NetBSD-release as of early September 1999 or so
System: NetBSD burken 1.4.1 NetBSD 1.4.1 (EMT) #0: Mon Sep 13 09:41:04 CEST 1999 eramore@burken:/var/home/eramore/wrk/maestro2/sys/arch/i386/compile/EMT i386


It is currently impossible to get SIGIOs from ttys other than the
current controlling one. This obviously sucks when trying to talk to
modems or other serially connected equipment.


Try to use fcntl(F_SETOWN) to get SIGIOs from a non-controlling tty
and watch it return ENOTTY.


Index: tty.c
RCS file: /cvsroot/syssrc/sys/kern/tty.c,v
retrieving revision 1.112
diff -u -r1.112 tty.c
--- tty.c	1998/09/11 12:50:11	1.112
+++ tty.c	1999/09/20 21:35:00
@@ -844,7 +844,7 @@
 		*(struct winsize *)data = tp->t_winsize;
 	case TIOCGPGRP:			/* get pgrp of tty */
-		if (!isctty(p, tp))
+		if (tp->t_session && !isctty(p, tp))
 			return (ENOTTY);
 		*(int *)data = tp->t_pgrp ? tp->t_pgrp->pg_id : NO_PID;
@@ -990,7 +990,7 @@
 	case TIOCSPGRP: {		/* set pgrp of tty */
 		register struct pgrp *pgrp = pgfind(*(int *)data);
-		if (!isctty(p, tp))
+		if (tp->t_session && !isctty(p, tp))
 			return (ENOTTY);
 		else if (pgrp == NULL)
 			return (EINVAL);