Process id to user id

Process id to user id

Post by Mike Taba » Wed, 25 Jun 1997 04:00:00



I'm running under Solaris 2.5.1.  Can someone point me to some c code
which can convert an arbitrary process id to the user id which launched
the process, without using a shell command to "ps".

Thanx.

Mike Tabak

 
 
 

Process id to user id

Post by Bart Smaalder » Wed, 25 Jun 1997 04:00:00


Try stating the file /proc/<pid> - the owner of that "file" owns
the process.

- Bart

--
Bart Smaalders                  Solaris Clustering      SunSoft

http://playground.sun.com/~barts                   2550 Garcia Ave
                                                        Mt View, CA 94043-1100

 
 
 

Process id to user id

Post by Andrew Dunst » Wed, 25 Jun 1997 04:00:00



>I'm running under Solaris 2.5.1.  Can someone point me to some c code
>which can convert an arbitrary process id to the user id which launched
>the process, without using a shell command to "ps".

man -s 4 proc

look for the PIOCPSINFO stuff

cheers

andrew

-------------------------------------------------------------------------
  There's nothing either good or bad, but thinking makes it so - Hamlet
  http://www.gr-lakes.com/~andrew (including PGP key)
  PGP Key fingerprint = 5C 44 7D E4 76 A3 31 DE  3D 11 FA 15 4D 87 1F 5E
-------------------------------------------------------------------------

 
 
 

1. Finding out User Id given Process id

Hopefully someone out there can help me. I need to find out the User Id of
a process, given it's pid. I need some generic system call, which will work
across a range of UNIX systems. I know I could use ps and grep the results,
but I want to do this from C without using ps.

Any help appreciated (even if telling me it's not possible)

Roy Harrington

2. AnswerBook2: Running from CD

3. Fat 32 Problems

4. user id vs effective user id

5. general tape question

6. suEXEC

7. Matching thread ids to process ids

8. set user id and set group id bits

9. VFS 3 mapping window's user-ids to unix-ids

10. Syncronizing user id on the PC with UNIX logon id

11. (Historical) User ID and Group ID