1 /* 2 * Licensed to the Apache Software Foundation (ASF) under one or more 3 * contributor license agreements. See the NOTICE file distributed with 4 * this work for additional information regarding copyright ownership. 5 * The ASF licenses this file to You under the Apache License, Version 2.0 6 * (the "License"); you may not use this file except in compliance with 7 * the License. You may obtain a copy of the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 */ 17 18 /** 19 * @file 20 * @ingroup Port 21 * @brief Port Library Error Codes 22 * 23 * When an error is reported by the operating system the port library must translate this OS specific error code to a 24 * portable error code. All portable error codes are negative numbers. Not every module of the port library will have 25 * error codes dedicated to it's own use, some will use the generic portable error code values. 26 * 27 * Errors reported by the OS may be recorded by calling the port library functions @ref hyerror.c::hyerror_set_last_error "hyerror_set_last_error()" 28 * or @ref hyerror.c::hyerror_set_last_error_with_message "hyerror_set_last_error_with_message()". The mapping of the OS specific error 29 * code to a portable error code is the responsibility of the calling module. 30 */ 31 #if !defined(hyporterror_h) 32 #define hyporterror_h 33 34 /** 35 * @name Generic Errors 36 * Generic error codes for modules that do not have their own specific errors. Where possible it is recommended that all 37 * modules that return error codes have their own set 38 * 39 * @internal HYPORT_ERROR* range from -1 to -99 avoid overlap 40 * @{ 41 */ 42 #define HYPORT_ERROR_BASE -1 43 #define HYPORT_ERROR_OPFAILED HYPORT_ERROR_BASE 44 #define HYPORT_ERROR_EOF HYPORT_ERROR_BASE-1 45 #define HYPORT_ERROR_NOPERMISSION HYPORT_ERROR_BASE-2 46 #define HYPORT_ERROR_NOTFOUND HYPORT_ERROR_BASE-3 47 #define HYPORT_ERROR_NAMETOOLONG HYPORT_ERROR_BASE-4 48 #define HYPORT_ERROR_DISKFULL HYPORT_ERROR_BASE-5 49 #define HYPORT_ERROR_EXIST HYPORT_ERROR_BASE-6 50 #define HYPORT_ERROR_NOTEXIST HYPORT_ERROR_BASE-7 51 #define HYPORT_ERROR_SYSTEMFULL HYPORT_ERROR_BASE-8 52 #define HYPORT_ERROR_NOENT HYPORT_ERROR_BASE-9 53 #define HYPORT_ERROR_DIRECTORY HYPORT_ERROR_BASE-10 54 #define HYPORT_ERROR_NOTDIRECTORY HYPORT_ERROR_BASE-11 55 #define HYPORT_ERROR_LOOP HYPORT_ERROR_BASE-12 56 #define HYPORT_ERROR_BADF HYPORT_ERROR_BASE-13 57 #define HYPORT_ERROR_WOULDBLOCK HYPORT_ERROR_BASE-14 58 #define HYPORT_ERROR_INVALID HYPORT_ERROR_BASE-15 59 /** @} */ 60 /** 61 * @name Port Library startup failure code 62 * Failures related to the initialization and startup of the port library. 63 * 64 * @internal HYPORT_ERROR_STARTUP* range from -100 to -149 to avoid overlap 65 * @{ 66 */ 67 #define HYPORT_ERROR_STARTUP_BASE -100 68 #define HYPORT_ERROR_STARTUP_THREAD (HYPORT_ERROR_STARTUP_BASE) 69 #define HYPORT_ERROR_STARTUP_MEM (HYPORT_ERROR_STARTUP_BASE -1) 70 #define HYPORT_ERROR_STARTUP_TLS (HYPORT_ERROR_STARTUP_BASE -2) 71 #define HYPORT_ERROR_STARTUP_TLS_ALLOC (HYPORT_ERROR_STARTUP_BASE -3) 72 #define HYPORT_ERROR_STARTUP_TLS_MUTEX (HYPORT_ERROR_STARTUP_BASE -4) 73 #define HYPORT_ERROR_STARTUP_CPU (HYPORT_ERROR_STARTUP_BASE -5) 74 #define HYPORT_ERROR_STARTUP_VMEM (HYPORT_ERROR_STARTUP_BASE -6) 75 #define HYPORT_ERROR_STARTUP_FILE (HYPORT_ERROR_STARTUP_BASE -7) 76 #define HYPORT_ERROR_STARTUP_TTY (HYPORT_ERROR_STARTUP_BASE -8) 77 #define HYPORT_ERROR_STARTUP_TTY_HANDLE (HYPORT_ERROR_STARTUP_BASE -9) 78 #define HYPORT_ERROR_STARTUP_TTY_CONSOLE (HYPORT_ERROR_STARTUP_BASE -10) 79 #define HYPORT_ERROR_STARTUP_MMAP (HYPORT_ERROR_STARTUP_BASE -11) 80 #define HYPORT_ERROR_STARTUP_IPCMUTEX (HYPORT_ERROR_STARTUP_BASE -12) 81 #define HYPORT_ERROR_STARTUP_NLS (HYPORT_ERROR_STARTUP_BASE -13) 82 #define HYPORT_ERROR_STARTUP_SOCK (HYPORT_ERROR_STARTUP_BASE -14) 83 #define HYPORT_ERROR_STARTUP_TIME (HYPORT_ERROR_STARTUP_BASE -15) 84 #define HYPORT_ERROR_STARTUP_GP (HYPORT_ERROR_STARTUP_BASE -16) 85 #define HYPORT_ERROR_STARTUP_EXIT (HYPORT_ERROR_STARTUP_BASE -17) 86 #define HYPORT_ERROR_STARTUP_SYSINFO (HYPORT_ERROR_STARTUP_BASE -18) 87 #define HYPORT_ERROR_STARTUP_SL (HYPORT_ERROR_STARTUP_BASE -19) 88 #define HYPORT_ERROR_STARTUP_STR (HYPORT_ERROR_STARTUP_BASE -20) 89 #define HYPORT_ERROR_STARTUP_SHSEM (HYPORT_ERROR_STARTUP_BASE -21) 90 #define HYPORT_ERROR_STARTUP_SHMEM (HYPORT_ERROR_STARTUP_BASE -22) 91 #define HYPORT_ERROR_STARTUP_ERROR (HYPORT_ERROR_STARTUP_BASE -23) 92 #define HYPORT_ERROR_STARTUP_SIGNAL (HYPORT_ERROR_STARTUP_BASE -24) 93 /** @} */ 94 /** 95 * @name Shared Semaphore Errors 96 * Error codes for shared semaphore operations. 97 * 98 * @internal HYPORT_ERROR_SHSEM* range from at -150 to 159 to avoid overlap 99 * @{ 100 */ 101 #define HYPORT_ERROR_SHSEM_BASE -150 102 #define HYPORT_ERROR_SHSEM_OPFAILED (HYPORT_ERROR_SHSEM_BASE) 103 #define HYPORT_ERROR_SHSEM_HANDLE_INVALID (HYPORT_ERROR_SHSEM_BASE-1) 104 #define HYPORT_ERROR_SHSEM_SEMSET_INVALID (HYPORT_ERROR_SHSEM_BASE-2) 105 #define HYPORT_ERROR_SHSEM_NOT_EXIST (HYPORT_ERROR_SHSEM_BASE-3) 106 #define HYPORT_ERROR_SHSEM_NOPERMISSION (HYPORT_ERROR_SHSEM_BASE-4) 107 #define HYPORT_ERROR_SHSEM_INVALID_INPUT (HYPORT_ERROR_SHSEM_BASE-5) 108 #define HYPORT_ERROR_SHSEM_NOSPACE (HYPORT_ERROR_SHSEM_BASE-6) 109 #define HYPORT_ERROR_SHSEM_ALREADY_EXIST (HYPORT_ERROR_SHSEM_BASE-7) 110 #define HYPORT_ERROR_SHSEM_DATA_DIRECTORY_FAILED (HYPORT_ERROR_SHSEM_BASE-8) 111 /** @} */ 112 /** 113 * @name Shared Memory Errors 114 * Error codes for shared memory semaphore operations. 115 * 116 * @internal HYPORT_ERROR_SHMEM* range from at -160 to -169 to avoid overlap 117 * @{ 118 */ 119 #define HYPORT_ERROR_SHMEM_BASE -160 120 #define HYPORT_ERROR_SHMEM_OPFAILED (HYPORT_ERROR_SHMEM_BASE) 121 #define HYPORT_ERROR_SHMEM_HANDLE_INVALID (HYPORT_ERROR_SHMEM_BASE-1) 122 #define HYPORT_ERROR_SHMEM_NOT_EXIST (HYPORT_ERROR_SHMEM_BASE-2) 123 #define HYPORT_ERROR_SHMEM_NOPERMISSION (HYPORT_ERROR_SHMEM_BASE-3) 124 #define HYPORT_ERROR_SHMEM_INVALID_INPUT (HYPORT_ERROR_SHMEM_BASE-4) 125 #define HYPORT_ERROR_SHMEM_NOSPACE (HYPORT_ERROR_SHMEM_BASE-5) 126 #define HYPORT_ERROR_SHMEM_ALREADY_EXIST (HYPORT_ERROR_SHMEM_BASE-6) 127 #define HYPORT_ERROR_SHMEM_TOOBIG (HYPORT_ERROR_SHMEM_BASE-7) 128 #define HYPORT_ERROR_SHMEM_ATTACH_FAILED (HYPORT_ERROR_SHMEM_BASE-8) 129 #define HYPORT_ERROR_SHMEM_DATA_DIRECTORY_FAILED (HYPORT_ERROR_SHMEM_BASE-9) 130 /** @} */ 131 /* -170 to -199 available for use */ 132 /** 133 * @name Socket Errors 134 * Error codes for socket operations 135 * 136 * @internal HYPORT_ERROR_SOCKET* range from -200 to -299 avoid overlap 137 * @{ 138 */ 139 #define HYPORT_ERROR_SOCKET_BASE -200 140 #define HYPORT_ERROR_SOCKET_BADSOCKET HYPORT_ERROR_SOCKET_BASE /* generic error */ 141 #define HYPORT_ERROR_SOCKET_NOTINITIALIZED HYPORT_ERROR_SOCKET_BASE-1 /* socket library uninitialized */ 142 #define HYPORT_ERROR_SOCKET_BADAF HYPORT_ERROR_SOCKET_BASE-2 /* bad address family */ 143 #define HYPORT_ERROR_SOCKET_BADPROTO HYPORT_ERROR_SOCKET_BASE-3 /* bad protocol */ 144 #define HYPORT_ERROR_SOCKET_BADTYPE HYPORT_ERROR_SOCKET_BASE-4 /* bad type */ 145 #define HYPORT_ERROR_SOCKET_SYSTEMBUSY HYPORT_ERROR_SOCKET_BASE-5 /* system busy handling requests */ 146 #define HYPORT_ERROR_SOCKET_SYSTEMFULL HYPORT_ERROR_SOCKET_BASE-6 /* too many sockets */ 147 #define HYPORT_ERROR_SOCKET_NOTCONNECTED HYPORT_ERROR_SOCKET_BASE-7 /* socket is not connected */ 148 #define HYPORT_ERROR_SOCKET_INTERRUPTED HYPORT_ERROR_SOCKET_BASE-8 /* the call was cancelled */ 149 #define HYPORT_ERROR_SOCKET_TIMEOUT HYPORT_ERROR_SOCKET_BASE-9 /* the operation timed out */ 150 #define HYPORT_ERROR_SOCKET_CONNRESET HYPORT_ERROR_SOCKET_BASE-10 /* the connection was reset */ 151 #define HYPORT_ERROR_SOCKET_WOULDBLOCK HYPORT_ERROR_SOCKET_BASE-11 /* the socket is marked as nonblocking operation would block */ 152 #define HYPORT_ERROR_SOCKET_ADDRNOTAVAIL HYPORT_ERROR_SOCKET_BASE-12 /* address not available */ 153 #define HYPORT_ERROR_SOCKET_ADDRINUSE HYPORT_ERROR_SOCKET_BASE-13 /* address already in use */ 154 #define HYPORT_ERROR_SOCKET_NOTBOUND HYPORT_ERROR_SOCKET_BASE-14 /* the socket is not bound */ 155 #define HYPORT_ERROR_SOCKET_UNKNOWNSOCKET HYPORT_ERROR_SOCKET_BASE-15 /* resolution of fileDescriptor to socket failed */ 156 #define HYPORT_ERROR_SOCKET_INVALIDTIMEOUT HYPORT_ERROR_SOCKET_BASE-16 /* the specified timeout is invalid */ 157 #define HYPORT_ERROR_SOCKET_FDSETFULL HYPORT_ERROR_SOCKET_BASE-17 /* Unable to create an FDSET */ 158 #define HYPORT_ERROR_SOCKET_TIMEVALFULL HYPORT_ERROR_SOCKET_BASE-18 /* Unable to create a TIMEVAL */ 159 #define HYPORT_ERROR_SOCKET_REMSOCKSHUTDOWN HYPORT_ERROR_SOCKET_BASE-19 /* The remote socket has shutdown gracefully */ 160 #define HYPORT_ERROR_SOCKET_NOTLISTENING HYPORT_ERROR_SOCKET_BASE-20 /* listen() was not invoked prior to accept() */ 161 #define HYPORT_ERROR_SOCKET_NOTSTREAMSOCK HYPORT_ERROR_SOCKET_BASE-21 /* The socket does not support connection-oriented service */ 162 #define HYPORT_ERROR_SOCKET_ALREADYBOUND HYPORT_ERROR_SOCKET_BASE-22 /* The socket is already bound to an address */ 163 #define HYPORT_ERROR_SOCKET_NBWITHLINGER HYPORT_ERROR_SOCKET_BASE-23 /* The socket is marked non-blocking & SO_LINGER is non-zero */ 164 #define HYPORT_ERROR_SOCKET_ISCONNECTED HYPORT_ERROR_SOCKET_BASE-24 /* The socket is already connected */ 165 #define HYPORT_ERROR_SOCKET_NOBUFFERS HYPORT_ERROR_SOCKET_BASE-25 /* No buffer space is available */ 166 #define HYPORT_ERROR_SOCKET_HOSTNOTFOUND HYPORT_ERROR_SOCKET_BASE-26 /* Authoritative Answer Host not found */ 167 #define HYPORT_ERROR_SOCKET_NODATA HYPORT_ERROR_SOCKET_BASE-27 /* Valid name, no data record of requested type */ 168 #define HYPORT_ERROR_SOCKET_BOUNDORCONN HYPORT_ERROR_SOCKET_BASE-28 /* The socket has not been bound or is already connected */ 169 #define HYPORT_ERROR_SOCKET_OPNOTSUPP HYPORT_ERROR_SOCKET_BASE-29 /* The socket does not support the operation */ 170 #define HYPORT_ERROR_SOCKET_OPTUNSUPP HYPORT_ERROR_SOCKET_BASE-30 /* The socket option is not supported */ 171 #define HYPORT_ERROR_SOCKET_OPTARGSINVALID HYPORT_ERROR_SOCKET_BASE-31 /* The socket option arguments are invalid */ 172 #define HYPORT_ERROR_SOCKET_SOCKLEVELINVALID HYPORT_ERROR_SOCKET_BASE-32 /* The socket level is invalid */ 173 #define HYPORT_ERROR_SOCKET_TIMEOUTFAILURE HYPORT_ERROR_SOCKET_BASE-33 174 #define HYPORT_ERROR_SOCKET_SOCKADDRALLOCFAIL HYPORT_ERROR_SOCKET_BASE-34 /* Unable to allocate the sockaddr structure */ 175 #define HYPORT_ERROR_SOCKET_FDSET_SIZEBAD HYPORT_ERROR_SOCKET_BASE-35 /* The calculated maximum size of the file descriptor set is bad */ 176 #define HYPORT_ERROR_SOCKET_UNKNOWNFLAG HYPORT_ERROR_SOCKET_BASE-36 /* The flag is unknown */ 177 #define HYPORT_ERROR_SOCKET_MSGSIZE HYPORT_ERROR_SOCKET_BASE-37 /* The datagram was too big to fit the specified buffer & was truncated. */ 178 #define HYPORT_ERROR_SOCKET_NORECOVERY HYPORT_ERROR_SOCKET_BASE-38 /* The operation failed with no recovery possible */ 179 #define HYPORT_ERROR_SOCKET_ARGSINVALID HYPORT_ERROR_SOCKET_BASE-39 /* The arguments are invalid */ 180 #define HYPORT_ERROR_SOCKET_BADDESC HYPORT_ERROR_SOCKET_BASE-40 /* The socket argument is not a valid file descriptor */ 181 #define HYPORT_ERROR_SOCKET_NOTSOCK HYPORT_ERROR_SOCKET_BASE-41 /* The socket argument is not a socket */ 182 #define HYPORT_ERROR_SOCKET_HOSTENTALLOCFAIL HYPORT_ERROR_SOCKET_BASE-42 /* Unable to allocate the hostent structure */ 183 #define HYPORT_ERROR_SOCKET_TIMEVALALLOCFAIL HYPORT_ERROR_SOCKET_BASE-43 /* Unable to allocate the timeval structure */ 184 #define HYPORT_ERROR_SOCKET_LINGERALLOCFAIL HYPORT_ERROR_SOCKET_BASE-44 /* Unable to allocate the linger structure */ 185 #define HYPORT_ERROR_SOCKET_IPMREQALLOCFAIL HYPORT_ERROR_SOCKET_BASE-45 /* Unable to allocate the ipmreq structure */ 186 #define HYPORT_ERROR_SOCKET_FDSETALLOCFAIL HYPORT_ERROR_SOCKET_BASE-46 /* Unable to allocate the fdset structure */ 187 #define HYPORT_ERROR_SOCKET_OPFAILED HYPORT_ERROR_SOCKET_BASE-47 188 #define HYPORT_ERROR_SOCKET_VALUE_NULL HYPORT_ERROR_SOCKET_BASE-48 /* The value indexed was NULL */ 189 #define HYPORT_ERROR_SOCKET_CONNECTION_REFUSED HYPORT_ERROR_SOCKET_BASE-49 /* connection was refused */ 190 #define HYPORT_ERROR_SOCKET_ENETUNREACH HYPORT_ERROR_SOCKET_BASE-50 /* network is not reachable */ 191 #define HYPORT_ERROR_SOCKET_EACCES HYPORT_ERROR_SOCKET_BASE-51 /* permissions do not allow action on socket */ 192 #define HYPORT_ERROR_SOCKET_WAS_CLOSED (HYPORT_ERROR_SOCKET_BASE-52) 193 #define HYPORT_ERROR_SOCKET_EINPROGRESS (HYPORT_ERROR_SOCKET_BASE-53) 194 #define HYPORT_ERROR_SOCKET_ALREADYINPROGRESS (HYPORT_ERROR_SOCKET_BASE-54) 195 196 #define HYPORT_ERROR_SOCKET_FIRST_ERROR_NUMBER HYPORT_ERROR_SOCKET_BASE 197 #define HYPORT_ERROR_SOCKET_LAST_ERROR_NUMBER HYPORT_ERROR_SOCKET_VALUE_NULL /* Equals last used error code */ 198 /** 199 * @name File Errors 200 * Error codes for file operations. 201 * 202 * @internal HYPORT_ERROR_FILE* range from -300 to -349 avoid overlap 203 * @{ 204 */ 205 #define HYPORT_ERROR_FILE_BASE -300 206 #define HYPORT_ERROR_FILE_OPFAILED (HYPORT_ERROR_FILE_BASE) 207 #define HYPORT_ERROR_FILE_EOF (HYPORT_ERROR_FILE_BASE-1) 208 #define HYPORT_ERROR_FILE_NOPERMISSION (HYPORT_ERROR_FILE_BASE-2) 209 #define HYPORT_ERROR_FILE_NOTFOUND (HYPORT_ERROR_FILE_BASE-3) 210 #define HYPORT_ERROR_FILE_NAMETOOLONG (HYPORT_ERROR_FILE_BASE-4) 211 #define HYPORT_ERROR_FILE_DISKFULL (HYPORT_ERROR_FILE_BASE-5) 212 #define HYPORT_ERROR_FILE_EXIST (HYPORT_ERROR_FILE_BASE-6) 213 #define HYPORT_ERROR_FILE_SYSTEMFULL (HYPORT_ERROR_FILE_BASE-7) 214 #define HYPORT_ERROR_FILE_NOENT (HYPORT_ERROR_FILE_BASE-8) 215 #define HYPORT_ERROR_FILE_NOTDIR (HYPORT_ERROR_FILE_BASE-9) 216 #define HYPORT_ERROR_FILE_LOOP (HYPORT_ERROR_FILE_BASE-10) 217 #define HYPORT_ERROR_FILE_BADF (HYPORT_ERROR_FILE_BASE-11) 218 #define HYPORT_ERROR_FILE_WOULDBLOCK (HYPORT_ERROR_FILE_BASE-12) 219 #define HYPORT_ERROR_FILE_INVAL (HYPORT_ERROR_FILE_BASE-13) 220 #define HYPORT_ERROR_FILE_LOCKED (HYPORT_ERROR_FILE_BASE-14) 221 /** @} */ 222 223 #endif /* hyporterror_h */ 224