tcsetpgrp(3P) tcsetpgrp(3P)NAME tcsetpgrp - sets distinguished process group ID SYNOPSIS #include <sys/types.h> int tcsetpgrp(fildes,pgrp-id) int fildes; pid_t pgrp-id; DESCRIPTION tcsetpgrp is part of the POSIX Job Control Option. If the process has a controlling terminal, tcsetpgrp sets the distinguished process group ID associated with the terminal to pgrp-id. The file associated with fildes must be the controlling terminal of the calling process, and the controlling terminal must be currently associated with the session of the calling process. The pgrp-id must match a process group ID of a process in the same session as the calling process. STATUS MESSAGES AND VALUES On successful completion, tcsetpgrp returns 0. Otherwise, -1 is returned and errno is set to indicate the error. The possible error messages follow: EBADF The file descriptor fildes is not valid. EINVAL tcsetpgrp is not permitted for the device associated with fildes, or the value of pgrp-id is less than or equal to 0 or exceeds PID_MAX. ENOTTY The calling process does not have a controlling terminal, or the file is not the controlling terminal. EPERM pgrp-id is greater than 0 and less than or equal to PID_MAX, and there is no process in the process group indicated by pgrp-id that has the same controlling terminal as the calling process. SEE ALSO setpgid(2P), setsid(2P), tcgetpgrp(3P) January 1992 1