task_stack_info increase task_name length to match NuttX CONFIG_TASK_NAME_SIZE

This commit is contained in:
Daniel Agar 2019-05-29 21:58:18 -04:00
parent 0dc8119c89
commit 0e949a36ee
2 changed files with 7 additions and 7 deletions

View File

@ -2,7 +2,5 @@
uint64 timestamp # time since system start (microseconds)
uint8 MAX_REPORT_TASK_NAME_LEN = 16
uint16 stack_free
char[16] task_name
char[24] task_name

View File

@ -247,12 +247,14 @@ void LoadMon::_stack_usage()
task_stack_info_s task_stack_info = {};
if (system_load.tasks[task_index].valid && system_load.tasks[task_index].tcb->pid > 0) {
if (system_load.tasks[task_index].valid && (system_load.tasks[task_index].tcb->pid > 0)) {
stack_free = up_check_tcbstack_remain(system_load.tasks[task_index].tcb);
strncpy((char *)task_stack_info.task_name, system_load.tasks[task_index].tcb->name,
task_stack_info_s::MAX_REPORT_TASK_NAME_LEN);
static_assert(sizeof(task_stack_info.task_name) == CONFIG_TASK_NAME_SIZE,
"task_stack_info.task_name must match NuttX CONFIG_TASK_NAME_SIZE");
strncpy((char *)task_stack_info.task_name, system_load.tasks[task_index].tcb->name, CONFIG_TASK_NAME_SIZE - 1);
task_stack_info.task_name[CONFIG_TASK_NAME_SIZE - 1] = '\0';
#if CONFIG_NFILE_DESCRIPTORS > 0
FAR struct task_group_s *group = system_load.tasks[task_index].tcb->group;
@ -269,7 +271,7 @@ void LoadMon::_stack_usage()
fds_free = CONFIG_NFILE_DESCRIPTORS - tcb_num_used_fds;
}
#endif
#endif // CONFIG_NFILE_DESCRIPTORS
checked_task = true;
}