From 1f9c65a8ab35def8010535e0869a39236b6c7362 Mon Sep 17 00:00:00 2001 From: sbosse Date: Mon, 14 Oct 2024 23:14:20 +0200 Subject: [PATCH] Mon 14 Oct 23:14:00 CEST 2024 --- library/errno.c | 56 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 library/errno.c diff --git a/library/errno.c b/library/errno.c new file mode 100644 index 0000000..03b4a05 --- /dev/null +++ b/library/errno.c @@ -0,0 +1,56 @@ +/* +Copyright (C) 2016-2019 The University of Notre Dame +This software is distributed under the GNU General Public License. +See the file LICENSE for details. +*/ + +#include "kernel/error.h" +#include "library/errno.h" +#include "library/string.h" + +const char * strerror( kernel_error_t err_code) { + switch (err_code) { + case KERROR_NOT_FOUND: + return "Not Found"; + case KERROR_INVALID_REQUEST: + return "Invalid Request"; + case KERROR_PERMISSION_DENIED: + return "Permission Denied"; + case KERROR_NOT_IMPLEMENTED: + return "Not Implemented"; + case KERROR_NOT_EXECUTABLE: + return "Not Executable"; + case KERROR_EXECUTION_FAILED: + return "Execution Failed"; + case KERROR_NOT_A_DIRECTORY: + return "Not a Directory"; + case KERROR_NOT_A_FILE: + return "Not a File"; + case KERROR_NOT_A_WINDOW: + return "Not a Window"; + case KERROR_NOT_A_DEVICE: + return "Not a Device"; + case KERROR_NOT_A_CONSOLE: + return "Not a Console"; + case KERROR_NOT_A_PIPE: + return "Not a Pipe"; + case KERROR_INVALID_SYSCALL: + return "Invalid System Call"; + case KERROR_INVALID_OBJECT: + return "Invalid Object"; + case KERROR_INVALID_ADDRESS: + return "Invalid Address"; + case KERROR_INVALID_PATH: + return "Invalid Path"; + case KERROR_INVALID_TAG: + return "Invalid Tag"; + case KERROR_OUT_OF_MEMORY: + return "Out of Memory"; + case KERROR_OUT_OF_OBJECTS: + return "Out of Objects"; + case KERROR_OUT_OF_SPACE: + return "Out of Space"; + default: + return "Unknown error"; + } +}