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
Wanted to open a new word document through OLE
A program or firewall is not compatible with Windows Vista - wscript.exe
XP Pro reinstall - NTFS Format Crawling. Why???
A system driver MUP.SYS hangs too much the computer
How do I route with multiple NIC's in Linux
Remote Web Workplace Issues
Birthday reminders
Forwarding Emails for Terminated Employee
Can Javascript in Acrobat get the next month and enter into multiple form fields?
How to delete email messages within a date range. say 6/01/08 to 6/15/08. Blackberry on BES server.