qemu/chardev/char-fd.c
/* open a character device to a unix fd */
open a character device to a unix fd
open a character device to a unix fd
void qemu_chr_open_fd(Chardev *chr,
                      int fd_in, int fd_out)
{
    FDChardev *s = FD_CHARDEV(chr);
    char *name;
    s->ioc_in = QIO_CHANNEL(qio_channel_file_new_fd(fd_in));
    name = g_strdup_printf("chardev-file-in-%s", chr->label);
    qio_channel_set_name(QIO_CHANNEL(s->ioc_in), name);
    g_free(name);
    s->ioc_out = QIO_CHANNEL(qio_channel_file_new_fd(fd_out));
    name = g_strdup_printf("chardev-file-out-%s", chr->label);
    qio_channel_set_name(QIO_CHANNEL(s->ioc_out), name);
    g_free(name);
    qemu_set_nonblock(fd_out);
}
void qemu_chr_open_fd ( Chardev * chr , int fd_in , int fd_out ) { FDChardev * s = FD_CHARDEV ( chr ) ; char * name ; s -> ioc_in = QIO_CHANNEL ( qio_channel_file_new_fd ( fd_in ) ) ; name = g_strdup_printf ( " " , chr -> label ) ; qio_channel_set_name ( QIO_CHANNEL ( s -> ioc_in ) , name ) ; g_free ( name ) ; s -> ioc_out = QIO_CHANNEL ( qio_channel_file_new_fd ( fd_out ) ) ; name = g_strdup_printf ( " " , chr -> label ) ; qio_channel_set_name ( QIO_CHANNEL ( s -> ioc_out ) , name ) ; g_free ( name ) ; qemu_set_nonblock ( fd_out ) ; }
open a character device to a unix fd
open a character device to a unix fd