Is it possible to retrieve Non blocking socket writeable status of a unix channel device ?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.

 

 

 

J.P. Ribeauville

 

P: +33.(0).1.47.17.20.49

.

Puteaux 3 Etage 5  Bureau 4

 

jpribeauville@xxxxxxxxx
http://www.axway.com

 

 

P Pensez à l’environnement avant d’imprimer.

 

 

_______________________________________________
libvirt-users mailing list
libvirt-users@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvirt-users

[Index of Archives]     [Virt Tools]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [KDE Users]

  Powered by Linux