/* ARGSUSED */ static void writeroob(int signum) { int mask; if (!dosigwinch) { /* * Start tracking window size. It doesn't matter which * order the next two are in, because we'll be unconditionally * sending a size notification in a moment. */ (void) sigset(SIGWINCH, sigwinch); dosigwinch = B_TRUE; /* * It would be bad if a SIGWINCH came in between the ioctl * and sending the data. It could result in the SIGWINCH * handler sending a good message, and then us sending an * outdated or inconsistent message. * * Instead, if the change is made before the * ioctl, the sigwinch handler will send a size message * and we'll send another, identical, one. If the change * is made after the ioctl, we'll send a message with the * old value, and then the sigwinch handler will send * a revised, correct one. */ mask = sigblock(sigmask(SIGWINCH)); if (ioctl(STDIN_FILENO, TIOCGWINSZ, &winsize) == 0) sendwindow(); sigsetmask(mask); } }
/* ARGSUSED */ static void writeroob(int signo __unused) { if (dosigwinch == 0) { sendwindow(); (void)signal(SIGWINCH, sigwinch); } dosigwinch = 1; }
/* ARGSUSED */ static void sigwinch(int signum) { struct winsize ws; if (dosigwinch && ioctl(STDIN_FILENO, TIOCGWINSZ, &ws) == 0 && memcmp(&winsize, &ws, sizeof (ws)) != 0) { winsize = ws; sendwindow(); } }
/* ARGSUSED */ static void sigwinch(int signo __unused) { struct winsize ws; if (dosigwinch && get_window_size(0, &ws) == 0 && bcmp(&ws, &winsize, sizeof(ws))) { winsize = ws; sendwindow(); } }