static CharDriverState *qemu_chr_open_pty(void)

{

    struct termios tty;

    int master_fd, slave_fd;



    if (openpty(&master_fd, &slave_fd, NULL, NULL, NULL) < 0) {

        return NULL;

    }



    /* Set raw attributes on the pty. */

    cfmakeraw(&tty);

    tcsetattr(slave_fd, TCSAFLUSH, &tty);



    fprintf(stderr, "char device redirected to %s\n", ptsname(master_fd));

    return qemu_chr_open_fd(master_fd, master_fd);

}

static CharDriverState *qemu_chr_open_pty(void)

{

    struct termios tty;

    int master_fd, slave_fd;



    if (openpty(&master_fd, &slave_fd, NULL, NULL, NULL) < 0) {

        return NULL;

    }



    

    cfmakeraw(&tty);

    tcsetattr(slave_fd, TCSAFLUSH, &tty);



    fprintf(stderr, "char device redirected to %s\n", ptsname(master_fd));

    return qemu_chr_open_fd(master_fd, master_fd);

}

static CharDriverState *FUNC_0(void)

{

    struct termios VAR_0;

    int VAR_1, VAR_2;



    if (openpty(&VAR_1, &VAR_2, NULL, NULL, NULL) < 0) {

        return NULL;

    }



    

    cfmakeraw(&VAR_0);

    tcsetattr(VAR_2, TCSAFLUSH, &VAR_0);



    fprintf(stderr, "char device redirected to %s\n", ptsname(VAR_1));

    return qemu_chr_open_fd(VAR_1, VAR_1);

}

static CharDriverState *FUNC_0(void)
{ struct termios VAR_0; int VAR_1, VAR_2; if (openpty(&VAR_1, &VAR_2, NULL, NULL, NULL) < 0) { return NULL; } cfmakeraw(&VAR_0); tcsetattr(VAR_2, TCSAFLUSH, &VAR_0); fprintf(stderr, "char device redirected to %s\n", ptsname(VAR_1)); return qemu_chr_open_fd(VAR_1, VAR_1); }