tcsetpgrp(3P) INTERACTIVE UNIX System (POSIX) tcsetpgrp(3P)
NAME
tcsetpgrp - set foreground process group ID
SYNOPSIS
#include <sys/types.h>
int tcsetpgrp (fildes,pgrp_id)
int fildes;
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 pgrp_id. The file associated with
fildes must be the controlling terminal of the calling pro-
cess and the controlling terminal must be currently associ-
ated 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.
RETURN VALUES
Upon successful completion, tcsetpgrp() returns a value of
zero. Otherwise, a value of -1 is returned, and errno is
set to indicate the error.
ERRORS
If any of the following conditions occur, the tcsetpgrp()
function returns -1 and sets errno to the corresponding
value:
[EBADF]
The fildes argument is not a valid file descriptor.
[EINVAL]
The value of the pgrp_id argument is an invalid value.
[ENOTTY]
The calling process does not have a controlling termi-
nal, or the file is not the controlling terminal, or
the controlling terminal is no longer associated with
the session of the calling process.
[EPERM]
The value of pgrp_id is a value supported by the INTER-
ACTIVE UNIX Operating System, but does not match the
process group ID of a process in the same session as
the calling process.
Rev. 1.1 Page 1