Method getpgid
getpgid(int)
Retrieves the process group ID of the specified process.
public static extern int getpgid(int pid)
Parameters
pidintThe process ID of the target process. Specify
0to retrieve the process group ID of the calling process.
Returns
- int
The process group ID of the specified process, or -1 if an error occurs.
Remarks
This method is a direct wrapper for the getpgid function in the C
standard library. If the specified process does not exist or
the caller lacks the necessary permissions,
the method will return -1.