this repo has no description
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

added error reporting functions for kernel-mach

+47
+47
src/libSystem/kernel-mach/error.cpp
··· 1 + #include "error.h" 2 + #include <cstdio> 3 + 4 + const char* mach_error_string(kern_return_t code) 5 + { 6 + switch (code) 7 + { 8 + case KERN_SUCCESS: 9 + return "Success"; 10 + case KERN_FAILURE: 11 + return "Generic failure"; 12 + case KERN_INVALID_ARGUMENT: 13 + return "Invalid argument"; 14 + case KERN_ALREADY_WAITING: 15 + return "Another thread is already waiting for the operation"; 16 + case KERN_RESOURCE_SHORTAGE: 17 + return "Out of memory"; 18 + case KERN_LOCK_OWNED_SELF: 19 + return "The calling thread already owns the lock"; 20 + case KERN_LOCK_OWNED: 21 + return "The lock is already owned by another thread"; 22 + case KERN_INVALID_ADDRESS: 23 + return "Invalid address"; 24 + case KERN_NO_SPACE: 25 + return "No virtual memory space"; 26 + case KERN_PROTECTION_FAILURE: 27 + return "Access denied"; 28 + default: 29 + { 30 + static __thread char buf[20]; 31 + sprintf(buf, "Error code %d", code); 32 + return buf; 33 + } 34 + } 35 + } 36 + 37 + void mach_error(const char* str, kern_return_t code) 38 + { 39 + const char* msg = mach_error_string(code); 40 + fprintf(stderr, "%s %s\n", str, msg); 41 + } 42 + 43 + const char* mach_error_type(kern_return_t code) 44 + { 45 + return "error type dummy"; 46 + } 47 +