vdpa/mlx5: improve portability of thread naming
authorThomas Monjalon <thomas@monjalon.net>
Wed, 21 Apr 2021 17:59:23 +0000 (19:59 +0200)
committerChenbo Xia <chenbo.xia@intel.com>
Wed, 28 Apr 2021 03:13:49 +0000 (05:13 +0200)
The function pthread_setname_np is non-portable,
so it may be unavailable in old glibc or other systems.
The function rte_thread_setname is workarounding portability issues.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Reviewed-by: Chenbo Xia <chenbo.xia@intel.com>
Acked-by: Matan Azrad <matan@nvidia.com>
Reviewed-by: Chengwen Feng <fengchengwen@huawei.com>
drivers/vdpa/mlx5/mlx5_vdpa_event.c

index 404e135..ca6e985 100644 (file)
@@ -544,7 +544,7 @@ mlx5_vdpa_cqe_event_setup(struct mlx5_vdpa_priv *priv)
                        goto error;
                }
                snprintf(name, sizeof(name), "vDPA-mlx5-%d", priv->vid);
-               ret = pthread_setname_np(priv->timer_tid, name);
+               ret = rte_thread_setname(priv->timer_tid, name);
                if (ret) {
                        DRV_LOG(ERR, "Failed to set timer thread name.");
                        return -1;