Files
my-os-project2/share/errors.h

43 lines
963 B
C

#ifndef ERRORS_H_
#define ERRORS_H_
enum {
E_OK = 0,
E_NOMEMORY = -1,
E_UNKNOWN_FSTYPE = -2,
E_NOENTRY = -3,
E_OUTOFBOUNDS = -4,
E_UNKNOWN_SDTYPE = -5,
E_TODO = -6,
E_BADIO = -7,
E_BADSYSCALL = -8,
E_DOSCHEDULING = -9,
E_INVALIDARGUMENT = -10,
E_INVALIDOPER = -11,
E_RESOURCEAVAIL = -12,
E_SPAWNERROR = -13,
E_NOTYET = -14,
};
static const char *_ERROR_STRINGS[] = {
"OK",
"Out of memory",
"Unknown filesystem type",
"No entry",
"Out of bounds access",
"Unknown storage device type",
"TODO",
"I/O error",
"System call error",
"Perform scheduling (internal flag)",
"Invalid argument",
"Invalid operation",
"Resource already available",
"Process spawn error",
};
#define ERRSTRING_INDEX(ioh) ((size_t)((ioh) < 0 ? (ioh) * (-1) : (ioh)))
#define ERRSTRING(ioh) (_ERROR_STRINGS[ERRSTRING_INDEX(ioh)])
#endif // ERRORS_H_