TCSETPGRP(3C)
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 calling process has a controlling terminal, tcsetpgrp sets the foreground process group ID associated with the terminal referenced by fildes 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 value of pgrp_id must match a process group ID of a process in the same session as the calling process.
RETURN VALUE
Upon successful completion, zero is returned. Otherwise, a value of -1 is returned and errno is set to indicate the error.
ERRORS
Tcsetpgrp will fail if one or more of the following is true:
[EBADF] Fildes is not a valid file descriptor.
[EINVAL] The value of the pgrp_id argument is not supported.
[ENOTTY] The calling process does not have a controlling terminal, or the fildes 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 supported value but does not match the process group ID of a process in the same session as the calling process.
SEE ALSO
termio(7), tcgetpgrp(3C), setsid(2), setpgid(2).
STANDARDS CONFORMANCE
tcsetpgrp: XPG3, POSIX.1, FIPS 151-1
Hewlett-Packard Company — HP-UX Release 7.0: Sept 1989