TCGETPGRP(3) BSD TCGETPGRP(3)
NAME
tcgetpgrp - Get foreground process group ID
SYNOPSIS
#include <sys/types.h>
pid_t tcgetpgrp (filedes)
int filedes;
DESCRIPTION
The tcgetpgrp function 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 information may be
subsequently changed.
The filedes argument indicates the open file descriptor for the terminal
special file.
DIAGNOSTICS
Upon successful completion, the process group ID of the foreground
process is returned. Otherwise, a value of -1 is returned and errno is
set to indicate the error.
ERRORS
If the tcgetpgrp() function fails, errno will be set to one of the
following values:
[EBADF] The filedes argument is not a valid file descriptor.
[ENOTTY] The calling process does not have a controlling terminal or the
file is not the controlling terminal.
SEE ALSO
setpgid(2), setsid(2), tcsetpgrp(3) <sys/types.h>