TCSETPGRP(3) SysV TCSETPGRP(3)
NAME
tcsetpgrp - Set foreground process group ID
SYNOPSIS
#include <sys/types.h>
int tcsetpgrp (filedes, pgrp_id)
int filedes;
pid_t pgrp_id;
DESCRIPTION
If the process has a controlling terminal, the tcsetpgrp function sets
the foreground process group ID associated with the terminal to the value
of the pgrp_id argument.
The filedes argument specifies an open file descriptor and the pgrp_id
argument specifies the process group identifier.
The file associated with the filedes argument 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 value
of the pgrp_id argument must match a process group ID of a process in the
same session as the calling process.
DIAGNOSTICS
Upon successful completion, a value of 0 (zero) is returned. Otherwise, a
value of -1 is returned and errno is set to indicate the error.
ERRORS
tcsetpgrp fails if:
[EBADF] The filedes argument is not a valid file descriptor.
[EINVAL] The pgrp_id argument is invalid.
[ENOTTY] The calling process does not have a controlling terminal, the
file is not the controlling terminal, or the controlling
terminal is no longer associated with the session of the
calling process.
[EPERM] The pgrp_id argument is valid, but matches a process ID or
process group ID of a process in another session.
SEE ALSO
tcgetpgrp(3)