mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-08-19 09:38:32 -04:00
Replace sprintf with snprintf (#802)
This change necessitates the introduction of 2 new APIs: void vTaskListTasks( char * pcWriteBuffer, size_t uxBufferLength ); void vTaskGetRunTimeStatistics( char * pcWriteBuffer, size_t uxBufferLength ); These 2 APIs behave exactly as vTaskList and vTaskGetRunTimeStats except the fact that they take the length of the pcWriteBuffer as the second argument to ensure that we do not write past the buffer. vTaskList and vTaskGetRunTimeStats assume that the length of the buffer is configSTATS_BUFFER_MAX_LENGTH which defaults to 0xFFFF. This is done to ensure that the existing applications do not break. New applications should use the new APIs to avoid memory corruption.
This commit is contained in:
parent
84bdb05bd2
commit
96d6190b61
3 changed files with 328 additions and 64 deletions
|
@ -2154,20 +2154,20 @@
|
|||
#define traceRETURN_vTaskExitCriticalFromISR()
|
||||
#endif
|
||||
|
||||
#ifndef traceENTER_vTaskList
|
||||
#define traceENTER_vTaskList( pcWriteBuffer )
|
||||
#ifndef traceENTER_vTaskListTasks
|
||||
#define traceENTER_vTaskListTasks( pcWriteBuffer, uxBufferLength )
|
||||
#endif
|
||||
|
||||
#ifndef traceRETURN_vTaskList
|
||||
#define traceRETURN_vTaskList()
|
||||
#ifndef traceRETURN_vTaskListTasks
|
||||
#define traceRETURN_vTaskListTasks()
|
||||
#endif
|
||||
|
||||
#ifndef traceENTER_vTaskGetRunTimeStats
|
||||
#define traceENTER_vTaskGetRunTimeStats( pcWriteBuffer )
|
||||
#ifndef traceENTER_vTaskGetRunTimeStatistics
|
||||
#define traceENTER_vTaskGetRunTimeStatistics( pcWriteBuffer, uxBufferLength )
|
||||
#endif
|
||||
|
||||
#ifndef traceRETURN_vTaskGetRunTimeStats
|
||||
#define traceRETURN_vTaskGetRunTimeStats()
|
||||
#ifndef traceRETURN_vTaskGetRunTimeStatistics
|
||||
#define traceRETURN_vTaskGetRunTimeStatistics()
|
||||
#endif
|
||||
|
||||
#ifndef traceENTER_uxTaskResetEventItemValue
|
||||
|
@ -2686,6 +2686,10 @@
|
|||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef configSTATS_BUFFER_MAX_LENGTH
|
||||
#define configSTATS_BUFFER_MAX_LENGTH 0xFFFF
|
||||
#endif
|
||||
|
||||
#ifndef configSTACK_DEPTH_TYPE
|
||||
|
||||
/* Defaults to uint16_t for backward compatibility, but can be overridden
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue