xiaoxiang781216 commented on a change in pull request #5915: URL: https://github.com/apache/incubator-nuttx/pull/5915#discussion_r839742024
########## File path: include/nuttx/sched_note.h ########## @@ -188,11 +188,11 @@ struct note_common_s #ifdef CONFIG_SMP uint8_t nc_cpu; /* CPU thread/task running on */ #endif - uint8_t nc_pid[2]; /* ID of the thread/task */ + uint8_t nc_pid[sizeof(pid_t)]; /* ID of the thread/task */ #ifdef CONFIG_SCHED_INSTRUMENTATION_HIRES - uint8_t nc_systime_sec[4]; /* Time when note was buffered (sec) */ - uint8_t nc_systime_nsec[4]; /* Time when note was buffered (nsec) */ + uint8_t nc_systime_sec[sizeof(time_t)]; /* Time when note was buffered (sec) */ + uint8_t nc_systime_nsec[sizeof(long)]; /* Time when note was buffered (nsec) */ #else uint8_t nc_systime[4]; /* Time when note was buffered */ Review comment: sizeof(clock_t) ########## File path: sched/sched/sched_note.c ########## @@ -144,25 +178,15 @@ static void note_common(FAR struct tcb_s *tcb, #ifdef CONFIG_SMP note->nc_cpu = tcb->cpu; #endif - note->nc_pid[0] = (uint8_t)(tcb->pid & 0xff); - note->nc_pid[1] = (uint8_t)((tcb->pid >> 8) & 0xff); + sched_note_flatten(note->nc_pid, &tcb->pid, sizeof(tcb->pid)); #ifdef CONFIG_SCHED_INSTRUMENTATION_HIRES - note->nc_systime_nsec[0] = (uint8_t)(ts.tv_nsec & 0xff); - note->nc_systime_nsec[1] = (uint8_t)((ts.tv_nsec >> 8) & 0xff); - note->nc_systime_nsec[2] = (uint8_t)((ts.tv_nsec >> 16) & 0xff); - note->nc_systime_nsec[3] = (uint8_t)((ts.tv_nsec >> 24) & 0xff); - note->nc_systime_sec[0] = (uint8_t)(ts.tv_sec & 0xff); - note->nc_systime_sec[1] = (uint8_t)((ts.tv_sec >> 8) & 0xff); - note->nc_systime_sec[2] = (uint8_t)((ts.tv_sec >> 16) & 0xff); - note->nc_systime_sec[3] = (uint8_t)((ts.tv_sec >> 24) & 0xff); + sched_note_flatten(note->nc_systime_nsec, &ts.tv_nsec, sizeof(ts.tv_nsec)); + sched_note_flatten(note->nc_systime_sec, &ts.tv_sec, sizeof(ts.tv_sec)); #else /* Save the LS 32-bits of the system timer in little endian order */ - note->nc_systime[0] = (uint8_t)(systime & 0xff); - note->nc_systime[1] = (uint8_t)((systime >> 8) & 0xff); - note->nc_systime[2] = (uint8_t)((systime >> 16) & 0xff); - note->nc_systime[3] = (uint8_t)((systime >> 24) & 0xff); + sched_note_flatten(note->nc_systime, &systime, sizeof(systime)); Review comment: change systime to clock_t ########## File path: include/nuttx/sched_note.h ########## @@ -188,11 +188,11 @@ struct note_common_s #ifdef CONFIG_SMP uint8_t nc_cpu; /* CPU thread/task running on */ #endif - uint8_t nc_pid[2]; /* ID of the thread/task */ + uint8_t nc_pid[sizeof(pid_t)]; /* ID of the thread/task */ Review comment: merge to previous patch ########## File path: sched/sched/sched_note.c ########## @@ -144,25 +205,15 @@ static void note_common(FAR struct tcb_s *tcb, #ifdef CONFIG_SMP Review comment: Not change? -- 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: commits-unsubscr...@nuttx.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org