Debian Codegraph @

src/basic/errno-list.h

raw
1 /* SPDX-License-Identifier: LGPL-2.1-or-later */
2 #pragma once
3
4 #include "basic-forward.h"
5
6 const char* errno_name_no_fallback(int id) _const_;
7 int errno_from_name(const char *name) _pure_;
8
9 static inline bool errno_is_valid(int n) {
10 return n > 0 && n <= ERRNO_MAX;
11 }
12
13 #define ERRNO_NAME_BUF_LEN DECIMAL_STR_MAX(int)
14 /* Like errno_name, but always returns a string. */
15 const char* errno_name(int id, char buf[static ERRNO_NAME_BUF_LEN]);
16
17 /* A helper to print the errno "name" or number if name is not defined. */
18 #define ERRNO_NAME(errnum) errno_name(errnum, (char[ERRNO_NAME_BUF_LEN]){})