Superuser/jni/su/pts.c
/**
 * Thread process. Wait for a SIGWINCH to be received, then update 
 * the terminal size.
 */
Thread process. Wait for a SIGWINCH to be received, then update
the terminal size.
Thread process . Wait for a SIGWINCH to be received then update the terminal size .
static void *watch_sigwinch(void *data) {
    sigset_t winch;
    int sig;
    int master = ((int *)data)[0];
    int slave = ((int *)data)[1];
    sigemptyset(&winch);
    sigaddset(&winch, SIGWINCH);
    do {
        sigwait(&winch, &sig);
        if (closing_time) break;
        struct winsize w;
        if (ioctl(master, TIOCGWINSZ, &w) == -1) {
            continue;
        }
        ioctl(slave, TIOCSWINSZ, &w);
    } while (1);
    free(data);
    return NULL;
}
static void * watch_sigwinch ( void * data ) { sigset_t winch ; int sig ; int master = ( ( int * ) data ) [ 0 ] ; int slave = ( ( int * ) data ) [ 1 ] ; sigemptyset ( & winch ) ; sigaddset ( & winch , SIGWINCH ) ; do { sigwait ( & winch , & sig ) ; if ( closing_time ) break ; struct winsize w ; if ( ioctl ( master , TIOCGWINSZ , & w ) == -1 ) { continue ; } ioctl ( slave , TIOCSWINSZ , & w ) ; } while ( 1 ) ; free ( data ) ; return NULL ; }
Thread process.
Thread process .
// Wait for a SIGWINCH // Get the new terminal size // Set the new terminal size