VirtualBox

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

Last change on this file since 80761 was 76585, checked in by vboxsync, 6 years ago

*: scm --fix-header-guard-endif

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