tcgetpgrp(3C) tcgetpgrp(3C)
NAME
tcgetpgrp, tcsetpgrp - Get or set foreground process group
ID.
SYNOPSIS
#include <sys/types.h>
pidt tcgetpgrp (fildes)
int fildes;
int tcsetpgrp (fildes, pgrpid)
int fildes;
pidt pgrpid;
DESCRIPTION
The tcgetpgrp() and tcsetpgrp() functions are defined in the
POSIX 1003.1 standard and used in the OCS and BCS standards.
CX/UX applications which are not POSIX/OCS/BCS compliant can
use these functions.
tcgetpgrp returns the value of the process group ID of the
foreground process group associated with the terminal device
identified by fildes. A background process may call this
function, but the attributes may be changed by a subsequent
foreground process call to tcsetpgrp.
Tcsetpgrp sets the foreground process group ID associated
with the terminal device identified by fildes. Certain res-
trictions apply to the use of this function:
1. Fildes must be the controlling terminal of the calling
process.
2. This controlling terminal must be currently associated
with the session of the calling process.
3. The value of pgrp_id must match a process group ID of a
process in the same session as the calling process.
Background processes may not call tcsetpgrp. Attempts to do
so will result in a SIGTTOU signal being sent to the calling
process and all members of its process group. The SIGTTOU
signal stops the calling process and all members of its pro-
cess group unless the calling process is blocking or ignor-
ing this signal.
SEE ALSO
getpgrp(2), setpgrp(2), setpgid(2), setsid(2), termios(7)
DIAGNOSTICS
Upon successful completion, the value of the obtained pro-
cess group ID is returned by tcgetpgrp and a value of zero
is returned by tcsetpgrp. If not, a value of -1 is returned
and errno is set.
Page 1 CX/UX Programmer's Reference Manual
tcgetpgrp(3C) tcgetpgrp(3C)
Errno is set to one of the following values for tcgetpgrp:
[EBADF] Fildes is not a valid open file descriptor.
[ENOTTY] Fildes is not associated with a terminal dev-
ice or either the calling process or its ses-
sion does not have a controlling terminal or
the terminal device is not a controlling ter-
minal.
Errno is set to one of the following values for tcsetpgrp:
[EBADF] Fildes is not a valid open file descriptor.
[EINVAL] The value of pgrp_id is not a valid ID value
supported by CX/UX.
[ENOTTY] The calling process does not have a control-
ling terminal, or fildes is not the control-
ling terminal of this process, or the con-
trolling terminal is no longer associated
with the session of the calling process.
[EPERM] The value of pgrp_id is valid, but does not
match the process group ID of a process in
the same session as the calling process.
Page 2 CX/UX Programmer's Reference Manual