xref: /linux/tools/include/nolibc/errno.h (revision fb7399cf2d0b33825b8039f95c45395c7deba25c)
1 /* SPDX-License-Identifier: LGPL-2.1 OR MIT */
2 /*
3  * Minimal errno definitions for NOLIBC
4  * Copyright (C) 2017-2022 Willy Tarreau <w@1wt.eu>
5  */
6 
7 /* make sure to include all global symbols */
8 #include "nolibc.h"
9 
10 #ifndef _NOLIBC_ERRNO_H
11 #define _NOLIBC_ERRNO_H
12 
13 #include <linux/errno.h>
14 
15 #ifndef NOLIBC_IGNORE_ERRNO
16 #define SET_ERRNO(v) do { errno = (v); } while (0)
17 int errno __attribute__((weak));
18 #else
19 #define SET_ERRNO(v) do { } while (0)
20 #endif
21 
22 
23 /* errno codes all ensure that they will not conflict with a valid pointer
24  * because they all correspond to the highest addressable memory page.
25  */
26 #define MAX_ERRNO 4095
27 
28 #endif /* _NOLIBC_ERRNO_H */
29