Hi, As using a blocking socket for a virtio device channel leads to be blocked if nobody has opened the corresponding /dev/virtio-ports within the Guest , I tried to use a non-blocking socket and to check whether the socket is writeable via FD_ISSET(). I’m wondering why a virtio device channel is always seen as writeable by the Host even if nobody has opened the corresponding /dev/virtio-ports within the Guest ? res= connect(sock, (struct sockaddr *) &server, sizeof(struct sockaddr_un)); if (res < 0) { perror("connecting stream socket"); close(sock); return(1); } else tv.tv_sec = 15; tv.tv_usec = 0; FD_ZERO(&myset); FD_SET(sock, &myset); if (select(sock+1, NULL, &myset, NULL, &tv) > 0) { len = sizeof(int); getsockopt(sock, SOL_SOCKET, SO_ERROR, (void*)(&result), &len); if (result) { fprintf(stderr, "Error in connection() %d - %s\n", result, strerror(result)); return(1); } else { if(FD_ISSET(sock,&myset)) fprintf(stderr, "connection()is O.K. \n"); } } else { fprintf(stderr, "Timeout or error() %d - %s\n", result, strerror(result)); return(1); } Did I misunderstood something ? Thanks for help.
|
_______________________________________________ libvirt-users mailing list libvirt-users@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvirt-users