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_NO_ENTRY (6)
#define KERN_WOULD_BLOCK (7) #define KERN_WOULD_BLOCK (7)
#define KERN_BUSY (8) #define KERN_BUSY (8)
#define KERN_NO_DEVICE (9)
extern const char *kern_status_string(kern_status_t status); extern const char *kern_status_string(kern_status_t status);

View File

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