zephyr/kernel/errno.c
Paul Sokolovsky 8cc6f6ddd6 kernel: errno: Use per-thread accessor function compatible with Newlib
Newlib names this function __errno(), so if we want Zephyr to work
with Newlib seamlessly, it's better to just follow Newlib's naming
convention for Zephyr's own minimal libc.

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2017-05-10 20:54:56 -04:00

29 lines
531 B
C

/*
* Copyright (c) 2015 Wind River Systems, Inc.
*
* SPDX-License-Identifier: Apache-2.0
*/
/** @file
*
* @brief Per-thread errno accessor function
*
* Allow accessing the errno for the current thread without involving the
* context switching.
*/
#include <kernel_structs.h>
/*
* Define _k_neg_eagain for use in assembly files as errno.h is
* not assembly language safe.
* FIXME: wastes 4 bytes
*/
const int _k_neg_eagain = -EAGAIN;
#ifdef CONFIG_ERRNO
int *__errno(void)
{
return &_current->errno_var;
}
#endif