• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

tty_name in linux

dalgin

Member
here is a ego-breaker question
how can you resolve the ttyname at the kernel level.
I looked into ty struct and tty_driver struct but they only contain the tty major name such as tty, pty etc...
what I am trying to get is the full path of the tty name as /dev/pts0.
do you have any idea how to go about getting this info.
thanks
 
It might help if you explained what you were trying to accomplish by doing this, to the kernel the tty of a shell is just another open file and isn't anything special.
 
I am trying to build a kernel that fits the department of defense C2 requirements.
To do that, I need to resolve the terminal name from which the current process is created.
That is the reason I need the tty name.
Thanks
 
ptys are allocated dynamically. pts/0 may not be the same as pts/0 was last time. Maybe you want to hook into the pty subsystem itself and track when it allocates and deallocates ptys first?
 
I think the device field is what you want. There should be some macros for getting the minor device number out of that value. You already know how to get the major device's name, so you should be set other than tracking ptys as they're allocated and deallocated.
 
Back
Top