Files
my-os-project2/share/errors.h
2025-10-03 22:41:38 +02:00

46 lines
1.0 KiB
C

#ifndef ERRORS_H_
#define ERRORS_H_
#define E_OK 0
#define E_NOMEMORY -1
#define E_UNKNOWN_FSTYPE -2
#define E_NOENTRY -3
#define E_OUTOFBOUNDS -4
#define E_UNKNOWN_SDTYPE -5
#define E_TODO -6
#define E_BADIO -7
#define E_BADSYSCALL -8
#define E_DOSCHEDULING -9
#define E_INVALIDARGUMENT -10
#define E_INVALIDOPER -11
#define E_RESOURCEAVAIL -12
#define E_SPAWNERROR -13
#define E_NOTYET -14
#if !defined(__ASSEMBLER__)
__attribute__((unused))
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
#endif // ERRORS_H_