From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ouyang Changchun Subject: [PATCH v2 1/3] vhost: add log when failing to bind a socket Date: Mon, 6 Jul 2015 10:26:51 +0800 Message-ID: <1436149613-30239-2-git-send-email-changchun.ouyang@intel.com> References: <1435807983-20383-1-git-send-email-changchun.ouyang@intel.com> <1436149613-30239-1-git-send-email-changchun.ouyang@intel.com> To: dev@dpdk.org Return-path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 5749F6849 for ; Mon, 6 Jul 2015 04:27:04 +0200 (CEST) In-Reply-To: <1436149613-30239-1-git-send-email-changchun.ouyang@intel.com> List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" It adds more readable log info if a socket fails to bind to local socket file name. Signed-off-by: Changchun Ouyang --- lib/librte_vhost/vhost_user/vhost-net-user.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/librte_vhost/vhost_user/vhost-net-user.c b/lib/librte_vhost/vhost_user/vhost-net-user.c index 87a4711..f406a94 100644 --- a/lib/librte_vhost/vhost_user/vhost-net-user.c +++ b/lib/librte_vhost/vhost_user/vhost-net-user.c @@ -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); -- 1.8.4.2