i am writing a utility that displays information about all the running processes in the /proc directory.
I do not know how to get the following information for each of the processes in the /proc directory:
-effective user id
-effective user name
-effective group id
-effective group name
-tty
-execution time of process
I understand how to get the user id. It is from the stat struct. And to get the user name, I just pass the user id to getpwuid(). Its the same with the group id and group name.
But I''m stuck at where I can obtain the effective user id and effective group id and how to get their effective names.
Also, where can i obtain information about which terminal the current process is being controlled by? It should be in the form "/pts/#"
Also, how can i find out how long a process has been executing?
Thank you.