Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions include/errno.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@

#include <nuttx/compiler.h>

#if defined(CONFIG_BUILD_FLAT) || defined(__KERNEL__)
# include <nuttx/irq.h>
#endif

/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
Expand All @@ -41,12 +45,24 @@
*/

#define errno *__errno()
#if defined(CONFIG_BUILD_FLAT) || defined(__KERNEL__)
#define set_errno(e) \
do \
{ \
if (!up_interrupt_context()) \
{ \
errno = (int)(e); \
} \
} \
while (0)
#else
#define set_errno(e) \
do \
{ \
errno = (int)(e); \
} \
while (0)
#endif
#define get_errno() errno

/* Definitions of error numbers and the string that would be
Expand Down
Loading