Skip to content

Commit

Permalink
task_stack_info increase task_name length to match NuttX CONFIG_TASK_…
Browse files Browse the repository at this point in the history
…NAME_SIZE
  • Loading branch information
dagar committed Jul 26, 2019
1 parent 9aff6d7 commit c546f87
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
4 changes: 1 addition & 3 deletions msg/task_stack_info.msg
Original file line number Diff line number Diff line change
Expand Up @@ -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
10 changes: 6 additions & 4 deletions src/modules/load_mon/load_mon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
}
Expand Down

0 comments on commit c546f87

Please sign in to comment.