diff options
author | Richard Braun <rbraun@sceen.net> | 2018-02-24 06:45:44 +0100 |
---|---|---|
committer | Richard Braun <rbraun@sceen.net> | 2018-02-24 06:48:21 +0100 |
commit | 7dcf6715ffb3cc2f00f6327b896d16f173a1b082 (patch) | |
tree | 210570e98e074d7abade0d22c64e05b9c02435ba /kern/error.c | |
parent | be5b9d6ab9f7e7a81c367e4bb0823ba11f85940f (diff) |
New errno.h standard header
Use standard errno codes. This change also adds strerror to string.h.
Diffstat (limited to 'kern/error.c')
-rw-r--r-- | kern/error.c | 35 |
1 files changed, 3 insertions, 32 deletions
diff --git a/kern/error.c b/kern/error.c index f5d43e4..10d6954 100644 --- a/kern/error.c +++ b/kern/error.c @@ -15,42 +15,13 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ +#include <errno.h> #include <stddef.h> +#include <string.h> #include <kern/error.h> #include <kern/panic.h> -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)); } |