Compiles with GCC
[akaros.git] / kern / include / ros / error.h
1 /* See COPYRIGHT for copyright information. */
2
3 #ifndef ROS_INC_ERROR_H
4 #define ROS_INC_ERROR_H
5
6 #include <ros/common.h>
7
8 #define DECLARE_ERROR_CODE(e, s)
9
10 // define this to prevent conflicts with newlib's errno.h
11 #define __error_t_defined
12 typedef enum {
13         ESUCCESS = 0,            // Success
14         EFAIL,                   // Generic Failure
15         EPERM,                   // Wrong permissions
16         EDEADLOCK,               // Would cause deadlock
17         EBUSY,                   // Currently busy, try again later
18         ENOMEM,                  // No memory available
19         EINVAL,                  // Invalid arguments
20         EFAULT,                  // Segmentation fault
21         EBADENV,                 // Bad environment 
22         ENOFREEENV,              // No free environment
23         EUNSPECIFIED,            // Unspecified
24         EMORON,                  // Moron
25         NUMERRORS,               // Total number of error codes
26 } error_t;
27
28 /* 
29  * The special format for printk %e takes an integer 
30  * error code and prints a string describing the error.
31  * The integer may be positive or negative,
32  * so that -ENOMEM and ENOMEM are equivalent.
33  */
34
35 static const char *NTS const error_string[NUMERRORS] =
36 {
37         "Success",
38         "Generic Failure",
39         "Wrong permissions",
40         "Would cause deadlock",
41         "Currently busy, try again later",
42         "No memory available",
43         "Invalid arguments",
44         "Segmentation fault",
45         "Bad environment",
46         "No free environment",
47         "You are a moron",
48         "Unspecified",
49 };
50
51 #endif  // !ROS_INC_ERROR_H */