Zephyr API Documentation 4.0.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
errno_private.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2018 Intel Corporation.
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7#ifndef ZEPHYR_INCLUDE_SYS_ERRNO_PRIVATE_H_
8#define ZEPHYR_INCLUDE_SYS_ERRNO_PRIVATE_H_
9
10#include <zephyr/toolchain.h>
11#include <zephyr/types.h> /* For Z_THREAD_LOCAL */
12
13#ifdef __cplusplus
14extern "C" {
15#endif
16
17/* NOTE: located here to avoid include dependency loops between errno.h
18 * and kernel.h
19 */
20
21#ifdef CONFIG_LIBC_ERRNO
22#include <errno.h>
23
24static inline int *z_errno(void)
25{
26 return &errno;
27}
28
29#elif defined(CONFIG_ERRNO_IN_TLS)
30extern Z_THREAD_LOCAL int z_errno_var;
31
32static inline int *z_errno(void)
33{
34 return &z_errno_var;
35}
36#else
45__syscall int *z_errno(void);
46
47#endif /* CONFIG_ERRNO_IN_TLS */
48
49#ifdef __cplusplus
50}
51#endif
52
53#if !defined(CONFIG_ERRNO_IN_TLS) && !defined(CONFIG_LIBC_ERRNO)
54#include <zephyr/syscalls/errno_private.h>
55#endif /* CONFIG_ERRNO_IN_TLS */
56
57#endif /* ZEPHYR_INCLUDE_SYS_ERRNO_PRIVATE_H_ */
System error numbers.
#define errno
Definition errno.h:37
Macros to abstract toolchain specific capabilities.