diff --git a/sched/init/nx_start.c b/sched/init/nx_start.c index d4bc7f1bc4..f912e57c48 100644 --- a/sched/init/nx_start.c +++ b/sched/init/nx_start.c @@ -278,9 +278,9 @@ static struct task_tcb_s g_idletcb[CONFIG_SMP_NCPUS]; #if CONFIG_TASK_NAME_SIZE <= 0 || !defined(CONFIG_SMP) # ifdef CONFIG_SMP -static const char g_idlename[] = "CPU Idle"; +static const char g_idlename[] = "CPU_Idle"; # else -static const char g_idlename[] = "Idle Task"; +static const char g_idlename[] = "Idle_Task"; # endif #endif diff --git a/sched/task/task_setup.c b/sched/task/task_setup.c index 157d0def9d..3adf7df257 100644 --- a/sched/task/task_setup.c +++ b/sched/task/task_setup.c @@ -25,6 +25,7 @@ #include #include +#include #include #include #include @@ -484,9 +485,24 @@ static int nxthread_setup_scheduler(FAR struct tcb_s *tcb, int priority, static void nxtask_setup_name(FAR struct task_tcb_s *tcb, FAR const char *name) { + FAR char *dst = tcb->cmn.name; + int i; + /* Copy the name into the TCB */ - strlcpy(tcb->cmn.name, name, sizeof(tcb->cmn.name)); + for (i = 0; i < CONFIG_TASK_NAME_SIZE; i++) + { + char c = *name++; + + if (c == '\0') + { + break; + } + + *dst++ = isspace(c) ? '_' : c; + } + + *dst = '\0'; } #else # define nxtask_setup_name(t,n)