#include <sys/types.h> #include <unistd.h> pid_t getpgrp(void);
getpgrp
determines the process group ID of the calling process.
getpgrp
returns the process group ID
of the calling process.
Under
unusual conditions (for instance, if OpenEdition is not running)
getpgrp
can fail. In this case, getpgrp
issues an MVS user ABEND 1230
to indicate the error.
getgprp
to determine the process group ID of the calling process:
#include <sys/types.h> #include <unistd.h> #include <stdlib.h> . . . if (fork() == 0) { printf("The child's PID is %d. The process group ID is %d\n", (int) getpid(), (int) getpgrp()); exit(0); } . . .
Note:
Also see the setpgid
example.
setpgid
, setsid
, tcgetpgrp
Copyright (c) 1998 SAS Institute Inc. Cary, NC, USA. All rights reserved.