get the process group
#include <sys/types.h> #include <unistd.h> pid_t getpgrp( void );
The getpgrp() function allows the calling process to find out which process group it belongs to.
The calling process's process group ID.
/*
* Print the process group of this process.
*/
#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
void main()
{
printf( "I am in process group %d\n",
( int ) getpgrp() );
}
POSIX 1003.1
| Safety: | |
|---|---|
| Interrupt handler | No |
| Signal handler | Yes |
| Thread | Yes |