Lines Matching refs:ttyfd
97 static int ttyfd = -1;
153 if (ttyfd != -1)
154 close(ttyfd);
155 if ((ttyfd = open("/dev/tty", O_RDWR)) == -1) {
157 if (isatty(i) && (ttyfd = dup(i)) != -1)
165 if ((err = fcntl(ttyfd, F_DUPFD, (1 << i) - 1)) != -1)
169 close(ttyfd);
170 ttyfd = err;
173 err = ioctl(ttyfd, FIOCLEX, 0);
175 err = fcntl(ttyfd, F_SETFD,
176 fcntl(ttyfd, F_GETFD, 0) | FD_CLOEXEC);
179 close(ttyfd);
180 ttyfd = -1;
188 if ((initialpgrp = tcgetpgrp(ttyfd)) < 0) {
203 if (ioctl(ttyfd, TIOCGETD, (char *)&ldisc) < 0
217 if (tcsetpgrp(ttyfd, rootpid) == -1)
226 if (tcsetpgrp(ttyfd, initialpgrp) == -1)
230 close(ttyfd);
231 ttyfd = -1;
273 if (tcsetpgrp(ttyfd, jp->ps[i].pid) != -1)
551 if (mflag && gotpid != -1 && tcgetpgrp(ttyfd) != getpid()) {
552 if (tcsetpgrp(ttyfd, getpid()) == -1)
922 if (tcsetpgrp(ttyfd, pgrp) == -1)
996 if (tcsetpgrp(ttyfd, mypgrp) == -1)