Gets foreground process group ID.
Standard C Library (libc.a)
#include <unistd.h>
pid_t tcgetpgrp ( FileDescriptor)
int FileDescriptor;
The tcgetpgrp subroutine returns the value of the process group ID of the foreground process group associated with the terminal. The function can be called from a background process; however, the foreground process can subsequently change the information.
FileDescriptor | Indicates the open file descriptor for the terminal special file. |
Upon successful completion, the process group ID of the foreground process is returned. If there is no foreground process group, a value greater than 1 that does not match the process group ID of any existing process group is returned. Otherwise, a value of -1 is returned and the errno global variable is set to indicate the error.
The tcgetpgrp subroutine is unsuccessful if one of the following is true:
The setpgid (setpgid or setpgrp Subroutine) subroutine, setsid (setsid Subroutine) subroutine, tcsetpgrp (tcsetpgrp Subroutine) subroutine.
The Input and Output Handling Programmer's Overview in AIX 5L Version 5.2 General Programming Concepts: Writing and Debugging Programs.