Συντάκτης: aitor Ημερομηνία: Προς: dng Αντικείμενο: Re: [DNG] issue with procps, any hints?
Hi again,
On 20/12/22 15:33, aitor wrote: > The key is that the aforementioned integer might not represent the tty, but the
> major and minor numbers that need to be splitted, as someone suggested to me.
The macros MAJOR and MINOR are available in <sys/sysmacros.h>.
For example, given a process with pid=13849 controlled by pts/3, that is:
$ ps -p 13849 -o tty=
pts/3
Then, the C program will throw us the following MAJOR:MINOR numbers:
$ ./main 13849
136:3
where the MINOR number tells the number of the controling terminal (=3).
On the other hand, the MAJOR number tells if it is native terminal (tty) or a
pseudo-terminal (pts). For Unix98:
- PTS devices (Pseudo-TTY slaves) are on 136 and above
- TTY devices are on 4
Remark: The macros MAJOR and MINOR are also defined in <linux/ ? > for structures
of type `dev_t`, i seem to remember from the code of vdev. So, if I'm not mistaken,
the integer tty in `proc_t` really consists of an structure of type `dev_t`?