Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 24 Jun 2001 13:22:55 +0300
From:      Valentin Nechayev <netch@iv.nn.kiev.ua>
To:        current@freebsd.org, phk@freebsd.org
Subject:   ptys & devfs
Message-ID:  <20010624132255.A12633@iv.nn.kiev.ua>

next in thread | raw e-mail | index | archive | help
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010624132255.A12633>