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 char *program_invocation_name __attribute__((weak)) = ""; 19 char *program_invocation_short_name __attribute__((weak)) = ""; 20 #else 21 #define SET_ERRNO(v) do { } while (0) 22 #define program_invocation_name "" 23 #define program_invocation_short_name "" 24 #endif 25 26 27 /* errno codes all ensure that they will not conflict with a valid pointer 28 * because they all correspond to the highest addressable memory page. 29 */ 30 #define MAX_ERRNO 4095 31 32 #endif /* _NOLIBC_ERRNO_H */ 33