mirror of
https://github.com/espressif/ESP8266_RTOS_SDK.git
synced 2025-08-06 07:00:05 +08:00
feat(freertos): add thread local private "errno"
This commit is contained in:
@ -17,6 +17,8 @@
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "freertos/task.h"
|
||||
|
||||
#define ERRNO_TLS_INDEX (configNUM_THREAD_LOCAL_STORAGE_POINTERS - 1)
|
||||
|
||||
static struct _reent impure_data;
|
||||
struct _reent *_global_impure_ptr = &impure_data;
|
||||
|
||||
@ -44,3 +46,8 @@ struct _reent *__getreent()
|
||||
#endif
|
||||
return _global_impure_ptr;
|
||||
}
|
||||
|
||||
int *__errno(void)
|
||||
{
|
||||
return (int *)pvTaskGetThreadLocalStorageBufferPointer(NULL, ERRNO_TLS_INDEX);
|
||||
}
|
||||
|
@ -128,10 +128,15 @@ NVIC value of 255. */
|
||||
#define configUSE_NEWLIB_REENTRANT 1
|
||||
#endif
|
||||
|
||||
/**
|
||||
* 0: LwIP
|
||||
* 1: pthread (optional)
|
||||
* 2: errno
|
||||
*/
|
||||
#ifdef CONFIG_ENABLE_PTHREAD
|
||||
#define configNUM_THREAD_LOCAL_STORAGE_POINTERS 2
|
||||
#define configNUM_THREAD_LOCAL_STORAGE_POINTERS 3
|
||||
#else
|
||||
#define configNUM_THREAD_LOCAL_STORAGE_POINTERS 1
|
||||
#define configNUM_THREAD_LOCAL_STORAGE_POINTERS 2
|
||||
#endif
|
||||
#define configTHREAD_LOCAL_STORAGE_DELETE_CALLBACKS 1
|
||||
|
||||
|
Reference in New Issue
Block a user