2#include <cosmos/formatting.hxx>
3#include <cosmos/utils.hxx>
6#include <clues/ErrnoResult.hxx>
7#include <clues/utils.hxx>
11ErrnoResult::ErrnoResult(
const cosmos::Errno code) {
12 const auto kernel_code =
KernelErrno{cosmos::to_integral(code)};
14 if (kernel_code >= KernelErrno::RESTART_SYS &&
15 kernel_code <= KernelErrno::RESTART_RESTARTBLOCK) {
16 m_kernel_errno = kernel_code;
22std::string ErrnoResult::str()
const {
25 const auto code = *m_errno;
26 return cosmos::sprintf(
"%d (%s)",
29 const auto code = *m_kernel_errno;
30 return cosmos::sprintf(
"%d (%s)",
KernelErrno
Errno values that can appear in tracing context.
const char * get_errno_label(const cosmos::Errno err)
Returns a short errno label like ENOENT for the given errno integer.
const char * get_kernel_errno_label(const KernelErrno err)
Returns a short errno label for extended KernelErrno codes.