anchao commented on code in PR #17455:
URL: https://github.com/apache/nuttx/pull/17455#discussion_r2601863685
##########
drivers/note/note_driver.c:
##########
@@ -2095,38 +2093,46 @@ void sched_note_filter_tag(FAR struct
note_filter_named_tag_s *oldf,
*
* Input Parameters:
* PID - Task ID
+ * buf - A writable buffer to hold the task name
+ * len - The length of the buffer
*
* Returned Value:
- * Return name if task name can be retrieved, otherwise NULL
+ * None
+ *
****************************************************************************/
-FAR const char *note_get_taskname(pid_t pid)
+void note_get_taskname(pid_t pid, FAR char *buf, size_t len)
Review Comment:
```suggestion
FAR char *note_get_taskname(pid_t pid, FAR char *buf, size_t len)
{
#if CONFIG_TASK_NAME_SIZE > 0
FAR struct tcb_s *tcb = nxsched_get_tcb(pid);
if (tcb != NULL)
{
strlcpy(buf, tcb->name, len);
return buf;
}
# if defined(CONFIG_SCHED_INSTRUMENTATION_SWITCH) && \
(CONFIG_DRIVERS_NOTE_TASKNAME_BUFSIZE > 0)
else
{
FAR struct note_taskname_info_s *ti = note_find_taskname(pid);
if (ti != NULL)
{
strlcpy(buf, ti->name, len);
return buf;
}
}
# endif
#endif
return "<noname>";
}
```
##########
drivers/note/noteram_driver.c:
##########
@@ -802,8 +790,10 @@ static int noteram_dump_header(FAR struct lib_outstream_s
*s,
int cpu = 0;
#endif
+ note_get_taskname(pid, buf, TASK_NAME_SIZE);
+
ret = lib_sprintf(s, "%8s-%-3u [%d] %3" PRIu64 ".%09lu: ",
- get_taskname(pid), get_pid(pid), cpu,
+ buf, get_pid(pid), cpu,
Review Comment:
```suggestion
note_get_taskname(pid, buf, TASK_NAME_SIZE),
get_pid(pid), cpu,
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]