summaryrefslogtreecommitdiff
path: root/kern/error.c
diff options
context:
space:
mode:
Diffstat (limited to 'kern/error.c')
-rw-r--r--kern/error.c35
1 files changed, 3 insertions, 32 deletions
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 <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));
}