Microsoft
Software
Hardware
Network
Question : Finding group id from PID
I'm trying to determine a list of process ids that are associated with a particular group (i.e., the owner of the process belongs to the group) That is, if I look at a PID, I can determine the UID. I then want to know if that UID is in a particular group.
As best I can tell I have to:
- get the UID from the PID using getprocs64
- get the username from the UID using getpwuid(uid)
then, given the groupname I need to call getgrnam(groupName)
which will give me a group structure. grp->gr_mem is then an array of strings, which Il will have to parse looking for the username.
Then I have to repeat that for every process in the system.
Surely there is a less pedestrian way.
Answer : Finding group id from PID
I can't see a better way - I can't see any gid anywhere in /usr/include/sys/proc.h. Did you try at
http://www.ibm.com/develop
erworks/?
Random Solutions
Printing Hangs from Multiple Applications
Can Open Excel Files but keep getting a pop up says:"File Not Found"
How can I optimize pictures for websites without loosing quality?
Problem receiving SPAM that looks like it comes from me
Microsoft, Remote Desktop Access, Win XP Pro, Quit working for no known reason
DFS and PreExisting Data how to I merge them?
Admin Script with a bit of Altiris
Mapping Drives
Abnormal Random Windows 2000 Shutdown
Inserting a Carriage Return in a Javascript Function