From 7dcf6715ffb3cc2f00f6327b896d16f173a1b082 Mon Sep 17 00:00:00 2001 From: Richard Braun Date: Sat, 24 Feb 2018 06:45:44 +0100 Subject: New errno.h standard header Use standard errno codes. This change also adds strerror to string.h. --- kern/error.c | 35 +++-------------------------------- 1 file changed, 3 insertions(+), 32 deletions(-) (limited to 'kern/error.c') diff --git a/kern/error.c b/kern/error.c index f5d43e48..10d69542 100644 --- a/kern/error.c +++ b/kern/error.c @@ -15,42 +15,13 @@ * along with this program. If not, see . */ +#include #include +#include #include #include -const char * -error_str(int error) -{ - switch (error) { - case 0: - return "success"; - case ERROR_NOMEM: - return "out of memory"; - case ERROR_AGAIN: - return "resource temporarily unavailable"; - case ERROR_INVAL: - return "invalid argument"; - case ERROR_BUSY: - return "device or resource busy"; - case ERROR_FAULT: - return "bad address"; - case ERROR_NODEV: - return "no such device"; - case ERROR_EXIST: - return "entry exists"; - case ERROR_IO: - return "input/output error"; - case ERROR_SRCH: - return "no such process"; - case ERROR_TIMEDOUT: - return "timeout error"; - default: - return "unknown error"; - } -} - void error_check(int error, const char *prefix) { @@ -61,5 +32,5 @@ error_check(int error, const char *prefix) panic("%s%s%s", (prefix == NULL) ? "" : prefix, (prefix == NULL) ? "" : ": ", - error_str(error)); + strerror(error)); } -- cgit v1.2.3