Assume all elision: pid_t is undefined. You need both
#include <sys/types.h>
#include <unistd.h>
Otherwise, you will not get what you think you are getting.
, . , ( ) , , .
#include <unistd.h>
#include <stdio.h>
int main() {
pid_t pid, pgid;
if((pgid = getpgid(pid)) < 0) {
puts("Oops.");
}
return 0;
}
:
1. . . .
2. , .
, , .