|
|
#include <sys/types.h>pid_t tcgetpgrp (fildes); int fildes;
int tcsetpgrp (fildes, pgrp_id); int fildes; pid_t pgrp_id;
tcsetpgrp- sets the foreground process ID group
These routines identify and set the parent process group ID when job control is defined. The tcgetpgrp function returns the value of the process group ID of the foreground process group associated with the terminal.
tcgetpgrp is allowed only from a process that is part of a background process group. However, this information can be changed by a process that is part of the foreground process group by means of the tcsetpgrp call.
tcsetpgrp sets the foreground process ID group associated with the terminal to the value of pgrp_id. fildes must be the file associated with the controlling terminal of the calling process. The controlling terminal must also 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. Any other value of pgrp_id causes an error.
tcsetpgrp returns a value of zero upon success. Otherwise, -1 is returned and errno is set to indicate the error.
If any of the following conditions occur, tcsetpgrp returns -1 and sets errno to the corresponding value:
IEEE POSIX Std 1003.1-1990 System Application Program Interface (API) [C Language] (ISO/IEC 9945-1) and X/Open Portability Guide, Issue 3, 1989 .