https://unix.stackexchange.com/a/492304/674 says
On Linux, using devpts, there is no master device file. The process on the master end uses a file descriptor, which it gets by opening ptmx, but there’s no corresponding device node.
Did the author refer to /dev/ptmx
or /dev/pts/ptmx
?
Why are /dev/ptmx
and /dev/pts/ptmx
not device files? What types of files are they?
What is the difference between /dev/ptmx
and /dev/pts/ptmx
?
Thanks.
On Lubuntu 18.04
$ file /dev/ptmx
/dev/ptmx: character special (5/2)
$ file /dev/pts/ptmx
/dev/pts/ptmx: character special (5/2)
$ sudo su
# stat -L /dev/fd/3 3<> /dev/pts/ptmx
File: /dev/fd/3
Size: 0 Blocks: 0 IO Block: 1024 character special file
Device: 15h/21d Inode: 2 Links: 1 Device type: 5,2
Access: (0000/c---------) Uid: ( 0/ root) Gid: ( 0/ root)
Access: 2018-11-21 13:39:10.544000218 -0500
Modify: 2018-11-21 13:39:10.544000218 -0500
Change: 2018-11-21 13:39:10.544000218 -0500
Birth: -
# stat -L /dev/fd/3 3<> /dev/ptmx
File: /dev/fd/3
Size: 0 Blocks: 0 IO Block: 4096 character special file
Device: 6h/6d Inode: 87 Links: 1 Device type: 5,2
Access: (0666/crw-rw-rw-) Uid: ( 0/ root) Gid: ( 5/ tty)
Access: 2019-01-06 07:19:54.372098540 -0500
Modify: 2019-01-06 07:19:54.372098540 -0500
Change: 2018-11-21 13:39:30.372098540 -0500
Birth: -
file
command say they are? I double checked, they really are. It's just how you rephrase your language, nothing big deal, almost every thing is used through a file descriptor on linux, but "file" is not well-defined . See http://man7.org/linux/man-pages/man7/pty.7.html and http://man7.org/linux/man-pages/man4/pts.4.html. – 炸鱼薯条德里克 Jan 06 '19 at 05:52stat -L /dev/fd/3 3<> /dev/ptmx
show a major/minor of 5 and 2, or something else? – Mark Plotnick Jan 06 '19 at 09:51/dev/ptmx
will multiplex a new pty pair on opening it, no matter what path is used for that; your command will actually create 2 pseudo-terminal pairs. – Jan 06 '19 at 14:11