$manlookup

TIOCSPGRP

(2const)

process group and session ID

System callsmanpages-dev 6.9.1-1also documents TIOCGPGRP, TIOCGSID
#include <asm/termbits.h> /* Definition of TIOC* constants */ #include <sys/ioctl.h> int ioctl(int fd, TIOCGPGRP, pid_t *argp); int ioctl(int fd, TIOCSPGRP, const pid_t *argp); int ioctl(int fd, TIOCGSID, pid_t *argp);

LIBRARY

Standard C library (libc, -lc)

DESCRIPTION

When successful, equivalent to *argp = tcgetpgrp(fd).
Get the process group ID of the foreground process group on this terminal.
Equivalent to tcsetpgrp(fd, *argp).
Set the foreground process group ID of this terminal.
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.

RETURN VALUE

On success, 0 is returned. On error, -1 is returned, and errno is set to indicate the error.

ERRORS

The terminal is not a master pseudoterminal and not our controlling terminal.
Insufficient permission.

See also