tcgetpgrp(3)
DESCRIPTION
Returns the foreground process group associated with the terminal referred to by fd.
SYNOPSIS
#include <unistd.h> pid_t tcgetpgrp(int fd);
RETURN VALUE
- Returns the foreground process-group ID, or -1 and sets errno.
ERRORS
-EBADF- Fd does not refer to an open descriptor.
-EFAULT- The kernel cannot access the output argument.
-ENOTTY- Fd is not a terminal.
NOTES
The wrapper uses TIOCGPGRP. A terminal opened through /dev/tty resolves to the calling process's controlling terminal.