vbos/lib/errno.c
Michael Shaw f8d84c7780 ext2: implement file writing
there is much room for improvement in the traversal of indirectly linked
blocks
2023-10-21 12:54:35 -04:00

22 lines
543 B
C

/* SPDX-License-Identifier: GPL-2.0-only */
#include <errno.h>
#include <kernel/common.h>
static const char *errno_str[] = {
[0] = "Success",
[ENOMEM] = "Out of memory",
[ENOENT] = "No such file or directory",
[EINVAL] = "Invalid argument",
[EBADF] = "Bad file descriptor",
[ENOTDIR] = "Not a directory",
[EISDIR] = "Is a directory",
[ENOSPC] = "No space left on device",
};
inline const char *strerror(int errnum)
{
if (errnum < 0 || (size_t)errnum >= ARRAY_SIZE(errno_str))
return "Unknown error";
return errno_str[errnum];
}