Finding out User Id given Process id

Finding out User Id given Process id

Post by Sriniva » Thu, 11 Sep 1997 04:00:00




> 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

If your system supports the pstat set of calls, you can try using pstat.
At least on HP-UX, there are wrapper routines for this such as
pstat_getproc, which returns process specific info, taking the pid as
one of the args. Even otherwise, I guess there must be some call which
can return process specific info. This will definitely contain UID as
one of the fields ( and a lot more other info if you wish ).
Srinivasan.
 
 
 

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. First Time Compiling Kernel

3. Process id to user id

4. Dosemu fine - Xdos not really?

5. user id vs effective user id

6. PLIP problems solved! (mostly...)

7. ATI Mach64 & MAGDX17F Monitor with XFree86-3.1.1

8. (Review ID: 159248) Starting Tomcat servlet engine gives HotSpot Virtual Machine Error: 11, error ID

9. Get process ids of all processes associated with a given ip-address

10. Matching thread ids to process ids

11. Find widget id without having parent id????