I am trying to implement a way to determine which user is owner of some process's session, in a way that's as cross-platform as possible.
In Linux I can trace the process's pty by following the link
/proc/PID/fd/0 -> /dev/pts/31 and looking up who is the owner of this terminal in the utmp file.
How do I do this in, say, AIX 6.1?
/proc/PID/fd contains char files and not symlinks as Linux does... Also what is the exact structure of a single entry in utmp file on AIX 6.1? Tried to read it using 7.1 [http://www-01.ibm.com/support/knowledgecenter/ssw_aix_71/com.ibm.aix.files/utmp.h.htm] utmp structures but it does not really fit the pattern.