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