From owner-freebsd-current Sun Jun 24 3:26:10 2001 Delivered-To: freebsd-current@freebsd.org Received: from segfault.kiev.ua (segfault.kiev.ua [193.193.193.4]) by hub.freebsd.org (Postfix) with ESMTP id 6A1E437B401; Sun, 24 Jun 2001 03:26:00 -0700 (PDT) (envelope-from netch@iv.nn.kiev.ua) Received: (from uucp@localhost) by segfault.kiev.ua (8) with UUCP id NJZ85975; Sun, 24 Jun 2001 13:25:57 +0300 (EEST) (envelope-from netch@iv.nn.kiev.ua) Received: (from netch@localhost) by iv.nn.kiev.ua (8.11.4/8.11.4) id f5OAMtj12758; Sun, 24 Jun 2001 13:22:55 +0300 (EEST) (envelope-from netch) Date: Sun, 24 Jun 2001 13:22:55 +0300 From: Valentin Nechayev To: current@freebsd.org, phk@freebsd.org Subject: ptys & devfs Message-ID: <20010624132255.A12633@iv.nn.kiev.ua> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-42: On Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG I. A session under screen, or sshd, or any another: netch@iv:~>tty /dev/ttyp2 netch@iv:~>ls -l /dev/tty /dev/ttyp2 crw--w---- 1 netch tty 5, 2 Jun 24 13:09 /dev/tty crw--w---- 1 netch tty 5, 2 Jun 24 13:09 /dev/ttyp2 root@iv:~##ls -l /dev/ttyp* crw--w---- 1 netch tty 5, 2 Jun 24 13:09 /dev/ttyp2 crw--w---- 1 netch tty 5, 3 Jun 24 13:09 /dev/ttyp3 Then try unlink /dev/ttyp2: root@iv:~##rm /dev/ttyp2 root@iv:~##ls -l /dev/ttyp* crw--w---- 1 netch tty 5, 3 Jun 24 13:10 /dev/ttyp3 And then from first session: netch@iv:~>tty not a tty netch@iv:~>ls -l /dev/tty /dev/ttyp* crw--w---- 1 netch tty 5, 2 Jun 24 13:10 /dev/tty crw--w---- 1 netch tty 5, 3 Jun 24 13:10 /dev/ttyp3 Why it allows to unlink pty which in use? (The same with master pty: kernel allows to unlink used master pty.) When exit from the session and enter again, screen complaints: "chown tty: No such file or directory". This shit keeps itself even if terminate screen and start it again: "chown tty: No such file or directory" "Sorry, could not find a PTY." & exit `mknod /dev/ttyp2 c 0 0' fixes it. But this logic is rather opaque: before screen's request, /dev/ttyp2 did not exist, but created on open(); but why it cannot be opened again now? And ptys which are already not used keeps themselves in /dev listing. II. fstat says strange `(11)' on all ptys, e.g.: netch fstat 12693 0 - - ?(11) - netch fstat 12693 1* pipe c870dc00 <-> c870df20 0 rw netch fstat 12693 2 - - ?(11) - netch fstat 12693 3 - - ?(11) - netch fstat 12693 4 - - ?(11) - But this fstat was run in terminal which: netch@iv:~>tty /dev/ttyr0 netch@iv:~>ls -l /dev/ttyr0 crw--w---- 1 netch tty 5, 64 Jun 24 13:16 /dev/ttyr0 No experiments described above were performed upon /dev/ttyr0, it is kept virgin, with most of another ptys at this run. /netch To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message