In article <607eba59$0$32501$
426a...@news.free.fr>,
Zooe <
zo...@127.0.0.1> wrote:
>Le mardi 20 avril 2021, Kenny McCormack a crit:
>> Lots of processes have /dev/ptmx open; how to know which one is connected
>> to /dev/pts/6?
>
>For each fd in /proc/$pidmaster/fd/ that points to /dev/ptmx, check the
>following (works only on recent kernels):
>
> grep tty-index < /proc/$pidmaster/fdinfo/$fd
Ah, now we are getting somewhere.
Unfortunately, the system that has the problem is running kernel
4.something and does not have tty-index (in the fdinfo/X file). Other
systems here that are runnning kernel 5.something do have it, but "man
proc" doesn't mention it.
I'm guessing that it contains the number of the tty (/dev/pts/X) that this
instance of /dev/ptmx is connected to. Is that correct?
>Another way to get the information, which is more universal but also is
>more difficult to follow, is to make a TIOCGPTN system call on the file
>descriptor (from a debugger attached to the process).
Well, that sounds interesting. And very complicated...
(And time consuming...)
--
The coronavirus is the first thing, in his 74 pathetic years of existence,
that the orange menace has come into contact with, that he couldn't browbeat,
bully, bullshit, bribe, sue, legally harrass, get Daddy to fix, get his
siblings to bail him out of, or, if all else fails, simply wish it away.