kernel: add more status codes

This commit is contained in:
2023-06-08 20:46:20 +01:00
parent cb220452db
commit ff8902ef1c
2 changed files with 15 additions and 14 deletions

View File

@@ -12,6 +12,7 @@ typedef unsigned int kern_status_t;
#define KERN_NO_ENTRY (6)
#define KERN_WOULD_BLOCK (7)
#define KERN_BUSY (8)
#define KERN_NO_DEVICE (9)
extern const char *kern_status_string(kern_status_t status);

View File

@@ -1,22 +1,22 @@
#include <socks/status.h>
#define ERROR_STRING_CASE(code) \
case code: \
return #code
const char *kern_status_string(kern_status_t status)
{
switch (status) {
case KERN_OK:
return "KERN_OK";
case KERN_UNIMPLEMENTED:
return "KERN_UNIMPLEMENTED";
case KERN_NAME_EXISTS:
return "KERN_NAME_EXISTS";
case KERN_INVALID_ARGUMENT:
return "KERN_INVALID_ARGUMENT";
case KERN_UNSUPPORTED:
return "KERN_UNSUPPORTED";
case KERN_NO_MEMORY:
return "KERN_NO_MEMORY";
case KERN_NO_ENTRY:
return "KERN_NO_ENTRY";
ERROR_STRING_CASE(KERN_OK);
ERROR_STRING_CASE(KERN_UNIMPLEMENTED);
ERROR_STRING_CASE(KERN_NAME_EXISTS);
ERROR_STRING_CASE(KERN_INVALID_ARGUMENT);
ERROR_STRING_CASE(KERN_UNSUPPORTED);
ERROR_STRING_CASE(KERN_NO_MEMORY);
ERROR_STRING_CASE(KERN_NO_ENTRY);
ERROR_STRING_CASE(KERN_WOULD_BLOCK);
ERROR_STRING_CASE(KERN_BUSY);
ERROR_STRING_CASE(KERN_NO_DEVICE);
default:
return "UNKNOWN";
}