TCGETPGRP(3V) — NEWS-OS Programmer’s Manual
NAME
tcgetpgrp, tcsetpgrp − get, set foreground process group ID
SYNOPSIS
int tcgetpgrp(fd)
int fd;
int tcsetpgrp(fd, pgrp_id)
int fd, pgrp_id;
DESCRIPTION
tcgetpgrp returns the value of the process group ID of the foreground process group associated with the terminal. tcgetpgrp is allowed from a process that is a member of a background process group; however, the information may be subsequently changed by a process that is a member of a foreground process group.
If the process has a controlling terminal, tcsetpgrp sets the foreground process group ID associated with the terminal to pgrp_id. The file associated with fd must be the controlling terminal and 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 VALUES
On success, tcgetpgrp returns the process group ID of the foreground process group associated with the terminal. On failure, it returns −1 and sets errno to indicate the error.
tcsetpgrp returns 0 on success. On failure, It returns −1 and sets errno to indicate the error.
ERRORS
EBADF fd is not a valid file descriptor.
ENOTTY The calling process does not have a controlling terminal.
The file is not the controlling terminal.
tcsetpgrp sets errno to:
EINVAL The value of pgrp_id is not a valid process group ID.
ENOTTY
The controlling terminal is no longer associated with the session of the calling process.
EPERM The value of pgrp_id is a valid process group ID, but does not match the process group ID of a process in the same session as the calling process.
SEE ALSO
NEWS-OSRelease 4.1C