From owner-freebsd-current@FreeBSD.ORG Tue Sep 26 09:34:07 2006 Return-Path: X-Original-To: current@freebsd.org Delivered-To: freebsd-current@FreeBSD.ORG Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 3558716A417 for ; Tue, 26 Sep 2006 09:34:07 +0000 (UTC) (envelope-from mb@imp.ch) Received: from pop.imp.ch (mx2.imp.ch [157.161.9.17]) by mx1.FreeBSD.org (Postfix) with ESMTP id A66CC43D76 for ; Tue, 26 Sep 2006 09:34:06 +0000 (GMT) (envelope-from mb@imp.ch) Received: from godot.imp.ch (godot.imp.ch [157.161.4.8]) by pop.imp.ch (8.13.8/8.13.8/Submit_imp) with ESMTP id k8Q9XxuU057584 for ; Tue, 26 Sep 2006 11:34:04 +0200 (CEST) (envelope-from mb@imp.ch) Date: Tue, 26 Sep 2006 11:33:59 +0200 (CEST) From: Martin Blapp To: current@freebsd.org Message-ID: <20060926111452.J91466@godot.imp.ch> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Scanned-By: MIMEDefang 2.57 on 157.161.9.65 Cc: Subject: What do you think ?: How should pseundo terminals behave ... X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Sep 2006 09:34:07 -0000 ... if there is no slave and master anymore, both sides are closed (for example after we did type exit in our term) and we open a slave and write something to the closed pty ? What we currently do: If we have no slave and master ttypX ttytX anymore and we try to write to the ttypX like: echo "BLUBBER" > /dev/ttypX We get currently blocked in ptsopen(). That's ok so far. But after we ssh into the box again, THE SAME ! tty gets opened too, leading to a tty livelock for 5 minutes. Sometimes we gets then EOPNOTSUPP when the writer gets aborted, sometimes we get two ptsclose(). After we exit this pty the refcounts are off by one, we make one ttyrel() too much so the tty structure gets completly freed in ttyrel() and the next ptsopen/ptcopen panics our box this is FreeBSD6 behaviour. With my fixes CURRENT doesn not panic anymore, but it leaks ptys. So how should ptys behave ? 1.) Block until the tty is really opened again and there is a master available again. Then write to the freshly opened pty. (not easy to do) 2.) Block forever since the tty will not be reopened anymore since we leak ptys. 3.) Detect that there is no master around anymore and return ENXIO: # echo "BLUBBER" > /dev/ttypX # /dev/ttypX: Device not configured (easy to do, i've got a fix. IMHO this is the best thing to do. This allows fast error recovery in case the master has been gone away) 4.) Keep the current behaviour, leak terminals or panic. (the simplest thing to do. Let's keep the bugs) Please vote for any of those choice. Thank you for your participation. Martin Martin Blapp, ------------------------------------------------------------------ ImproWare AG, UNIXSP & ISP, Zurlindenstrasse 29, 4133 Pratteln, CH Phone: +41 61 826 93 00 Fax: +41 61 826 93 01 PGP: PGP Fingerprint: B434 53FC C87C FE7B 0A18 B84C 8686 EF22 D300 551E ------------------------------------------------------------------