You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by da...@apache.org on 2021/02/20 18:11:36 UTC

[incubator-nuttx] branch master updated (533a731 -> 092d23b)

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

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


    from 533a731  libc: Move stack check stuff from libc/stdlib/ to libc/assert/
     new 72928ce  fs/procfs: Avoid the duplicated 0x prefix in pthread cmdline
     new 092d23b  pthread: Change the default name from <pthread> to <0xyyyyyyyy>

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 fs/procfs/fs_procfsproc.c      |  2 +-
 sched/pthread/pthread_create.c | 15 +++------------
 2 files changed, 4 insertions(+), 13 deletions(-)


[incubator-nuttx] 02/02: pthread: Change the default name from to <0xyyyyyyyy>

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 092d23b25db6d83a850a8d3b57f2d54201bff898
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Fri Feb 19 17:33:02 2021 +0800

    pthread: Change the default name from <pthread> to <0xyyyyyyyy>
    
    since it's very easy to identify thread through entry pointer
    
    Signed-off-by: Xiang Xiao <xi...@xiaomi.com>
---
 sched/pthread/pthread_create.c | 15 +++------------
 1 file changed, 3 insertions(+), 12 deletions(-)

diff --git a/sched/pthread/pthread_create.c b/sched/pthread/pthread_create.c
index 1b836f5..46f036a 100644
--- a/sched/pthread/pthread_create.c
+++ b/sched/pthread/pthread_create.c
@@ -26,6 +26,7 @@
 
 #include <sys/types.h>
 #include <stdbool.h>
+#include <stdio.h>
 #include <string.h>
 #include <pthread.h>
 #include <sched.h>
@@ -58,16 +59,6 @@
 const pthread_attr_t g_default_pthread_attr = PTHREAD_ATTR_INITIALIZER;
 
 /****************************************************************************
- * Private Data
- ****************************************************************************/
-
-#if CONFIG_TASK_NAME_SIZE > 0
-/* This is the name for name-less pthreads */
-
-static const char g_pthreadname[] = "<pthread>";
-#endif
-
-/****************************************************************************
  * Private Functions
  ****************************************************************************/
 
@@ -98,8 +89,8 @@ static inline void pthread_argsetup(FAR struct pthread_tcb_s *tcb,
 #if CONFIG_TASK_NAME_SIZE > 0
   /* Copy the pthread name into the TCB */
 
-  strncpy(tcb->cmn.name, g_pthreadname, CONFIG_TASK_NAME_SIZE);
-  tcb->cmn.name[CONFIG_TASK_NAME_SIZE] = '\0';
+  snprintf(tcb->cmn.name, CONFIG_TASK_NAME_SIZE,
+           "pt-%p", tcb->cmn.entry.pthread);
 #endif /* CONFIG_TASK_NAME_SIZE */
 
   /* For pthreads, args are strictly pass-by-value; that actual


[incubator-nuttx] 01/02: fs/procfs: Avoid the duplicated 0x prefix in pthread cmdline

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 72928cebcfdc7df529d844c6e770177a4aa98d9a
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Fri Feb 19 17:20:00 2021 +0800

    fs/procfs: Avoid the duplicated 0x prefix in pthread cmdline
    
    like this:
    ... <pthread> 0x0x341de68c
    by removing "0x" from format string
    
    Signed-off-by: Xiang Xiao <xi...@xiaomi.com>
---
 fs/procfs/fs_procfsproc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/procfs/fs_procfsproc.c b/fs/procfs/fs_procfsproc.c
index 9222d24..08bdac2 100644
--- a/fs/procfs/fs_procfsproc.c
+++ b/fs/procfs/fs_procfsproc.c
@@ -689,7 +689,7 @@ static ssize_t proc_cmdline(FAR struct proc_file_s *procfile,
     {
       FAR struct pthread_tcb_s *ptcb = (FAR struct pthread_tcb_s *)tcb;
 
-      linesize   = snprintf(procfile->line, STATUS_LINELEN, " 0x%p\n",
+      linesize   = snprintf(procfile->line, STATUS_LINELEN, " %p\n",
                             ptcb->arg);
       copysize   = procfs_memcpy(procfile->line, linesize, buffer,
                                  remaining, &offset);