You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by ag...@apache.org on 2021/12/06 08:58:47 UTC

[incubator-nuttx-apps] branch master updated: examples/thttpd: Don't touch task_tcb_s::argv field

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

aguettouche 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 9397e92  examples/thttpd: Don't touch task_tcb_s::argv field
9397e92 is described below

commit 9397e92fcd2aaff433f46953d57bffbbf423948c
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Mon Nov 29 21:38:38 2021 +0800

    examples/thttpd: Don't touch task_tcb_s::argv field
    
    since it move to task_info_s now
    
    Signed-off-by: Xiang Xiao <xi...@xiaomi.com>
---
 examples/thttpd/content/tasks/tasks.c | 54 ++++++-----------------------------
 1 file changed, 9 insertions(+), 45 deletions(-)

diff --git a/examples/thttpd/content/tasks/tasks.c b/examples/thttpd/content/tasks/tasks.c
index 0b08285..e865d20 100644
--- a/examples/thttpd/content/tasks/tasks.c
+++ b/examples/thttpd/content/tasks/tasks.c
@@ -1,5 +1,5 @@
 /****************************************************************************
- * apps/examples/thttpd/tasks/tasks.c
+ * apps/examples/thttpd/content/tasks/tasks.c
  *
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
@@ -90,62 +90,26 @@ static FAR const char *g_policynames[4] =
 void show_task(FAR struct tcb_s *tcb, FAR void *arg)
 {
   FAR const char *policy;
-  int i;
 
   /* Show task/thread status */
 
   policy = g_policynames[(tcb->flags & TCB_FLAG_POLICY_MASK) >>
                          TCB_FLAG_POLICY_SHIFT];
-  printf("%5d %3d %4s %7s%c%c %8s ",
+#if CONFIG_TASK_NAME_SIZE > 0
+  printf("%5d %3d %4s %7s%c%c %8s %s\n",
+#else
+  printf("%5d %3d %4s %7s%c%c %8s\n",
+#endif
          tcb->pid, tcb->sched_priority, policy,
          g_ttypenames[(tcb->flags & TCB_FLAG_TTYPE_MASK) >>
                       TCB_FLAG_TTYPE_SHIFT],
          tcb->flags & TCB_FLAG_NONCANCELABLE ? 'N' : ' ',
          tcb->flags & TCB_FLAG_CANCEL_PENDING ? 'P' : ' ',
-         g_statenames[tcb->task_state]);
-
-  /* Is this a task or a thread? */
-
-#ifndef CONFIG_DISABLE_PTHREAD
-  if ((tcb->flags & TCB_FLAG_TTYPE_MASK) == TCB_FLAG_TTYPE_PTHREAD)
-    {
-      FAR struct pthread_tcb_s *ptcb = (FAR struct pthread_tcb_s *)tcb;
-
-      /* It is a pthread.  Show any name assigned to the pthread via prtcl()
-       * along with the startup value.
-       */
-
+         g_statenames[tcb->task_state]
 #if CONFIG_TASK_NAME_SIZE > 0
-      printf("%s(%p)\n", tcb->name, ptcb->arg);
-#else
-      printf("pthread(%p)\n", ptcb->arg);
+         , tcb->name
 #endif
-    }
-  else
-#endif
-    {
-      FAR struct task_tcb_s *ttcb = (FAR struct task_tcb_s *)tcb;
-
-      /* Show task name and arguments */
-
-      printf("%s(", ttcb->argv[0]);
-
-      /* Special case 1st argument (no comma) */
-
-      if (ttcb->argv[1])
-        {
-         printf("%p", ttcb->argv[1]);
-        }
-
-      /* Then any additional arguments */
-
-      for (i = 2; ttcb->argv[i]; i++)
-        {
-          printf(", %p", ttcb->argv[i]);
-        }
-
-      printf(")\n");
-    }
+         );
 }
 
 /****************************************************************************