1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318
|
/** @file
* IPRT - errno.h wrapper.
*/
/*
* Copyright (C) 2012 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* you can redistribute it and/or modify it under the terms of the GNU
* General Public License (GPL) as published by the Free Software
* Foundation, in version 2 as it comes in the "COPYING" file of the
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
*
* The contents of this file may alternatively be used under the terms
* of the Common Development and Distribution License Version 1.0
* (CDDL) only, as it comes in the "COPYING.CDDL" file of the
* VirtualBox OSE distribution, in which case the provisions of the
* CDDL are applicable instead of those of the GPL.
*
* You may elect to license modified versions of this file under the
* terms and conditions of either the GPL or the CDDL or both.
*/
#ifndef ___iprt_errno_h___
#define ___iprt_errno_h___
#ifndef IPRT_NO_CRT
# if defined(RT_OS_DARWIN) && defined(KERNEL)
# include <sys/errno.h>
# elif defined(RT_OS_LINUX) && defined(__KERNEL__)
# include <linux/errno.h>
# elif defined(RT_OS_FREEBSD) && defined(_KERNEL)
# include <sys/errno.h>
# else
# include <errno.h>
# endif
#endif
/*
* Supply missing errno values according to the current RT_OS_XXX definition.
*
* Note! These supplements are for making no-CRT mode, as well as making UNIXy
* code that makes used of odd errno defines internally, work smoothly.
*
* When adding more error codes, always check the following errno.h sources:
* - RT_OS_DARWIN: http://fxr.watson.org/fxr/source/bsd/sys/errno.h?v=xnu-1699.24.8
* - RT_OS_FREEBSD: http://fxr.watson.org/fxr/source/sys/errno.h?v=DFBSD
* - RT_OS_NETBSD: http://fxr.watson.org/fxr/source/sys/errno.h?v=NETBSD
* - RT_OS_OPENBSD: http://fxr.watson.org/fxr/source/sys/errno.h?v=OPENBSD
* - RT_OS_OS2: http://svn.netlabs.org/libc/browser/trunk/libc/include/sys/errno.h
* - RT_OS_LINUX: http://fxr.watson.org/fxr/source/include/asm-generic/errno.h?v=linux-2.6
* - RT_OS_SOLARIS: http://fxr.watson.org/fxr/source/common/sys/errno.h?v=OPENSOLARIS
* - RT_OS_WINDOWS: tools/win.x86/vcc/v8sp1/include/errno.h
*/
#if defined(RT_OS_DARWIN) \
|| defined(RT_OS_FREEBSD) \
|| defined(RT_OS_NETBSD) \
|| defined(RT_OS_OPENBSD) \
|| defined(RT_OS_OS2)
# define RT_ERRNO_OS_BSD
#endif
#ifdef RT_OS_SOLARIS
# define RT_ERRNO_OS_SYSV_HARDCORE /* ?? */
#endif
/* The relatively similar part. */
#ifndef EPERM
# define EPERM (1)
#endif
#ifndef ENOENT
# define ENOENT (2)
#endif
#ifndef ESRCH
# define ESRCH (3)
#endif
#ifndef EINTR
# define EINTR (4)
#endif
#ifndef EIO
# define EIO (5)
#endif
#ifndef ENXIO
# define ENXIO (6)
#endif
#ifndef E2BIG
# define E2BIG (7)
#endif
#ifndef ENOEXEC
# define ENOEXEC (8)
#endif
#ifndef EBADF
# define EBADF (9)
#endif
#ifndef ECHILD
# define ECHILD (10)
#endif
#ifndef EAGAIN
# if defined(RT_ERRNO_OS_BSD)
# define EAGAIN (35)
# else
# define EAGAIN (11)
# endif
#endif
#ifndef EWOULDBLOCK
# define EWOULDBLOCK EAGAIN
#endif
#ifndef EDEADLK
# if defined(RT_ERRNO_OS_BSD)
# define EDEADLK (11)
# elif defined(RT_OS_LINUX)
# define EDEADLK (35)
# elif defined(RT_OS_WINDOWS)
# define EDEADLK (36)
# else
# define EDEADLK (45)
# endif
#endif
#ifndef EDEADLOCK
# define EDEADLOCK EDEADLK
#endif
#ifndef ENOMEM
# define ENOMEM (12)
#endif
#ifndef EACCES
# define EACCES (13)
#endif
#ifndef EFAULT
# define EFAULT (14)
#endif
#ifndef ENOTBLK
# define ENOTBLK (15)
#endif
#ifndef EBUSY
# define EBUSY (16)
#endif
#ifndef EEXIST
# define EEXIST (17)
#endif
#ifndef EXDEV
# define EXDEV (18)
#endif
#ifndef ENODEV
# define ENODEV (19)
#endif
#ifndef ENOTDIR
# define ENOTDIR (20)
#endif
#ifndef EISDIR
# define EISDIR (21)
#endif
#ifndef EINVAL
# define EINVAL (22)
#endif
#ifndef ENFILE
# define ENFILE (23)
#endif
#ifndef EMFILE
# define EMFILE (24)
#endif
#ifndef ENOTTY
# define ENOTTY (25)
#endif
#ifndef ETXTBSY
# define ETXTBSY (26)
#endif
#ifndef EFBIG
# define EFBIG (27)
#endif
#ifndef ENOSPC
# define ENOSPC (28)
#endif
#ifndef ESPIPE
# define ESPIPE (29)
#endif
#ifndef EROFS
# define EROFS (30)
#endif
#ifndef EMLINK
# define EMLINK (31)
#endif
#ifndef EPIPE
# define EPIPE (32)
#endif
#ifndef EDOM
# define EDOM (33)
#endif
#ifndef ERANGE
# define ERANGE (34)
#endif
/* 35 - also EAGAIN on BSD and EDEADLK on Linux. */
#ifndef ENOMSG
# if defined(RT_OS_DARWIN)
# define ENOMSG (91)
# elif defined(RT_OS_FREEBSD)
# define ENOMSG (83)
# elif defined(RT_OS_LINUX)
# define ENOMSG (42)
# else
# define ENOMSG (35)
# endif
#endif
/* 36 - Also EDEADLK on Windows. */
#ifndef EIDRM
# if defined(RT_OS_DARWIN)
# define EIDRM (90)
# elif defined(RT_OS_FREEBSD) || defined(RT_OS_NETBSD)
# define EIDRM (82)
# elif defined(RT_OS_OPENBSD)
# define EIDRM (89)
# elif defined(RT_OS_LINUX)
# define EIDRM (43)
# elif defined(RT_OS_WINDOWS)
# define EIDRM (600)
# else
# define EIDRM (36)
# endif
#endif
#ifndef EINPROGRESS
# if defined(RT_ERRNO_OS_BSD)
# define EINPROGRESS (36)
# elif defined(RT_OS_LINUX)
# define EINPROGRESS (115)
# else
# define EINPROGRESS (150)
# endif
#endif
#ifndef ENAMETOOLONG
# if defined(RT_ERRNO_OS_BSD)
# define ENAMETOOLONG (63)
# elif defined(RT_OS_LINUX)
# define ENAMETOOLONG (36)
# else
# define ENAMETOOLONG (78)
# endif
#endif
/* 37 */
#ifndef ECHRNG
# if defined(RT_ERRNO_OS_SYSV_HARDCORE)
# define ECHRNG (37)
# else
# define ECHRNG (599)
# endif
#endif
#ifndef ENOLCK
# if defined(RT_ERRNO_OS_BSD)
# define ENOLCK (77)
# elif defined(RT_OS_LINUX)
# define ENOLCK (37)
# else
# define ENOLCK (46)
# endif
#endif
#ifndef EALREADY
# if defined(RT_ERRNO_OS_BSD)
# define EALREADY (37)
# elif defined(RT_OS_LINUX)
# define EALREADY (114)
# else
# define EALREADY (149)
# endif
#endif
/** @todo errno constants {37..44}. */
/* 45 - also EDEADLK on Solaris, EL2NSYNC on Linux. */
#ifndef ENOTSUP
# if defined(RT_ERRNO_OS_BSD)
# define ENOTSUP (45)
# elif defined(RT_OS_LINUX)
# define ENOTSUP (95)
# else
# define ENOTSUP (48)
# endif
#endif
#ifndef EOPNOTSUPP
# if defined(RT_ERRNO_OS_BSD)
# define EOPNOTSUPP ENOTSUP
# elif defined(RT_OS_LINUX)
# define EOPNOTSUPP ENOTSUP
# else
# define EOPNOTSUPP (122)
# endif
#endif
/** @todo errno constants {46..74}. */
/* 75 - note that Solaris has constant with value 75. */
#ifndef EOVERFLOW
# if defined(RT_OS_OPENBSD)
# define EOVERFLOW (87)
# elif defined(RT_ERRNO_OS_BSD)
# define EOVERFLOW (84)
# elif defined(RT_OS_LINUX)
# define EOVERFLOW (75)
# else
# define EOVERFLOW (79)
# endif
#endif
#ifndef EPROGMISMATCH
# if defined(RT_ERRNO_OS_BSD)
# define EPROGMISMATCH (75)
# else
# define EPROGMISMATCH (598)
# endif
#endif
/** @todo errno constants {76..}. */
#endif
|