You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2022/11/20 12:55:04 UTC

[incubator-nuttx-apps] branch master updated: netutils: correct iperf thread name

This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx-apps.git


The following commit(s) were added to refs/heads/master by this push:
     new 63e3c6c52 netutils: correct iperf thread name
63e3c6c52 is described below

commit 63e3c6c52180d54133ee3bf1499c485714745b15
Author: chao an <an...@xiaomi.com>
AuthorDate: Sun Nov 20 17:35:58 2022 +0800

    netutils: correct iperf thread name
    
    Signed-off-by: chao an <an...@xiaomi.com>
---
 netutils/iperf/iperf.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/netutils/iperf/iperf.c b/netutils/iperf/iperf.c
index 0d83974b4..042963cfb 100644
--- a/netutils/iperf/iperf.c
+++ b/netutils/iperf/iperf.c
@@ -22,6 +22,7 @@
  * Included Files
  ****************************************************************************/
 
+#include <sys/prctl.h>
 #include <sys/socket.h>
 #include <sys/time.h>
 #include <net/if.h>
@@ -234,6 +235,8 @@ static void iperf_report_task(void *arg)
   uintmax_t now_len;
   int ret;
 
+  prctl(PR_SET_NAME, IPERF_REPORT_TASK_NAME);
+
   now_len = s_iperf_ctrl.total_len;
   ret = clock_gettime(CLOCK_MONOTONIC, &now);
   if (ret != 0)
@@ -308,7 +311,7 @@ static int iperf_start_report(void)
   pthread_attr_setstacksize(&attr, IPERF_REPORT_TASK_STACK);
 
   ret = pthread_create(&thread, &attr, (void *)iperf_report_task,
-                       IPERF_REPORT_TASK_NAME);
+                       NULL);
   if (ret != 0)
     {
       printf("iperf_thread: pthread_create failed: %d, %s\n",
@@ -666,6 +669,8 @@ static int iperf_run_tcp_client(void)
 
 static void iperf_task_traffic(void *arg)
 {
+  prctl(PR_SET_NAME, IPERF_TRAFFIC_TASK_NAME);
+
   if (iperf_is_udp_client())
     {
       iperf_run_udp_client();
@@ -772,7 +777,7 @@ int iperf_start(struct iperf_cfg_t *cfg)
   pthread_attr_setschedparam(&attr, &param);
   pthread_attr_setstacksize(&attr, IPERF_TRAFFIC_TASK_STACK);
   ret = pthread_create(&thread, &attr, (void *)iperf_task_traffic,
-                       IPERF_TRAFFIC_TASK_NAME);
+                       NULL);
 
   if (ret != 0)
     {