Print this page
14249 pseudo-terminal nomenclature should reflect POSIX
Change-Id: Ib4a3cef899ff4c71b09cb0dc6878863c5e8357bc

*** 1055,1071 **** exit(EXIT_FAILURE); } if ((p = open("/dev/ptmx", O_RDWR)) == -1) fatalperror(f, "cannot open /dev/ptmx"); if (grantpt(p) == -1) ! fatal(f, "could not grant slave pty"); if (unlockpt(p) == -1) ! fatal(f, "could not unlock slave pty"); if ((line = ptsname(p)) == NULL) ! fatal(f, "could not enable slave pty"); if ((t = open(line, O_RDWR)) == -1) ! fatal(f, "could not open slave pty"); if (ioctl(t, I_PUSH, "ptem") == -1) fatalperror(f, "ioctl I_PUSH ptem"); if (ioctl(t, I_PUSH, "ldterm") == -1) fatalperror(f, "ioctl I_PUSH ldterm"); if (ioctl(t, I_PUSH, "ttcompat") == -1) --- 1055,1071 ---- exit(EXIT_FAILURE); } if ((p = open("/dev/ptmx", O_RDWR)) == -1) fatalperror(f, "cannot open /dev/ptmx"); if (grantpt(p) == -1) ! fatal(f, "could not grant subsidiary pty"); if (unlockpt(p) == -1) ! fatal(f, "could not unlock subsidiary pty"); if ((line = ptsname(p)) == NULL) ! fatal(f, "could not enable subsidiary pty"); if ((t = open(line, O_RDWR)) == -1) ! fatal(f, "could not open subsidiary pty"); if (ioctl(t, I_PUSH, "ptem") == -1) fatalperror(f, "ioctl I_PUSH ptem"); if (ioctl(t, I_PUSH, "ldterm") == -1) fatalperror(f, "ioctl I_PUSH ldterm"); if (ioctl(t, I_PUSH, "ttcompat") == -1)
*** 1126,1138 **** if (ioctl(t, TCSETS, &tp) == -1) fatalperror(f, "ioctl TCSETS"); /* * System V ptys allow the TIOC{SG}WINSZ ioctl to be ! * issued on the master side of the pty. Luckily, that's * the only tty ioctl we need to do do, so we can close the ! * slave side in the parent process after the fork. */ (void) ioctl(p, TIOCSWINSZ, &win); pid = fork(); if (pid < 0) --- 1126,1138 ---- if (ioctl(t, TCSETS, &tp) == -1) fatalperror(f, "ioctl TCSETS"); /* * System V ptys allow the TIOC{SG}WINSZ ioctl to be ! * issued on the manager side of the pty. Luckily, that's * the only tty ioctl we need to do do, so we can close the ! * subsidiary side in the parent process after the fork. */ (void) ioctl(p, TIOCSWINSZ, &win); pid = fork(); if (pid < 0)
*** 1159,1174 **** /* controlling tty */ if (setsid() == -1) fatalperror(f, "setsid"); if ((tt = open(line, O_RDWR)) == -1) ! fatalperror(f, "could not re-open slave pty"); if (close(p) == -1) ! fatalperror(f, "error closing pty master"); if (close(t) == -1) ! fatalperror(f, "error closing pty slave" " opened before session established"); /* * If this fails we may or may not be able to output an * error message. */ --- 1159,1174 ---- /* controlling tty */ if (setsid() == -1) fatalperror(f, "setsid"); if ((tt = open(line, O_RDWR)) == -1) ! fatalperror(f, "could not re-open subsidiary pty"); if (close(p) == -1) ! fatalperror(f, "error closing pty manager"); if (close(t) == -1) ! fatalperror(f, "error closing pty subsidiary" " opened before session established"); /* * If this fails we may or may not be able to output an * error message. */
*** 1207,1218 **** (void) ioctl(f, FIONBIO, &on); (void) ioctl(p, FIONBIO, &on); /* * Must ignore SIGTTOU, otherwise we'll stop ! * when we try and set slave pty's window shape ! * (our controlling tty is the master pty). * Likewise, we don't want any of the tty-generated * signals from chars passing through. */ (void) sigset(SIGTSTP, SIG_IGN); (void) sigset(SIGINT, SIG_IGN); --- 1207,1218 ---- (void) ioctl(f, FIONBIO, &on); (void) ioctl(p, FIONBIO, &on); /* * Must ignore SIGTTOU, otherwise we'll stop ! * when we try and set subsidiary pty's window shape ! * (our controlling tty is the manager pty). * Likewise, we don't want any of the tty-generated * signals from chars passing through. */ (void) sigset(SIGTSTP, SIG_IGN); (void) sigset(SIGINT, SIG_IGN);