mapping tty_nr to tty name (not using shell tool like ps, only C code and system calls)

Jose Lopes jlrlopes at sympatico.ca
Sat Apr 2 17:18:13 UTC 2005


Hi, 

 

How is it that the ps utility maps the tty_nr from /proc/PID/stat field to
the tty name?

 

Is there a way to do this mapping using C code and only system calls (2)?

 

Or, given a PID, how do I find the tty name associated with this process
without ps, only with C code and system calls (2)? Or how ps does it?

 

Cheers

 




More information about the redhat-list mailing list