@node tcgetpgrp, termios @subheading Syntax @example #include int tcgetpgrp (int fd); @end example @subheading Description This function returns the value of the @dfn{process group ID} for the foreground process associated with the terminal. The file descriptor @var{fd} must be connected to the terminal, otherwise the function will fail. @subheading Return Value If @var{fd} is connected to the terminal, the function returns the process group ID, which is currently identical to the value returned by @code{getpgrp()} (@pxref{getpgrp}). Otherwise, it returns -1 and sets @code{errno} to @code{ENOTTY}. @subheading Portability @portability !ansi, posix @c ------------------------------------------------------------------- @node tcsetpgrp, termios @subheading Syntax @example #include int tcsetpgrp (int fd, pid_t pgroup_id); @end example @subheading Description This function sets the foreground @dfn{process group ID} for the terminal connected to file descriptor @var{fd}. @var{fd} must be a valid handle connected to a terminal device, and @var{pgroup_id} must be the process group ID of the calling process, or the function will fail. @subheading Return Value If @var{fd} is a valid handle connected to a terminal and @var{pgroup_id} is equal to what @code{getpgrp()} returns (@pxref{getpgrp}), the function will do nothing and return zero. Otherwise, -1 will be returned and @code{errno} will be set to a suitable value. In particular, if the @var{pgroup_id} argument is different from what @code{getpgrp()} returns, @code{tcsetpgrp} sets @code{errno} to @code{ENOSYS}. @subheading Portability @portability !ansi, posix