1 2 3 4 5 6 7 8
#include <termios.h> #include <sys/ioctl.h> #include <unistd.h> int tcsetpgrp(int fildes, pid_t pgrpid) { return ioctl(fildes, TIOCSPGRP, &pgrpid); }