Bug 229107 - linprocfs: implement /dev/tty/drivers
Summary: linprocfs: implement /dev/tty/drivers
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-emulation (Nobody)
URL:
Keywords:
Depends on:
Blocks: 247219
  Show dependency treegraph
 
Reported: 2018-06-18 13:06 UTC by Ed Maste
Modified: 2020-07-27 19:04 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ed Maste freebsd_committer 2018-06-18 13:06:27 UTC
On Gentoo "Linux (none) 4.14.33-v8-0a76b56e61cf+ #1 SMP PREEMPT Wed Apr 11 11:36:25 BST 2018 aarch64 GNU/Linux" on RPi 3B+ /proc/tty/drivers contains:

/dev/tty             /dev/tty        5       0 system:/dev/tty
/dev/console         /dev/console    5       1 system:console
/dev/ptmx            /dev/ptmx       5       2 system
/dev/vc/0            /dev/vc/0       4       0 system:vtmaster
ttyAMA               /dev/ttyAMA   204 64-77 serial
ttyprintk            /dev/ttyprintk   5       3 console
pty_slave            /dev/pts      136 0-1048575 pty:slave
pty_master           /dev/ptm      128 0-1048575 pty:master
unknown              /dev/tty        4 1-63 console

This seems to be accessed by some common startup code - e.g., invoking bin/ps reads from /proc/tty/drivers.

strace on Linus shows:

openat(AT_FDCWD, "/proc/tty/drivers", O_RDONLY) = 6
read(6, "/dev/tty             /dev/tty   "..., 9999) = 521
close(6)                                = 0
newfstatat(AT_FDCWD, "/dev/pts0", 0x7ff7270018, 0) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/dev/pts/0", {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 0), ...}, 0) = 0
openat(AT_FDCWD, "/usr/lib64/gconv/gconv-modules.cache", O_RDONLY) = 6
fstat(6, {st_mode=S_IFREG|0644, st_size=26244, ...}) = 0
mmap(NULL, 26244, PROT_READ, MAP_SHARED, 6, 0) = 0x7f90e6a000
close(6)                                = 0
newfstatat(AT_FDCWD, "/proc/946", {st_mode=S_IFDIR|0555, st_size=0, ...}, 0) = 0
openat(AT_FDCWD, "/proc/946/stat", O_RDONLY) = 6
read(6, "946 (kworker/3:2) I 2 0 0 0 -1 6"..., 1024) = 160
close(6)                                = 0
...

Linux bin/ps under arm64 Linuxulator:
   649 ps       CALL  linux_openat(0xffffffffffffff9c,0x40164a78,0,0)
   649 ps       NAMI  "/compat/linux/proc/tty/drivers"
   649 ps       NAMI  "/proc/tty/drivers"
   649 ps       RET   linux_openat -1 errno -2 No such file or directory
Comment 1 Edward Tomasz Napierala freebsd_committer 2020-07-20 12:57:52 UTC
With recent fixes the ps(1) output seems normal, in particular the pty-s are displayed correctly.  Does the lack of this file actually break anything?
Comment 2 Ed Maste freebsd_committer 2020-07-27 19:04:36 UTC
I don't recall now what problem I ran into that prompted this PR - I'll try to take another look.