1 /**
2  * Copyright (c) 2023-2024 Marcin Niestroj
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 #ifndef __DRIVERS_NET_NSOS_ERRNO_H__
8 #define __DRIVERS_NET_NSOS_ERRNO_H__
9 
10 #include <errno.h>
11 
12 #define NSOS_MID_EPERM 1         /**< Not owner */
13 #define NSOS_MID_ENOENT 2        /**< No such file or directory */
14 #define NSOS_MID_ESRCH 3         /**< No such context */
15 #define NSOS_MID_EINTR 4         /**< Interrupted system call */
16 #define NSOS_MID_EIO 5           /**< I/O error */
17 #define NSOS_MID_ENXIO 6         /**< No such device or address */
18 #define NSOS_MID_E2BIG 7         /**< Arg list too long */
19 #define NSOS_MID_ENOEXEC 8       /**< Exec format error */
20 #define NSOS_MID_EBADF 9         /**< Bad file number */
21 #define NSOS_MID_ECHILD 10       /**< No children */
22 #define NSOS_MID_EAGAIN 11       /**< No more contexts */
23 #define NSOS_MID_ENOMEM 12       /**< Not enough core */
24 #define NSOS_MID_EACCES 13       /**< Permission denied */
25 #define NSOS_MID_EFAULT 14       /**< Bad address */
26 #define NSOS_MID_ENOTBLK 15      /**< Block device required */
27 #define NSOS_MID_EBUSY 16        /**< Mount device busy */
28 #define NSOS_MID_EEXIST 17       /**< File exists */
29 #define NSOS_MID_EXDEV 18        /**< Cross-device link */
30 #define NSOS_MID_ENODEV 19       /**< No such device */
31 #define NSOS_MID_ENOTDIR 20      /**< Not a directory */
32 #define NSOS_MID_EISDIR 21       /**< Is a directory */
33 #define NSOS_MID_EINVAL 22       /**< Invalid argument */
34 #define NSOS_MID_ENFILE 23       /**< File table overflow */
35 #define NSOS_MID_EMFILE 24       /**< Too many open files */
36 #define NSOS_MID_ENOTTY 25       /**< Not a typewriter */
37 #define NSOS_MID_ETXTBSY 26      /**< Text file busy */
38 #define NSOS_MID_EFBIG 27        /**< File too large */
39 #define NSOS_MID_ENOSPC 28       /**< No space left on device */
40 #define NSOS_MID_ESPIPE 29       /**< Illegal seek */
41 #define NSOS_MID_EROFS 30        /**< Read-only file system */
42 #define NSOS_MID_EMLINK 31       /**< Too many links */
43 #define NSOS_MID_EPIPE 32        /**< Broken pipe */
44 #define NSOS_MID_EDOM 33         /**< Argument too large */
45 #define NSOS_MID_ERANGE 34       /**< Result too large */
46 #define NSOS_MID_ENOMSG 35       /**< Unexpected message type */
47 #define NSOS_MID_EDEADLK 45      /**< Resource deadlock avoided */
48 #define NSOS_MID_ENOLCK 46       /**< No locks available */
49 #define NSOS_MID_ENOSTR 60       /**< STREAMS device required */
50 #define NSOS_MID_ENODATA 61      /**< Missing expected message data */
51 #define NSOS_MID_ETIME 62        /**< STREAMS timeout occurred */
52 #define NSOS_MID_ENOSR 63        /**< Insufficient memory */
53 #define NSOS_MID_EPROTO 71       /**< Generic STREAMS error */
54 #define NSOS_MID_EBADMSG 77      /**< Invalid STREAMS message */
55 #define NSOS_MID_ENOSYS 88       /**< Function not implemented */
56 #define NSOS_MID_ENOTEMPTY 90    /**< Directory not empty */
57 #define NSOS_MID_ENAMETOOLONG 91 /**< File name too long */
58 #define NSOS_MID_ELOOP 92        /**< Too many levels of symbolic links */
59 #define NSOS_MID_EOPNOTSUPP 95   /**< Operation not supported on socket */
60 #define NSOS_MID_EPFNOSUPPORT 96 /**< Protocol family not supported */
61 #define NSOS_MID_ECONNRESET 104   /**< Connection reset by peer */
62 #define NSOS_MID_ENOBUFS 105      /**< No buffer space available */
63 #define NSOS_MID_EAFNOSUPPORT 106 /**< Addr family not supported */
64 #define NSOS_MID_EPROTOTYPE 107   /**< Protocol wrong type for socket */
65 #define NSOS_MID_ENOTSOCK 108     /**< Socket operation on non-socket */
66 #define NSOS_MID_ENOPROTOOPT 109  /**< Protocol not available */
67 #define NSOS_MID_ESHUTDOWN 110    /**< Can't send after socket shutdown */
68 #define NSOS_MID_ECONNREFUSED 111 /**< Connection refused */
69 #define NSOS_MID_EADDRINUSE 112   /**< Address already in use */
70 #define NSOS_MID_ECONNABORTED 113 /**< Software caused connection abort */
71 #define NSOS_MID_ENETUNREACH 114  /**< Network is unreachable */
72 #define NSOS_MID_ENETDOWN 115     /**< Network is down */
73 #define NSOS_MID_ETIMEDOUT 116    /**< Connection timed out */
74 #define NSOS_MID_EHOSTDOWN 117    /**< Host is down */
75 #define NSOS_MID_EHOSTUNREACH 118 /**< No route to host */
76 #define NSOS_MID_EINPROGRESS 119  /**< Operation now in progress */
77 #define NSOS_MID_EALREADY 120     /**< Operation already in progress */
78 #define NSOS_MID_EDESTADDRREQ 121 /**< Destination address required */
79 #define NSOS_MID_EMSGSIZE 122        /**< Message size */
80 #define NSOS_MID_EPROTONOSUPPORT 123 /**< Protocol not supported */
81 #define NSOS_MID_ESOCKTNOSUPPORT 124 /**< Socket type not supported */
82 #define NSOS_MID_EADDRNOTAVAIL 125   /**< Can't assign requested address */
83 #define NSOS_MID_ENETRESET 126       /**< Network dropped connection on reset */
84 #define NSOS_MID_EISCONN 127         /**< Socket is already connected */
85 #define NSOS_MID_ENOTCONN 128        /**< Socket is not connected */
86 #define NSOS_MID_ETOOMANYREFS 129    /**< Too many references: can't splice */
87 #define NSOS_MID_ENOTSUP 134         /**< Unsupported value */
88 #define NSOS_MID_EILSEQ 138          /**< Illegal byte sequence */
89 #define NSOS_MID_EOVERFLOW 139       /**< Value overflow */
90 #define NSOS_MID_ECANCELED 140       /**< Operation canceled */
91 
92 int errno_to_nsos_mid(int err);
93 int errno_from_nsos_mid(int err);
94 
95 #endif /* __DRIVERS_NET_NSOS_ERRNO_H__ */
96