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