1 1.1 cherry /* 2 1.1 cherry * There are two expected ways of including this header. 3 1.1 cherry * 4 1.1 cherry * 1) The "default" case (expected from tools etc). 5 1.1 cherry * 6 1.1 cherry * Simply #include <public/errno.h> 7 1.1 cherry * 8 1.1 cherry * In this circumstance, normal header guards apply and the includer shall get 9 1.1 cherry * an enumeration in the XEN_xxx namespace, appropriate for C or assembly. 10 1.1 cherry * 11 1.1 cherry * 2) The special case where the includer provides a XEN_ERRNO() in scope. 12 1.1 cherry * 13 1.1 cherry * In this case, no inclusion guards apply and the caller is responsible for 14 1.1 cherry * their XEN_ERRNO() being appropriate in the included context. The header 15 1.1 cherry * will unilaterally #undef XEN_ERRNO(). 16 1.1 cherry */ 17 1.1 cherry 18 1.1 cherry #ifndef XEN_ERRNO 19 1.1 cherry 20 1.1 cherry /* 21 1.1 cherry * Includer has not provided a custom XEN_ERRNO(). Arrange for normal header 22 1.1 cherry * guards, an automatic enum (for C code) and constants in the XEN_xxx 23 1.1 cherry * namespace. 24 1.1 cherry */ 25 1.1 cherry #ifndef __XEN_PUBLIC_ERRNO_H__ 26 1.1 cherry #define __XEN_PUBLIC_ERRNO_H__ 27 1.1 cherry 28 1.1 cherry #define XEN_ERRNO_DEFAULT_INCLUDE 29 1.1 cherry 30 1.1 cherry #ifndef __ASSEMBLY__ 31 1.1 cherry 32 1.1 cherry #define XEN_ERRNO(name, value) XEN_##name = value, 33 1.1 cherry enum xen_errno { 34 1.1 cherry 35 1.1 cherry #elif __XEN_INTERFACE_VERSION__ < 0x00040700 36 1.1 cherry 37 1.1 cherry #define XEN_ERRNO(name, value) .equ XEN_##name, value 38 1.1 cherry 39 1.1 cherry #endif /* __ASSEMBLY__ */ 40 1.1 cherry 41 1.1 cherry #endif /* __XEN_PUBLIC_ERRNO_H__ */ 42 1.1 cherry #endif /* !XEN_ERRNO */ 43 1.1 cherry 44 1.1 cherry /* ` enum neg_errnoval { [ -Efoo for each Efoo in the list below ] } */ 45 1.1 cherry /* ` enum errnoval { */ 46 1.1 cherry 47 1.1 cherry #ifdef XEN_ERRNO 48 1.1 cherry 49 1.1 cherry /* 50 1.1 cherry * Values originating from x86 Linux. Please consider using respective 51 1.1 cherry * values when adding new definitions here. 52 1.1 cherry * 53 1.1 cherry * The set of identifiers to be added here shouldn't extend beyond what 54 1.1 cherry * POSIX mandates (see e.g. 55 1.1 cherry * http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/errno.h.html) 56 1.1 cherry * with the exception that we support some optional (XSR) values 57 1.1 cherry * specified there (but no new ones should be added). 58 1.1 cherry */ 59 1.1 cherry 60 1.1 cherry XEN_ERRNO(EPERM, 1) /* Operation not permitted */ 61 1.1 cherry XEN_ERRNO(ENOENT, 2) /* No such file or directory */ 62 1.1 cherry XEN_ERRNO(ESRCH, 3) /* No such process */ 63 1.1 cherry #ifdef __XEN__ /* Internal only, should never be exposed to the guest. */ 64 1.1 cherry XEN_ERRNO(EINTR, 4) /* Interrupted system call */ 65 1.1 cherry #endif 66 1.1 cherry XEN_ERRNO(EIO, 5) /* I/O error */ 67 1.1 cherry XEN_ERRNO(ENXIO, 6) /* No such device or address */ 68 1.1 cherry XEN_ERRNO(E2BIG, 7) /* Arg list too long */ 69 1.1 cherry XEN_ERRNO(ENOEXEC, 8) /* Exec format error */ 70 1.1 cherry XEN_ERRNO(EBADF, 9) /* Bad file number */ 71 1.1 cherry XEN_ERRNO(ECHILD, 10) /* No child processes */ 72 1.1 cherry XEN_ERRNO(EAGAIN, 11) /* Try again */ 73 1.1 cherry XEN_ERRNO(EWOULDBLOCK, 11) /* Operation would block. Aliases EAGAIN */ 74 1.1 cherry XEN_ERRNO(ENOMEM, 12) /* Out of memory */ 75 1.1 cherry XEN_ERRNO(EACCES, 13) /* Permission denied */ 76 1.1 cherry XEN_ERRNO(EFAULT, 14) /* Bad address */ 77 1.1 cherry XEN_ERRNO(EBUSY, 16) /* Device or resource busy */ 78 1.1 cherry XEN_ERRNO(EEXIST, 17) /* File exists */ 79 1.1 cherry XEN_ERRNO(EXDEV, 18) /* Cross-device link */ 80 1.1 cherry XEN_ERRNO(ENODEV, 19) /* No such device */ 81 1.1 cherry XEN_ERRNO(EISDIR, 21) /* Is a directory */ 82 1.1 cherry XEN_ERRNO(EINVAL, 22) /* Invalid argument */ 83 1.1 cherry XEN_ERRNO(ENFILE, 23) /* File table overflow */ 84 1.1 cherry XEN_ERRNO(EMFILE, 24) /* Too many open files */ 85 1.1 cherry XEN_ERRNO(ENOSPC, 28) /* No space left on device */ 86 1.1 cherry XEN_ERRNO(EROFS, 30) /* Read-only file system */ 87 1.1 cherry XEN_ERRNO(EMLINK, 31) /* Too many links */ 88 1.1 cherry XEN_ERRNO(EDOM, 33) /* Math argument out of domain of func */ 89 1.1 cherry XEN_ERRNO(ERANGE, 34) /* Math result not representable */ 90 1.1 cherry XEN_ERRNO(EDEADLK, 35) /* Resource deadlock would occur */ 91 1.1 cherry XEN_ERRNO(EDEADLOCK, 35) /* Resource deadlock would occur. Aliases EDEADLK */ 92 1.1 cherry XEN_ERRNO(ENAMETOOLONG, 36) /* File name too long */ 93 1.1 cherry XEN_ERRNO(ENOLCK, 37) /* No record locks available */ 94 1.1 cherry XEN_ERRNO(ENOSYS, 38) /* Function not implemented */ 95 1.1 cherry XEN_ERRNO(ENOTEMPTY, 39) /* Directory not empty */ 96 1.1 cherry XEN_ERRNO(ENODATA, 61) /* No data available */ 97 1.1 cherry XEN_ERRNO(ETIME, 62) /* Timer expired */ 98 1.1 cherry XEN_ERRNO(EBADMSG, 74) /* Not a data message */ 99 1.1 cherry XEN_ERRNO(EOVERFLOW, 75) /* Value too large for defined data type */ 100 1.1 cherry XEN_ERRNO(EILSEQ, 84) /* Illegal byte sequence */ 101 1.1 cherry #ifdef __XEN__ /* Internal only, should never be exposed to the guest. */ 102 1.1 cherry XEN_ERRNO(ERESTART, 85) /* Interrupted system call should be restarted */ 103 1.1 cherry #endif 104 1.1 cherry XEN_ERRNO(ENOTSOCK, 88) /* Socket operation on non-socket */ 105 1.1 cherry XEN_ERRNO(EOPNOTSUPP, 95) /* Operation not supported on transport endpoint */ 106 1.1 cherry XEN_ERRNO(EADDRINUSE, 98) /* Address already in use */ 107 1.1 cherry XEN_ERRNO(EADDRNOTAVAIL, 99) /* Cannot assign requested address */ 108 1.1 cherry XEN_ERRNO(ENOBUFS, 105) /* No buffer space available */ 109 1.1 cherry XEN_ERRNO(EISCONN, 106) /* Transport endpoint is already connected */ 110 1.1 cherry XEN_ERRNO(ENOTCONN, 107) /* Transport endpoint is not connected */ 111 1.1 cherry XEN_ERRNO(ETIMEDOUT, 110) /* Connection timed out */ 112 1.1 cherry 113 1.1 cherry #undef XEN_ERRNO 114 1.1 cherry #endif /* XEN_ERRNO */ 115 1.1 cherry /* ` } */ 116 1.1 cherry 117 1.1 cherry /* Clean up from a default include. Close the enum (for C). */ 118 1.1 cherry #ifdef XEN_ERRNO_DEFAULT_INCLUDE 119 1.1 cherry #undef XEN_ERRNO_DEFAULT_INCLUDE 120 1.1 cherry #ifndef __ASSEMBLY__ 121 1.1 cherry }; 122 1.1 cherry #endif 123 1.1 cherry 124 1.1 cherry #endif /* XEN_ERRNO_DEFAULT_INCLUDE */ 125