tcgetpgrp(3) Library Functions Manual tcgetpgrp(3) tcgetpgrp, tcsetpgrp - LIBRARY Standard C library (libc, -lc) #include pid_t tcgetpgrp(int fd); int tcsetpgrp(int fd, pid_t pgrp); tcgetpgrp() (foreground) , fd. . tcsetpgrp() pgrp , fd, , . , pgrp () , , . tcsetpgrp() , SIGTTOU, SIGTTOU . When fd refers to the controlling terminal of the calling process, the function tcgetpgrp() will return the foreground process group ID of that terminal if there is one, and some value larger than 1 that is not presently a process group ID otherwise. When fd does not refer to the controlling terminal of the calling process, -1 is returned, and errno is set to indicate the error. When successful, tcsetpgrp() returns 0. Otherwise, it returns -1, and errno is set to indicate the error. EBADF fd . EINVAL pgrp. ENOTTY , , fd, , tcsetpgrp(), . EPERM pgrp , , . attributes(7). +----------------------------+----------------------------------------------------------+--------------------------+ | | | | +----------------------------+----------------------------------------------------------+--------------------------+ |tcgetpgrp(), tcsetpgrp() | | MT-Safe | +----------------------------+----------------------------------------------------------+--------------------------+ ioctl TIOCGPGRP TIOCSPGRP. POSIX.1-2008. POSIX.1-2001. ioctl 4.2BSD. POSIX. . setpgid(2), setsid(2), credentials(7) Azamat Hackimov , Dmitry Bolkhovskikh , Yuri Kozlov ; GNU 3 , . . , , . Linux man-pages 6.06 31 2023 . tcgetpgrp(3)