Let's not leak details from src/shared and src/libsystemd into src/basic, even though you can't actually do anything useful with just forward declarations from src/shared. The sd-forward.h header is put in src/libsystemd/sd-common as we don't have a directory for shared internal headers for libsystemd yet. Let's also rename forward.h to basic-forward.h to keep things self-explanatory.
19 lines
597 B
C
19 lines
597 B
C
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
|
#pragma once
|
|
|
|
#include "basic-forward.h"
|
|
|
|
const char* errno_name_no_fallback(int id) _const_;
|
|
int errno_from_name(const char *name) _pure_;
|
|
|
|
static inline bool errno_is_valid(int n) {
|
|
return n > 0 && n <= ERRNO_MAX;
|
|
}
|
|
|
|
#define ERRNO_NAME_BUF_LEN DECIMAL_STR_MAX(int)
|
|
/* Like errno_name, but always returns a string. */
|
|
const char* errno_name(int id, char buf[static ERRNO_NAME_BUF_LEN]);
|
|
|
|
/* A helper to print the errno "name" or number if name is not defined. */
|
|
#define ERRNO_NAME(errnum) errno_name(errnum, (char[ERRNO_NAME_BUF_LEN]){})
|