#include <sys/types.h>
pid_t tcgetpgrp(fd) int fd;
int tcsetpgrp(fd, pgrp_id) int fd; pid_t pgrp_id;
tcgetpgrp() returns the value of the process group ID of the foreground process group associated with the terminal (see NOTES). tcgetpgrp() is allowed from a process that is a member of a background process group; however, the information may be subsequently changed by a process that is a member of a foreground process group.
If the process has a controlling terminal, tcsetpgrp() sets the foreground process group ID associated with the terminal to pgrp_id. The file associated with fd must be the controlling terminal and must be currently associated with the session of the calling process. The value of pgrp_id must match a process group ID of a process in the same session as the calling process.
On success, tcgetpgrp() returns the process group ID of the foreground process group associated with the terminal. On failure, it returns -1 and sets errno to indicate the error.
tcsetpgrp() returns:
If any of the following conditions occur, tcgetpgrp() sets errno to:
The file is not the controlling terminal.
If any of the following conditions occur, tcsetpgrp() sets errno to:
The file is not the controlling terminal.
The controlling terminal is no longer associated with the session of the calling process.
For tcgetpgrp() and tcsetpgrp() to behave as described above, {_POSIX_JOB_CONTROL} must be in effect (see sysconf.2v {_POSIX_JOB_CONTROL} is always in effect on SunOS systems, but for portability, applications should call sysconf() to determine whether {_POSIX_JOB_CONTROL} is in effect for the current system.
If {_POSIX_JOB_CONTROL} is not defined on a system conforming to IEEE Std 1003.1-1988 either tcgetpgrp() and tcsetpgrp() behave as described above, or tcgetpgrp() and tcsetpgrp() fail.
Created by unroff & hp-tools. © somebody (See intro for details). All Rights Reserved. Last modified 11/5/97