VirtualBox

source: vbox/trunk/include/iprt/errno.h@ 73108

Last change on this file since 73108 was 69105, checked in by vboxsync, 7 years ago

include/iprt/: (C) year

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

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette