bus/pci: use SPDX tags in 6WIND copyrighted files
[dpdk.git] / lib / librte_vhost / socket.c
index d44a0f1..6e3857e 100644 (file)
@@ -433,6 +433,7 @@ static int
 vhost_user_reconnect_init(void)
 {
        int ret;
+       char thread_name[RTE_MAX_THREAD_NAME_LEN];
 
        ret = pthread_mutex_init(&reconn_list.mutex, NULL);
        if (ret < 0) {
@@ -443,12 +444,20 @@ vhost_user_reconnect_init(void)
 
        ret = pthread_create(&reconn_tid, NULL,
                             vhost_user_client_reconnect, NULL);
-       if (ret < 0) {
+       if (ret != 0) {
                RTE_LOG(ERR, VHOST_CONFIG, "failed to create reconnect thread");
                if (pthread_mutex_destroy(&reconn_list.mutex)) {
                        RTE_LOG(ERR, VHOST_CONFIG,
                                "failed to destroy reconnect mutex");
                }
+       } else {
+               snprintf(thread_name, RTE_MAX_THREAD_NAME_LEN,
+                        "vhost-reconn");
+
+               if (rte_thread_setname(reconn_tid, thread_name)) {
+                       RTE_LOG(DEBUG, VHOST_CONFIG,
+                               "failed to set reconnect thread name");
+               }
        }
 
        return ret;
@@ -649,9 +658,8 @@ rte_vhost_driver_register(const char *path, uint64_t flags)
        if ((flags & RTE_VHOST_USER_CLIENT) != 0) {
                vsocket->reconnect = !(flags & RTE_VHOST_USER_NO_RECONNECT);
                if (vsocket->reconnect && reconn_tid == 0) {
-                       if (vhost_user_reconnect_init() < 0) {
+                       if (vhost_user_reconnect_init() != 0)
                                goto out_mutex;
-                       }
                }
        } else {
                vsocket->is_server = true;
@@ -808,7 +816,7 @@ rte_vhost_driver_start(const char *path)
        if (fdset_tid == 0) {
                int ret = pthread_create(&fdset_tid, NULL, fdset_event_dispatch,
                                     &vhost_user.fdset);
-               if (ret < 0)
+               if (ret != 0)
                        RTE_LOG(ERR, VHOST_CONFIG,
                                "failed to create fdset handling thread");
        }