vhost: add log on socket bind failure
authorOuyang Changchun <changchun.ouyang@intel.com>
Mon, 6 Jul 2015 02:26:51 +0000 (10:26 +0800)
committerThomas Monjalon <thomas.monjalon@6wind.com>
Fri, 17 Jul 2015 12:53:26 +0000 (14:53 +0200)
It adds more readable log info if a socket fails to bind to
local socket file name.

Signed-off-by: Changchun Ouyang <changchun.ouyang@intel.com>
Acked-by: Huawei Xie <huawei.xie@intel.com>
lib/librte_vhost/vhost_user/vhost-net-user.c

index 87a4711..f406a94 100644 (file)
@@ -122,8 +122,11 @@ uds_socket(const char *path)
        un.sun_family = AF_UNIX;
        snprintf(un.sun_path, sizeof(un.sun_path), "%s", path);
        ret = bind(sockfd, (struct sockaddr *)&un, sizeof(un));
-       if (ret == -1)
+       if (ret == -1) {
+               RTE_LOG(ERR, VHOST_CONFIG, "fail to bind fd:%d, remove file:%s and try again.\n",
+                       sockfd, path);
                goto err;
+       }
        RTE_LOG(INFO, VHOST_CONFIG, "bind to %s\n", path);
 
        ret = listen(sockfd, MAX_VIRTIO_BACKLOG);