int tap_open(char *ifname, int ifname_size, int *vnet_hdr,

             int vnet_hdr_required, int mq_required, Error **errp)

{

    /* FIXME error_setg(errp, ...) on failure */

    char  dev[10]="";

    int fd;

    if( (fd = tap_alloc(dev, sizeof(dev))) < 0 ){

       fprintf(stderr, "Cannot allocate TAP device\n");

       return -1;

    }

    pstrcpy(ifname, ifname_size, dev);

    if (*vnet_hdr) {

        /* Solaris doesn't have IFF_VNET_HDR */

        *vnet_hdr = 0;



        if (vnet_hdr_required && !*vnet_hdr) {

            error_report("vnet_hdr=1 requested, but no kernel "

                         "support for IFF_VNET_HDR available");

            close(fd);

            return -1;

        }

    }

    fcntl(fd, F_SETFL, O_NONBLOCK);

    return fd;

}

int tap_open(char *ifname, int ifname_size, int *vnet_hdr,

             int vnet_hdr_required, int mq_required, Error **errp)

{

    

    char  dev[10]="";

    int fd;

    if( (fd = tap_alloc(dev, sizeof(dev))) < 0 ){

       fprintf(stderr, "Cannot allocate TAP device\n");

       return -1;

    }

    pstrcpy(ifname, ifname_size, dev);

    if (*vnet_hdr) {

        

        *vnet_hdr = 0;



        if (vnet_hdr_required && !*vnet_hdr) {

            error_report("vnet_hdr=1 requested, but no kernel "

                         "support for IFF_VNET_HDR available");

            close(fd);

            return -1;

        }

    }

    fcntl(fd, F_SETFL, O_NONBLOCK);

    return fd;

}

       return -1;        return -1;        return -1;        return -1;        return -1;     if( (fd = tap_alloc(dev, sizeof(dev))) < 0 ){        fprintf(stderr, "Cannot allocate TAP device\n");        return -1;             error_report("vnet_hdr=1 requested, but no kernel "                          "support for IFF_VNET_HDR available");
int FUNC_0(char *VAR_0, int VAR_1, int *VAR_2,

             int VAR_3, int VAR_4, Error **VAR_5)

{

    

    char  VAR_6[10]="";

    int VAR_7;

    if( (VAR_7 = tap_alloc(VAR_6, sizeof(VAR_6))) < 0 ){

       fprintf(stderr, "Cannot allocate TAP device\n");

       return -1;

    }

    pstrcpy(VAR_0, VAR_1, VAR_6);

    if (*VAR_2) {

        

        *VAR_2 = 0;



        if (VAR_3 && !*VAR_2) {

            error_report("VAR_2=1 requested, but no kernel "

                         "support for IFF_VNET_HDR available");

            close(VAR_7);

            return -1;

        }

    }

    fcntl(VAR_7, F_SETFL, O_NONBLOCK);

    return VAR_7;

}

int FUNC_0(char *VAR_0, int VAR_1, int *VAR_2,
int VAR_3, int VAR_4, Error **VAR_5)
{ char  VAR_6[10]=""; int VAR_7; if( (VAR_7 = tap_alloc(VAR_6, sizeof(VAR_6))) < 0 ){ fprintf(stderr, "Cannot allocate TAP device\n"); return -1; } pstrcpy(VAR_0, VAR_1, VAR_6); if (*VAR_2) { *VAR_2 = 0; if (VAR_3 && !*VAR_2) { error_report("VAR_2=1 requested, but no kernel "
"support for IFF_VNET_HDR available"); close(VAR_7); return -1; } } fcntl(VAR_7, F_SETFL, O_NONBLOCK); return VAR_7; }