TIOCGPGRP, TIOCSPGRP, TIOCGSID - process group and session ID
Contents
Description
TIOCGPGRP
When successful, equivalent to *argp=tcgetpgrp(fd).
Get the process group ID of the foreground process group on this terminal.
TIOCSPGRP
Equivalent to tcsetpgrp(fd,*argp).
Set the foreground process group ID of this terminal.
TIOCGSID
When successful, equivalent to *argp=tcgetsid(fd).
Get the session ID of the given terminal. This fails with the error ENOTTY if the terminal is not
a master pseudoterminal and not our controlling terminal. Strange.
Errors
ENOTTY The terminal is not a master pseudoterminal and not our controlling terminal.
EPERM Insufficient permission.
Library
Standard C library (libc, -lc)
Name
TIOCGPGRP, TIOCSPGRP, TIOCGSID - process group and session ID
Return Value
On success, 0 is returned. On error, -1 is returned, and errno is set to indicate the error.
See Also
ioctl(2), ioctl_tty(2), tcgetpgrp(3), tcsetpgrp(3), tcgetsid(3)
Linux man-pages 6.9.1 2024-06-13 TIOCSPGRP(2const)
Synopsis
#include<asm/termbits.h> /* Definition of TIOC* constants */
#include<sys/ioctl.h>intioctl(intfd,TIOCGPGRP,pid_t*argp);intioctl(intfd,TIOCSPGRP,constpid_t*argp);intioctl(intfd,TIOCGSID,pid_t*argp);
