/*\r
- * FreeRTOS Kernel V10.0.1\r
+ * FreeRTOS Kernel V10.1.0\r
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.\r
*\r
* Permission is hereby granted, free of charge, to any person obtaining a copy of\r
uint8_t ucDelayAborted;\r
#endif\r
\r
+ #if( configUSE_POSIX_ERRNO == 1 )\r
+ int iTaskErrno;\r
+ #endif\r
+\r
} tskTCB;\r
\r
/* The old tskTCB name is maintained above then typedefed to the new TCB_t name\r
\r
#endif\r
\r
+/* Global POSIX errno. Its value is changed upon context switching to match\r
+the errno of the currently running task. */\r
+#if ( configUSE_POSIX_ERRNO == 1 )\r
+ int FreeRTOS_errno = 0;\r
+#endif\r
+\r
/* Other file private variables. --------------------------------*/\r
PRIVILEGED_DATA static volatile UBaseType_t uxCurrentNumberOfTasks = ( UBaseType_t ) 0U;\r
PRIVILEGED_DATA static volatile TickType_t xTickCount = ( TickType_t ) configINITIAL_TICK_COUNT;\r
/* Check for stack overflow, if configured. */\r
taskCHECK_FOR_STACK_OVERFLOW();\r
\r
+ /* Before the currently running task is switched out, save its errno. */\r
+ #if( configUSE_POSIX_ERRNO == 1 )\r
+ {\r
+ pxCurrentTCB->iTaskErrno = FreeRTOS_errno;\r
+ }\r
+ #endif\r
+\r
/* Select a new task to run using either the generic C or port\r
optimised asm code. */\r
taskSELECT_HIGHEST_PRIORITY_TASK(); /*lint !e9079 void * is used as this macro is used with timers and co-routines too. Alignment is known to be fine as the type of the pointer stored and retrieved is the same. */\r
traceTASK_SWITCHED_IN();\r
\r
+ /* After the new task is switched in, update the global errno. */\r
+ #if( configUSE_POSIX_ERRNO == 1 )\r
+ {\r
+ FreeRTOS_errno = pxCurrentTCB->iTaskErrno;\r
+ }\r
+ #endif\r
+\r
#if ( configUSE_NEWLIB_REENTRANT == 1 )\r
{\r
/* Switch Newlib's _impure_ptr variable to point to the _reent\r
\r
#if ( configUSE_MUTEXES == 1 )\r
\r
- void *pvTaskIncrementMutexHeldCount( void )\r
+ TaskHandle_t pvTaskIncrementMutexHeldCount( void )\r
{\r
/* If xSemaphoreCreateMutex() is called before any tasks have been created\r
then pxCurrentTCB will be NULL. */\r
\r
#include "freertos_tasks_c_additions.h"\r
\r
- static void freertos_tasks_c_additions_init( void )\r
- {\r
- #ifdef FREERTOS_TASKS_C_ADDITIONS_INIT\r
+ #ifdef FREERTOS_TASKS_C_ADDITIONS_INIT\r
+ static void freertos_tasks_c_additions_init( void )\r
+ {\r
FREERTOS_TASKS_C_ADDITIONS_INIT();\r
- #endif\r
- }\r
+ }\r
+ #endif\r
\r
#endif\r
\r